QuantLib icon indicating copy to clipboard operation
QuantLib copied to clipboard

Shared library does not 'need' boost_system

Open tomwhoiscontrary opened this issue 7 years ago • 4 comments

I built QuantLib (with --enable-thread-safe-singleton-init configured) on Linux. The shared library declares that it needs a few other libraries:

$ objdump -p ql/.libs/libQuantLib.so.0.0.0 | grep NEEDED
  NEEDED               libstdc++.so.6
  NEEDED               libm.so.6
  NEEDED               libc.so.6
  NEEDED               libgcc_s.so.1

It does not declare that it needs boost_system.so.

However, it does include a symbol which can only be resolved in boost_system.so:

$ objdump --dynamic-reloc --demangle ql/.libs/libQuantLib.so.0.0.0 | grep R_X86_64_JUMP_SLOT | grep :: | tr -s ' ' | cut -d ' ' -f 3- | sed 's/@@Base//' | sort -u >jumpslots.lst

$ nm --defined-only --extern-only --demangle ql/.libs/libQuantLib.so.0.0.0 | cut -d ' ' -f 3- | grep :: | sort -u >exported.lst

$ comm -23 jumpslots.lst exported.lst >required.lst

$ grep -v std required.lst 
boost::system::generic_category()

As a consequence, when i try to load this library into Python, via the SWIG wrapper, it fails with:

ImportError: /path/to/lib/libQuantLib.so.0: undefined symbol: _ZN5boost6system16generic_categoryEv

Is that as intended? Or should the build process be adding a DT_NEEDED entry to the library? If so, am i doing something wrong, or is this a shortcoming of the build process?

There could also be something wrong with the way i am building or using the SWIG wrapper, but this does look like a problem with the QuantLib library itself to me.

tomwhoiscontrary avatar Jan 10 '18 12:01 tomwhoiscontrary

I don't know about DT_NEEDED entries (I thought autotools took care of those?), but yes, the library requires boost_system and possibly a couple of other. If you run

quantlib-config --libs

you should see the required link parameters. I know the above is called while building the Python wrappers, but it's quite possible that other languages don't. Which one are you using?

lballabio avatar Jan 15 '18 09:01 lballabio

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Sep 05 '19 15:09 stale[bot]

Ran into this again today.

tomwhoiscontrary avatar Sep 27 '19 13:09 tomwhoiscontrary

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Dec 26 '19 13:12 stale[bot]

This should be resolved by #1504

sweemer avatar Nov 06 '22 23:11 sweemer

Correct, thanks for noticing.

lballabio avatar Nov 07 '22 06:11 lballabio