-
Notifications
You must be signed in to change notification settings - Fork 272
[CMake] libta-lib.so does not link against libm causing missing math symbols at runtime #77
Copy link
Copy link
Open
Description
When building TA-Lib using the CMake build system, the produced shared library (libta-lib.so) is not linked against libm, resulting in multiple undefined math symbols at runtime and is only linked against libc:
[./lib/libta-lib.so.0.6.4]:
linux-vdso.so.1 (0x0000ffff98a32000)
libc.so.6 => /lib64/libc.so.6 (0x0000ffff986fe000)
/lib/ld-linux-aarch64.so.1 (0x0000ffff989e5000)
undefined symbol: atan (./lib/libta-lib.so.0.6.4)
undefined symbol: sin (./lib/libta-lib.so.0.6.4)
undefined symbol: cos (./lib/libta-lib.so.0.6.4)
undefined symbol: sqrt (./lib/libta-lib.so.0.6.4)
undefined symbol: acos (./lib/libta-lib.so.0.6.4)
undefined symbol: asin (./lib/libta-lib.so.0.6.4)
undefined symbol: log10 (./lib/libta-lib.so.0.6.4)
undefined symbol: tan (./lib/libta-lib.so.0.6.4)
undefined symbol: sinh (./lib/libta-lib.so.0.6.4)
undefined symbol: exp (./lib/libta-lib.so.0.6.4)
undefined symbol: cosh (./lib/libta-lib.so.0.6.4)
undefined symbol: log (./lib/libta-lib.so.0.6.4)
undefined symbol: tanh (./lib/libta-lib.so.0.6.4)This does not occur when building using the Autotools (configure) build, which correctly links -lm build here.
The CMake build includes checks for the existence of math-related functions here however, it never links libm into the shared library, except in a special-case used only for tests here. This linking step never happens for the actual build target (ta_lib or ta-lib), leading to missing symbols in the final shared library.
The fix should be something like:
target_link_libraries(ta_lib PRIVATE m)For example, here's how OpenBLAS does it.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels