molassembler icon indicating copy to clipboard operation
molassembler copied to clipboard

Linking against shared library

Open awvwgk opened this issue 2 years ago • 1 comments

Setting -DBUILD_SHARED_LIBS=ON does only additionally build a shared library and not disable the static library build. Further, linking against the shared library leads to missing symbols for some reason.

Is there a possibility to avoid building the static library and specially link the Python extension module against the shared library (see #6)?

awvwgk avatar Aug 13 '22 19:08 awvwgk

Any static or shared libraries are built from the same set of object files, so nothing gets compiled twice.

The static variant is always built to allow testing of non-public API functions (due to visibility annotations), and is the library variant chosen for the python packages as reasoned here.

See src/CMakeLists.txt:

if(BUILD_SHARED_LIBS)
  # If molassembler is shared, we still need a static variant for linking into
  # the tests and other binaries that hook deeper into molassembler than the
  # public API
  add_library(MolassemblerStatic STATIC [...]

Though avoiding a static library build is not feasible on these grounds, we can add the possibility of linking a shared variant of molassembler into the python module SO if you need.

Feel free to elaborate on your issues with missing symbols, those are clearly not intended behavior.

jan-grimo avatar Aug 17 '22 14:08 jan-grimo

When has this been resolved?

awvwgk avatar Oct 12 '23 13:10 awvwgk