celix-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Pepijn Noltes <pepijnnol...@gmail.com>
Subject Re: Updated CMake bundle and deploy commands
Date Fri, 22 Apr 2016 13:37:44 GMT
Hi Miroslav,


On Thu, Apr 21, 2016 at 9:49 PM Miroslav Beranič <
miroslav.beranic@mibesis.si> wrote:

> Hi Pepijn,
>
> I've updated GIT repository. This was quick.
>
> $ sh ./run.sh
> -> entry .cache/bundle4/version0.0/root
> Mongoose started on: 8081
> Launcher: Framework Started
> ^C INFO: FRAMEWORK: Start shutdownthread
> INFO: FRAMEWORK: Shutdown
> Mongoose stopped
> INFO: FRAMEWORK: Successful shutdown
> Launcher: Exit
> $
>
> Looks like it works. So thank you very much.
>
> I thought bundle_files are only for the per-file addition of resources
> to the bundle. Need to check it out further.
>
> Well, I used IMPORT_LIBRARIES until now -- so this was not used/picked
> up by CELIX? Hmmm.
>

Yeah. I really did not expect this was used, I did take the effort to look
a bit more deeply. The support for import libraries is still in the
framework, so I had this wrong.
I added an issue [1] and committed an update to the develop branch to
enable import libraries in the updated cmake commands.  See hello_world as
example.

Could you test if this works for you?

Do note, that this is different from what you used to do. I have been
investigating how Celix could do import libraries. The challenges is that
normally dlopen has a flat namespace.
Meaning that if there is a library with a certain SONAME header, that
library will automatically be used to satisfies a NEEDED header... well as
far is I known.
The result is that SONAME and NEEDED need to match only when the resolver
has resolved the libraries. This implies that we need to runtime update the
library binaries.

I have been investigating dlmopen [2], part of the latest (?) gnu libc, and
this seems a perfect solution, but is only for the "latest and greatest"
linux distros.
Another solution solution could be explicitly reloading certain libraries,
but I still need to test this.

In short import libraries works, but I am not sure how it acts if multiple
exported library versions are available in the framework...

Btw I will be away for a few days, so if there any more issues I am not
able the respond directly.

[1] https://issues.apache.org/jira/browse/CELIX-356
[2] http://man7.org/linux/man-pages/man3/dlopen.3.html




