[ITK-dev] Not linking against libpython
Bradley Lowekamp
blowekamp at mail.nih.gov
Wed Mar 23 16:16:22 EDT 2016
Hello,
I have been working on getting SimpleITK manylinux wheels to build for distribution. This is specified in PEP 0513[1].
Of note ( and problem ), is that it says the loadable python module should not be explicitly linked against any libpython. The loadable module should get the symbols from the python executable which loads it. This works with python built both with static and shared libraries.
Here was an interesting article related to this subject [2]. While focused more on implicit transitive shared libraries linking, I presume that CMake’s PRIVATE|PUBLIC|INTERFACE linkage specification takes care of this. I am curious and will test the specific case in this article with CMake.
Now for this particular problem, ignoring libpython passed through target_link_libraries works. Resulting the “DT_NEEDED” symbols for python symbols, and no explicit dependency on libpython for _SimpleITK.so. We have already done something similar for OSX[3].
1) Is there a more CMAKE-ic way for doing this? With all they library and linking properties?
2) Is there a way to know if the linker allows undefined symbols for shared libraries?
Thanks,
Brad
[1] https://www.python.org/dev/peps/pep-0513/
[2] http://www.kaizou.org/2015/01/linux-libraries/
[3] https://github.com/SimpleITK/SimpleITK/blob/master/CMake/sitkExtras.cmake#L15-L21
More information about the Insight-developers
mailing list