loadlibrary and loaddefinedlibrary: undefined (mangled) symbol

Preconditions:
  • ArchLinux, x64
I have downloaded RSA_API x64 library for communication with Tektronix RSA spectrum analyser, which comes in several files: libRSA_API.so, RSA_API.h, libcyusb_shared.so and some examples in C and Python. C example is compiled with -lRSA_API and -lcyusb_shared flags (with an -L pointing to .so locations). Both examples work perfectly fine (should run with LD_LIBRARY_PATH set to so locations).
The problem:
loadlibrary('libRSA_API', 'RSA_API.h') results in following errors:
Error using loadlibrary
There was an error loading the library
"/the/location/of/so/files/libRSA_API.so"
/the/location/of/so/files/libRSA_API.so: undefined symbol:
_Z18cyusb_download_fx3P20libusb_device_handlePKc
Error in untitled (line 10)
[notfound, warnings]=loadlibrary('libRSA_API', 'RSA_API_no_bool.h');
Caused by:
Error using loaddefinedlibrary
/the/location/of/so/files/libRSA_API.so: undefined symbol:
_Z18cyusb_download_fx3P20libusb_device_handlePKc
The question:
What can I do to force matlab to resolve this undefined symbol? I've tried to mess with mex_C_glnxa64.xml inserting -lcyusb_shared and -L/path/ into various flags, setting LD_LIBRARY_PATH from matlab to no avail. Any help is welcome!
Appendix:
Inspecting the library files gives this results:
$ nm -Dg /the/location/of/so/files/libRSA_API.so | grep _Z18cyusb_download_fx3P20libusb_device_handlePKc
U _Z18cyusb_download_fx3P20libusb_device_handlePKc
$ nm -Dg /the/location/of/so/files/libcyusb_shared.so | grep _Z18cyusb_download_fx3P20libusb_device_handlePKc
0000000000004c23 T _Z18cyusb_download_fx3P20libusb_device_handlePKc
$ ldd /the/location/of/so/files/libRSA_API.so
linux-vdso.so.1 (0x00007fff517f9000)
libusb-1.0.so.0 => /usr/lib/libusb-1.0.so.0 (0x00007ff8b31db000)
libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x00007ff8b2ffe000)
libm.so.6 => /usr/lib/libm.so.6 (0x00007ff8b2eb8000)
libgcc_s.so.1 => /usr/lib/libgcc_s.so.1 (0x00007ff8b2e9e000)
libc.so.6 => /usr/lib/libc.so.6 (0x00007ff8b2cd5000)
libudev.so.1 => /usr/lib/libudev.so.1 (0x00007ff8b2cae000)
libpthread.so.0 => /usr/lib/libpthread.so.0 (0x00007ff8b2c8a000)
/usr/lib64/ld-linux-x86-64.so.2 (0x00007ff8b506b000)
$ ldd /the/location/of/so/files/libcyusb_shared.so
linux-vdso.so.1 (0x00007ffdd07c9000)
libgcc_s.so.1 => /usr/lib/libgcc_s.so.1 (0x00007fcaaff32000)
libc.so.6 => /usr/lib/libc.so.6 (0x00007fcaafd69000)
/usr/lib64/ld-linux-x86-64.so.2 (0x00007fcab018c000)
I am not that experienced with linking and shared libraries, but if ldd doesn't see the libcyusb_shared dependency, then matlab probably wouldn't too.
I am not planning to use the library directly, but as a part of Instrument Control Tollbox. The loadlibrary is a part of init script from Tektronix USB Spectrum Analyzer Driver.

Respuestas (0)

Categorías

Productos

Versión

R2020b

Etiquetas

Preguntada:

el 10 de Dic. de 2020

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by