-
-
Notifications
You must be signed in to change notification settings - Fork 4.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve toggling between static/dynamic linking of dependency libraries #2089
Comments
Answering the first block of questions:
Second questions:
Agreed
Default to static and error if not found. |
I stand corrected $ makeScanning dependencies of target dynamic
[ 16%] Building CXX object CMakeFiles/dynamic.dir/dynamic.cpp.o
[ 33%] Linking CXX shared library libdynamic.so
[ 33%] Built target dynamic
Scanning dependencies of target static
[ 50%] Building CXX object CMakeFiles/static.dir/static.cpp.o
[ 66%] Linking CXX static library libstatic.a
[ 66%] Built target static
Scanning dependencies of target executable
[ 83%] Building CXX object CMakeFiles/executable.dir/executable.cpp.o
[100%] Linking CXX executable executable
[100%] Built target executable
$ ./executable
1
-1
$ ldd executable
linux-vdso.so.1 => (0x00007ffd6293e000)
libdynamic.so => <path>/link_static_against_dynamic/build/libdynamic.so (0x00007f0002ea5000)
libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f0002ae4000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f000271a000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f0002411000)
/lib64/ld-linux-x86-64.so.2 (0x000055e796ba6000)
libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f00021fb000) I don't understand why I had problem with this before then... |
Hm, I'm afraid we don't have complete understanding of the use cases and the reasons why these options were introduced. For example, with Boost the explicit request for dynamic linking |
I would say we ask @UnaNancyOwen to give it a try to some of these Windows cases individually and report what's the outcome, starting with that one you just mentioned. |
What should I try and report? |
You'll need to modify the cmake file, but the idea is to set |
PCL can build normally with these options on Windows.
|
Was PCL actually build as a static lib as well? |
Yes, PCL was built as a static library. |
Thanks for trying this out, Tsukasa. So it seems like all possible combinations of static/dynamic settings are valid on all platforms. Therefore, I propose the following solution, which on one hand is zero-configuration for those who don't care, and utmost flexible for those who care.
Suggestions for a better name of the new options are welcome. |
Agreed. It's a very solid approach. |
Looks good proposal. |
Marking this as stale due to 30 days of inactivity. It will be closed in 7 days if no further activity occurs. |
@shrijitsingh99 please read this discussion since you're fiddling with boost related options |
Follow-up to discussions in #2084.
Plan:
PCL_BUILD_WITH_BOOST_DYNAMIC_LINKING_WIN32
PCL_BUILD_WITH_FLANN_DYNAMIC_LINKING_WIN32
BOOST_USE_STATIC
FLANN_USE_STATIC
QHULL_USE_STATIC
Open questions:
FLANN_USE_STATIC=TRUE
, but only dynamic libraries are available, is this a configuration error? Or do we issue a warning and coerce the option toFALSE
?PCL_SHARED_LIBS
? If shared libs are disabled, i.e. the user wants to compile PCL as a static library, should it force all the dependencies to be static as well?The second question may involve some complicated logic. Stepping a bit back, I wonder if such level of configurability is actually needed? Maybe
PCL_SHARED_LIBS
is sufficient? If it is set, then we default to finding shared dependencies and fall back to static. If it is not set, then we default to static and fall back to shared (or even error)?The text was updated successfully, but these errors were encountered: