PengZheng commented on issue #643:
URL: https://github.com/apache/celix/issues/643#issuecomment-1722698488

   I cannot reproduce your issue on a brand-new Ubuntu machine.
   So I record my steps here for reference.
   
   If following these steps strictly does not address your issue, feel free to 
reopen it.
   
   # Setup Project
   
   `conan new cmake_lib -d name=cxx_shell_example -d version=0.1` gives me a 
minimal project.
   I modified it a bit (see inline comments).
   
   ```Python
   from conan import ConanFile
   from conan.tools.cmake import CMakeToolchain, CMake, CMakeDeps
   
   
   class cxx_shell_exampleRecipe(ConanFile):
       name = "cxx_shell_example"
       version = "0.1"
       package_type = "library"
   
       # Optional metadata
       license = "<Put the package license here>"
       author = "<Put your name here> <And your email here>"
       url = "<Package recipe repository url here, for issues about the 
package>"
       description = "<Description of cxx_shell_example package here>"
       topics = ("<Put some tag here>", "<here>", "<and here>")
   
       # Binary configuration
       settings = "os", "compiler", "build_type", "arch"
       options = {"shared": [True, False], "fPIC": [True, False]}
       default_options = {"shared": False, "fPIC": True}
   
       # Sources are located in the same place as this recipe, copy them to the 
recipe
       exports_sources = "CMakeLists.txt", "src/*", "include/*"
   
       # MODIFICATION: setup environment for me 
       generators = "VirtualRunEnv" 
   
       def config_options(self):
           if self.settings.os == "Windows":
               self.options.rm_safe("fPIC")
   
       def configure(self):
           if self.options.shared:
               self.options.rm_safe("fPIC")
           # MODIFICATION: minimal requirement
           self.options["celix"].build_shell_tui = True
   
       def requirements(self):
           self.requires("celix/2.3.0")
   
       def generate(self):
           deps = CMakeDeps(self)
           deps.generate()
           tc = CMakeToolchain(self)
           # MODIFICATION: workaround for 642
           if self.settings.os == "Linux":
               tc.cache_variables["CMAKE_EXE_LINKER_FLAGS"] = 
"-Wl,--unresolved-symbols=ignore-in-shared-libs"
           elif self.settings.os == "Macos":
               tc.cache_variables["CMAKE_EXE_LINKER_FLAGS"] = "-Wl,-undefined 
-Wl,dynamic_lookup"
           tc.generate()
   
       def build(self):
           cmake = CMake(self)
           cmake.configure()
           cmake.build()
   
       def package(self):
           cmake = CMake(self)
           cmake.install()
   
   ```
   
   ```CMake
   cmake_minimum_required(VERSION 3.15)
   project(cxx_shell_example CXX)
   
    # MODIFICATION: use Celix to build bundle container
   find_package(Celix)
   
   add_celix_container(TestCelixContainer CXX
           BUNDLES
           Celix::ShellCxx
           Celix::shell_tui
   )
   
   ```
   
   # Build 
   
   ```
    conan build . -pr:b default -pr:h default -b missing -of cmake-build-release
   ```
   
   # Run
   
   ```
   cd cmake-build-release
   source conanrun.sh
   # check env is setup by conanrun.sh 
   # echo $LD_LIBRARY_PATH
   cd deploy/TestCelixContainer/
   ./TestCelixContainer
   -> [2023-09-18T11:10:36] [   info] [celix_framework] [framework_start:476] 
Celix framework started
   ->
   -> quit
   Quitting framework
   ```
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@celix.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to