Open Jimbopython opened 9 months ago
compiler.runtime
is no-op on Linux, it's just for VC runtime on Windows. So your issue is related to conan in general, not flann recipe specifically.
Well I think flann adds the dependency to the c++ runtime in the package info wrongly. Boost for example does not add the dependency at all? Maybe it is wrong to add the dependency to the runtime in the first place?
It's a workaround for C consumers, since flann is a C++ library with C API, and conan doesn't offer a way to add linker properties to CMake targets in files generated by CMakeDeps. So no it's not wrong fundamentally, flann depends on C++ standard library, what is wrong is that conan doesn't model static libcxx in profile.
Sorry for the late response! I had a look at other libraries with c interface and C++ backend. czmq for example does not link c++ runtime, when building a static library. When doing so, one gets a linker error. I think it may be better for the user to run into this error, than silently linking dynamic c++ runtime.
The other way would be to fix conan itself, not ignoring static runtime on linux. How and where can i address this?
There is an open issue in conan client repo: https://github.com/conan-io/conan/issues/15646
Description
When building the flann library via conan, it does not respect setting a static runtime, when building it as a static library.
In the generated cmake finder module, the libc++ is mentioned as a dependency:
This might come from the conanfile of flann:
It may be changed to something like:
Package and Environment Details
Conan profile
[settings] os=Linux arch=x86_64 compiler=clang compiler.version=16 compiler.libcxx=libc++ compiler.runtime=static compiler.cppstd=20
[env] CC=/usr/bin/clang CXX=/usr/bin/clang++
Steps to reproduce
conan install flann/1.9.2@ --install-folder build --build -pr:b clang_test -pr:h clang_test -s:h build_type=Release -g cmake_find_package -o shared=False
Logs
Click to expand log
``` Conan 1 is on a deprecation path, please consider migrating to Conan 2 Configuration (profile_host): [settings] arch=x86_64 build_type=Release compiler=clang compiler.cppstd=20 compiler.libcxx=libc++ compiler.runtime=static compiler.version=16 os=Linux [options] shared=False [build_requires] [env] CC=/usr/bin/clang CXX=/usr/bin/clang++ Configuration (profile_build): [settings] arch=x86_64 compiler=clang compiler.cppstd=20 compiler.libcxx=libc++ compiler.runtime=static compiler.version=16 os=Linux [options] [build_requires] [env] CC=/usr/bin/clang CXX=/usr/bin/clang++ lz4/1.9.4: Forced build from source flann/1.9.2: Forced build from source Installing package: flann/1.9.2 Requirements flann/1.9.2 from 'conancenter' - Cache lz4/1.9.4 from 'conancenter' - Cache Packages flann/1.9.2:545572333fa0aa4a66450c56b85ebf8f17c55f8f - Build lz4/1.9.4:ff2cd1780794ed7c7c274d576049f53de7fefeba - Build Installing (downloading, building) binaries... lz4/1.9.4: Copying sources to build folder lz4/1.9.4: Building your package in /home/lst/.conan/data/lz4/1.9.4/_/_/build/ff2cd1780794ed7c7c274d576049f53de7fefeba lz4/1.9.4: Generator txt created conanbuildinfo.txt lz4/1.9.4: Calling generate() lz4/1.9.4: Preset 'release' added to CMakePresets.json. Invoke it manually using 'cmake --preset release' lz4/1.9.4: If your CMake version is not compatible with CMakePresets (<3.19) call cmake like: 'cmake