From b76315abdbfe21f79c71abc7304c0ed0a7bdbe50 Mon Sep 17 00:00:00 2001 From: PengZheng Date: Mon, 18 Sep 2023 13:50:56 +0800 Subject: [PATCH 1/2] Add documentation for workaround for Conan's CMake private linking issue --- documents/building/README.md | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/documents/building/README.md b/documents/building/README.md index 71d2ed0e3..145b2e2f3 100644 --- a/documents/building/README.md +++ b/documents/building/README.md @@ -103,6 +103,26 @@ To see a complete overview of the available build options use the following comm conan inspect . | grep build_ ``` +#### CMake Private Linking Workaround + +When using Celix via Conan, you may encounter an [issue](https://github.com/apache/celix/issues/642) where libzip.so is not found by linker. +This is due to a [bug in Conan](https://github.com/conan-io/conan/issues/7192). + +A workaround we adopt in Celix is to add the following to the conanfile.py: + +```python + def generate(self): + deps = CMakeDeps(self) + deps.generate() + tc = CMakeToolchain(self) + # the following is workaround for https://github.com/conan-io/conan/issues/7192 + 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() +``` + ### Building Apache Celix directly using CMake The following packages (libraries + headers) should be installed on your system: From 8d0dbb5392b5966bf61800e6c953f5da8376d62e Mon Sep 17 00:00:00 2001 From: PengZheng Date: Mon, 18 Sep 2023 19:08:33 +0800 Subject: [PATCH 2/2] Refine the wording in building instructions --- documents/building/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/documents/building/README.md b/documents/building/README.md index 145b2e2f3..fd69669ca 100644 --- a/documents/building/README.md +++ b/documents/building/README.md @@ -108,7 +108,7 @@ conan inspect . | grep build_ When using Celix via Conan, you may encounter an [issue](https://github.com/apache/celix/issues/642) where libzip.so is not found by linker. This is due to a [bug in Conan](https://github.com/conan-io/conan/issues/7192). -A workaround we adopt in Celix is to add the following to the conanfile.py: +A workaround we adopt in Celix is adding the following to conanfile.py: ```python def generate(self):