The scenario(Linux):
Executable -> shared library -> [xrt static library]
(It is a commercial product based on Motif)
The executable will call the shared library, and the shared library will call static library.
I do the following to compile and linking the shared library:
$ gcc -fPIC --unresolved-symbols=ignore-in-shared-lib -c demo.c (compling)
$ gcc -shared -o libdemo.so demo.o (linking)
Note here, I do not link the xrt static library though it uses the xrt static library functions
The executable will link the shared library(libdemo.so) like below:
$ gcc -fPIC --unresolved-symbols=ignore-in-shared-lib main.c -Ixxxx
$ gcc -o main main.o -Lxxxx -ldemo -L/opt/xrt/lib -lxrtm -lXpm -lxrt3d -lxrtfield -lxrtgauge -lxrtm -lxrttable -lpdsutil
Here the executable linked the xrt static library
When I run the executable it gives me 'symbol lookup error':
$ ./main
./main: symbol lookup error: /xxx/libdemo.so: undefined symbol: xmXrtTabManagerWidgetClass
In the xrt static library directory, it has some static libraries. And when I run nm
command, it gives me the below result:
$ nm *.a | grep xmXrtTabManagerWidgetClass
U xmXrtTabManagerWidgetClass
0000000000000b18 D xmXrtTabManagerWidgetClass
U xmXrtTabManagerWidgetClass
U xmXrtTabManagerWidgetClass
The xmXrtTabManagerWidgetClass
symbol is defined in commercial product (which wrapped in static library). Is there any way to solve this problem?