>
>
> OK, I have like this (this is current setup, working with CELIX 1.x --
> do not know the exact version number).
>
> Bundle 1:
>
> BUNDLE_LIBRARY(my_lib_1
> SOURCES
>   private/src/source.c
> LINK_LIBRARIES
>   celix_framework
> )
>
> BUNDLE_PRIVATE_LIBRARY(private
> SOURCES
>   private/src/activator.c
> LINK_LIBRARIES
>   celix_framework
>   my_lib_1
> )
>
> BUNDLE(
>     ACTIVATOR "${BUNDLE_SYMBOLICNAME}-private"
>     PRIVATE_LIBRARIES "private"
>     EXPORT_LIBRARIES my_lib_1
> )
>
> I use this in other bundles:
> BUNDLE(my_bundle_1
>         SOURCES
>         private/src/activator
>         IMPORT_LIBRARIES
>         "my_lib_1"
> )
>
>
> Well, do not ask me how I picked up this flow, as I forgot. I picked
> up from existing (at that time) examples, samples and CELIX source
> tree.
>
>
> Do you suggest better flow/arrangement of the bundles/libraries?
>
>
> One thing that I would like to achieve is:
> a.) Make my own sources compiled to a library available to other
> bundles on the same CELIX deployment.
> b.) Make 3rd party libraries deployed on CELIX and available to other
> bundles deployed on the same CELIX deployment
>
> I thought this solves my issue, do you suggest another approach?
>
>
>
> Well, I'm still working on "my" HTTP CELIX Service. I do not want to
> make it public, as I have to work on the API and developer examples
> and documentation. What I can say is --- CELIX is my top favorite
> project to work with. It brought back the love for the C language. I
> know you do not agree/approve C++, I will have to use it - as I am
> using Boost Spirit for a text parser. It is the only C/C++ project
> that I know to work with.
> I also wrote small CSP - C server pages parser, to be able to write
> "JSP like" pages and do like <%= "Hello world" %> ( and much more :D
> ), compile it to C (at the CMake run) and deploy it to CELIX bundle
> and be deployed and served on /hello URL. BUT: it is long way to have
> it memory leak free and developer friendly. Hacking is one effort,
> public/production project takes another :D .
>
>
> All in all, thank you for the quick response. Now I have another bone
> to chew on :D .
>
>
>
> Thank you. Kind Regards,
> Miroslav
>
>
>
>
>
> 2016-04-21 21:05 GMT+02:00 Pepijn Noltes <pepijnnoltes@gmail.com>:
> > Hi Miroslav,
> >
> > On Thu, Apr 21, 2016 at 5:57 PM, Miroslav Beranič
> > <miroslav.beranic@mibesis.si> wrote:
> >> Hi Pepijn,
> >>
> >> I've just now, yesterday, updated GIT - and took time to checkout new
> >> version of CELIX.
> >> Nothing was building nor working :D So that is a good start - a lot of
> changes.
> >>
> >> I think I am more-or-less clear on all the changes done, but some are
> >> still getting my head knocking against my desk.
> >>
> >> As I did not find answer in the current source tree or documentation,
> >> can be I was sloppy, but. Could you be kind to help me about a bit.
> >>
> >> So I had a bundle, that has CMake definition like this:
> >>
> >> bundle(${BUNDLE_SYMBOLICNAME}
> >> SOURCES
> >>     private/src/activator
> >> DIRECTORIES
> >>     root
> >> )
> >>
> >> Where did the DIRECTORIES command/directive move to? I saw: add_files,
> >> but not directories.
> >> I looked at the mongoose example, but - I am not able to get it
> >> working, as it looks like it is also missing this root directory in
> >> the bundle entry set.
> >
> > Oops. Good catch, yes the mongoose example did not work anymore. I
> > just committed the fix on the develop branch.
> > Please check this out, it uses the bundle_files cmake command to add a
> > directory to the bundle.
> > I did notice that for me make clean was needed to trigger a new
> > creation of the bundle zip.
> >
> >>
> >> I build CELIX and Mongoose example like this:
> >>
> >>
> >> git clone https://github.com/apache/celix.git
> >> git checkout develop
> >>
> >> mkdir build && cd build
> >> cmake -DBUILD_DEPENDENCY_MANAGER=ON -DBUILD_DEPLOYMENT_ADMIN=ON
> >> -DBUILD_DEVICE_ACCESS=ON -DBUILD_DEVICE_ACCESS_EXAMPLE=ON
> >> -DBUILD_EXAMPLES=ON -DBUILD_FRAMEWORK=ON -DBUILD_LAUNCHER=ON
> >> -DBUILD_LOG_SERVICE=ON -DBUILD_LOG_WRITER=ON
> >> -DBUILD_LOG_WRITER_SYSLOG=ON -DBUILD_REMOTE_SERVICE_ADMIN=ON
> >> -DBUILD_REMOTE_SHELL=ON -DBUILD_SHELL=ON -DBUILD_SHELL_TUI=ON
> >> -DCMAKE_BUILD_TYPE=Debug -DDOXYFILE_LATEX=ON
> >> -DJAR_COMMAND=/opt/jdk1.8/bin/jar -DCMAKE_INSTALL_PREFIX=/opt/celix/
> >> ../celix/
> >>
> >> make all
> >>
> >> make deploy
> >>
> >>
> >> cd deploy/mongoose_deploy
> >>
> >> $ sh ./run.sh
> >> -> entry (null)
> >> Launcher: Framework Started
> >> INFO: FRAMEWORK: Start shutdownthread
> >>
> >> CTRL+C
> >>
> >> INFO: FRAMEWORK: Shutdown
> >> Segmentation fault (core dumped)
> >> $
> >> $ tree .cache/bundle4/
> >> .cache/bundle4/
> >> ├── bundle.id
> >> ├── bundle.lastmodified
> >> ├── bundle.location
> >> └── version0.0
> >>     ├── libmongoose.so.0
> >>     ├── META-INF
> >>     │   └── MANIFEST.MF
> >>     └── revision.location
> >>
> >> 2 directories, 6 files
> >>
> >>
> >> Did I miss something or is this example not correct? It looks like it
> >> is missing something as the startup fails and there is no response on
> >> port 8081.
> >>
> >>
> >> Another problem I have, and also failed to find appropriate replacement
> is:
> >>
> >> BUNDLE(${BUNDLE_SYMBOLICNAME}
> >>     SOURCES
> >>         private/src/activator.c
> >>     IMPORT_LIBRARIES
> >>         "eu.mibesis.httpservice.api.library"
> >>         "eu.mibesis.mvc.api.library"
> >> )
> >>
> >> With what is the command IMPORT_LIBRARIES replaced? Also for this I
> >> did not find working replacement.
> >
> > The IMPORT_LIBARIES is also part of the updated cmake command. But i
> > saw there was a typo in the
> > cmake command document. I also commit a update for this on the develop
> branch.
> >
> > That being said, import libraries are not yet supported.
> > I known we had some experimental changes from that, but in the current
> > master/develop this is not used.
> > Note that this is not the result of the revamped cmake commands.
> >
> > Do you really import the libraries from different bundles?
> > Or do want to embed the libraries in your bundles, because for the
> > latter you the PRIVATE_LIBRARIES options in add_bundle (or
> > bundles_private_libs cmake command)
> >
> >
> >>
> >> For other changes it was well documented and working as advertised.
> >>
> >>
> >> I've tried master and develop branch from GitHub GIT repository.
> >>
> >> I've also not tried the celix bootstrap project, but it looks really
> >> interesting. +1 for it.
> >>
> >>
> >> Kind Regards,
> >> Miroslav
> >>
> >>
> >> 2016-02-04 14:44 GMT+01:00 Pepijn Noltes <pepijnnoltes@gmail.com>:
> >>> Hi All,
> >>>
> >>> I have been working on a revamp of the Celix specific CMake commands.
> The
> >>> main reason to do this was to get rid of the deploy.cmake files.
> >>> At the moment these files are needed when you want to create a
> "deployment"
> >>> of a selection of bundes.
> >>> One of the problems is that even if you disabled a certain
> subdirectory the
> >>> deploy.cmake in that directory will still be processed. To counter this
> >>> additional CMake code is needed.
> >>>
> >>> To solve this and some other issues I rewrote the Packaging.cmake so
> that
> >>> to process is more based on CMake target properties [1] and CMake
> generator
> >>> expressions [2]. I also took the liberty to split up and rename the
> >>> commands in a more CMake style (e.g. add_<target_type> commands)
> >>>
> >>> Differences are
> >>> - No separate deploy.cmake needed. You can use add_deploy in normal
> >>> CMakeLists.txt files. Also as result no additional test concerning
> >>> subprojects are needed.
> >>> - bundle command has become add_bundle command
> >>> - deploy command has become add_deploy command
> >>> - possibility to create multiple bundles in one CMakeLists.txt file.
> >>> - There are several supporting CMake commands for add_bundle and
> add_deploy
> >>> - version info of bundle also used for so version information
> >>> - libcelix_framework, libcelix_utils and libcelix_dfi are now generated
> >>> with a so version.
> >>> - Added CMake commands are documented in documents dir, see [3]
> >>> - Legacy wrapper command for bundle -> add_bundle and deploy->
> add_deploy
> >>> exists. Supporting most, but not all old features.
> >>> - For the Celix project all existing bundle commands and deploy.cmake
> files
> >>> are updated to the new commands
> >>> - If jar or zip command is present on the host system, make install
> can be
> >>> used. If not make install-all (CPack) must be used. CMake will
> generate a
> >>> message for this.
> >>> - add_deploy supports adding not yet existing bundle targets. Removing
> the
> >>> need for certain add_bundle ordering.
> >>> - support for Ninja and "make -j"
> >>> - Moved and updated the "Apache Celix Subprojects", "building Apache
> Celix"
> >>> and "Getting Started with Apache Celix" to the documents dir, see [4].
> [5]
> >>> and [6]
> >>>
> >>> If there are no objections I would like to merge this feature into the
> >>> development branch.
> >>> The documentation still needs some work and there are probably still
> some
> >>> bugs. but I would prefer to push this in preparation of a next Celix
> >>> release.
> >>>
> >>> [1]
> https://cmake.org/cmake/help/v3.4/command/set_target_properties.html
> >>> [2]
> >>>
> https://cmake.org/cmake/help/v3.4/manual/cmake-generator-expressions.7.html?highlight=generator
> >>> [3]
> >>>
> https://github.com/apache/celix/blob/feature/CELIX-335_deploy_refactoring/documents/cmake_commands/readme.md
> >>> [4]
> >>>
> https://github.com/apache/celix/tree/feature/CELIX-335_deploy_refactoring/documents/subprojects
> >>> [5]
> >>>
> https://github.com/apache/celix/tree/feature/CELIX-335_deploy_refactoring/documents/building
> >>> [6]
> >>>
> https://github.com/apache/celix/tree/feature/CELIX-335_deploy_refactoring/documents/getting_started
> >>>
> >>>
> >>> Greetings,
> >>> Pepijn
> >>
> >>
> >>
> >> --
> >> Miroslav Beranič
> >> MIBESIS
> >> +386(0)40/814-843
> >> miroslav.beranic@mibesis.si
> >> http://www.mibesis.si
>
>
>
> --
> Miroslav Beranič
> MIBESIS
> +386(0)40/814-843
> miroslav.beranic@mibesis.si
> http://www.mibesis.si
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message