Skip to content

Commit

Permalink
Merge pull request #644 from apache/hotfix/642-cmake-private-linking-…
Browse files Browse the repository at this point in the history
…workaround-doc

Documentation for Workaround for Conan's CMake private linking issue
  • Loading branch information
PengZheng authored Sep 19, 2023
2 parents e1d7fc1 + 8d0dbb5 commit 91ff81c
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions documents/building/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 adding the following to 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:

Expand Down

0 comments on commit 91ff81c

Please sign in to comment.