celix icon indicating copy to clipboard operation
celix copied to clipboard

building celix on cygwin environment

Open wanglzh opened this issue 4 years ago • 1 comments

Hello,

There is a need for me to run celix on windows, I see the BUILDING say "Currently Apache Celix only builds and works on Unix/Linux like systems", but not sure whether cygwin is support or not. I have a try but not compiled correctly as below. Would you give me some advice for that? Thanks !

lab@LZ-WORK ~/projects/celix/build
$ cmake ..
-- Using jar to create bundles
-- Configuring done
CMake Error at cmake/cmake_celix/BundlePackaging.cmake:449 (add_custom_command):
  Error evaluating generator expression:

    $<TARGET_SONAME_FILE_NAME:http_admin>

  TARGET_SONAME_FILE is not allowed for DLL target platforms.
Call Stack (most recent call first):
  cmake/cmake_celix/BundlePackaging.cmake:336 (celix_bundle_libs)
  bundles/http_admin/http_admin/CMakeLists.txt:18 (add_celix_bundle)


CMake Error at cmake/cmake_celix/BundlePackaging.cmake:449 (add_custom_command):
  Error evaluating generator expression:

    $<TARGET_SONAME_FILE_NAME:civetweb_shared>

  TARGET_SONAME_FILE is not allowed for DLL target platforms.
Call Stack (most recent call first):
  cmake/cmake_celix/BundlePackaging.cmake:395 (celix_bundle_libs)
  bundles/http_admin/http_admin/CMakeLists.txt:32 (celix_bundle_private_libs)


CMake Error at cmake/cmake_celix/BundlePackaging.cmake:449 (add_custom_command):
  Error evaluating generator expression:

    $<TARGET_SONAME_FILE_NAME:log_writer_stdout>

  TARGET_SONAME_FILE is not allowed for DLL target platforms.
Call Stack (most recent call first):
  cmake/cmake_celix/BundlePackaging.cmake:336 (celix_bundle_libs)
  bundles/logging/log_service_v2/CMakeLists.txt:36 (add_celix_bundle)

wanglzh avatar Feb 26 '21 03:02 wanglzh

Hi,

Indeed Celix currently is only build and tested on Linux and Mac.

I am not a windows expert, so take this with a grain of salt, but to get Celix running under windows I think we need to do the following:

  1. Update the Celix CMake files to handle dll libraries next to so (linux) and dylib (mac) libraries. This is currently the error you are seeing. Apparently the cmake-generator-expresssion TARGET_SONAME_FILE does not work with dll libraries. Btw strange, because it does work with mac dylib libraries. https://cmake.org/cmake/help/v3.0/manual/cmake-generator-expressions.7.html

  2. Support pthread. Celix thread and mutex support is build on top of pthread. To get Celix running on windows the easiest way would be to support pthread. If I am correct this can be done with cygwin.

  3. Be able do dynamically load dll libraries Celix uses a load library abstraction: https://github.com/apache/celix/blob/master/libs/framework/src/celix_library_loader.h And currently there is only a dlopen implementation, but In the beginning of Celix (around 2010/2011) we also had an DLL loading abstraction. This could be reintroduced (i.e. compile a celix_windows_library_loader.c instead of celix_library_loader.c on windows).

  4. If I am correct with windows C/C++ functions need to explicitly declared exported in a library. This is currently not done and needs to be done for lib framework, utils and the bundle activators.

  5. Setup a CI pipeline to ensure Celix works and keeps working for a windows environment.

Hopefully this helps in getting a better overview were Celix stands with respect for Windows support.

pnoltes avatar Feb 28 '21 14:02 pnoltes