Operating System - Linux
1748213 Members
3020 Online
108759 Solutions
New Discussion юеВ

Re: unresolved symbol after removing an unwanted library from the -L option

 
SOLVED
Go to solution
beeshmanth
New Member

unresolved symbol after removing an unwanted library from the -L option

Our HP-UX version is 11.11 where we build the code

Initially in our make file we used the -L option as below for creating a dynamic library libX and it was succesfully loaded by the binary binaryY at run time

-L -lstd_v2 -ldld -lstream -lpthread -lCsup_v2 -lrwtool_v2 -lrpcsvc -lcl -Wl,+s -lmylibrary

lmylibrary was no more needed for building the dynamic library libX and i removed the -lmylibrary and the -L option became

-L -lstd_v2 -ldld -lstream -lpthread -lCsup_v2 -lrwtool_v2 -lrpcsvc -lcl -Wl,+s

after the above change although i am able to build the dynamic library libX but when i try to run the binaryY which tries to load libX at runtime, i am getting the error as below

aCC runtime: Error 215 from shl_findsym(/usr/lib/libstream.2,_shlInit)
/usr/lib/dld.sl: Unresolved symbol: typeid__XT9exception_ (data) from /usr/lib/libstream.2
Abort(coredump)

and on anaylsis of the core file found the below stack trace

#0 0xc020d5b8 in kill+0x10 () from /usr/lib/libc.2
#1 0xc01a6f7c in raise+0x24 () from /usr/lib/libc.2
#2 0xc01e81e0 in abort_C+0x160 () from /usr/lib/libc.2
#3 0xc01e823c in abort+0x1c () from /usr/lib/libc.2
#4 0xc0475abc in __shlinit+0x1e0 () from /usr/lib/libCsup_v2.2
#5 0xc0477fc0 in _main+0xd8 () from /usr/lib/libCsup_v2.2


Can somebody tell me why i am getting the problem and possible solutions to overcome the problem.
6 REPLIES 6
Steven E. Protter
Exalted Contributor

Re: unresolved symbol after removing an unwanted library from the -L option

Shalom,

Speculation:
1) You have code that still requires the library.
2) Other compile options need to be changed.

I'd go for #1, but I don't have access to the code.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
beeshmanth
New Member

Re: unresolved symbol after removing an unwanted library from the -L option

I did the change of removing the -lmylibrary from the -L option on other platforms like AIX, Linux and it is working fine, the problem is visible only on HP-UX
Dennis Handly
Acclaimed Contributor
Solution

Re: unresolved symbol after removing an unwanted library from the -L option

>we used the -L option as below

You have an improper -L option and you also have -l and -Wl options.

>for creating a dynamic library libX

For creating aC++ shlibs, you must follow the directions here:
http://www.docs.hp.com/en/7762/5991-4874/distributing.htm#linking

-L -lstd_v2 -ldld -lstream -lpthread -lCsup_v2 -lrwtool_v2 -lrpcsvc -lcl -Wl,+s -lmylibrary

There are N things wrong with this.
You should NOT have a -L without a path.
You shouldn't have -lpthread on shlibs, that belongs on the executable. (If you do use -lpthread in your application, you should compile with -mt.) You can't have -lcl if you intend to dynamically load libX.

You lib ordering isn't correct. For -AA you need:
-lrwtool_v2 -lstd_v2 -lCsup_v2 -lcl -ldld

Do you really need librwtool_v2, because you use tools.h++?
Also, you must remove -lstream since you can't mix -AP libs with -AA. That's why you get that error 215.

>and on analysis of the core file found the below stack trace

No need to look at the stack trace, everything is in the error message.
Dennis Handly
Acclaimed Contributor

Re: unresolved symbol after removing an unwanted library from the -L option

If you have an unsat when you remove -lmylibrary you may have a more serious problem.
That symbol means you are using -AP. And if -lmylibrary is compiled with -AP and you have others, you are mixing -AP with -AA libs, which isn't supported.
beeshmanth
New Member

Re: unresolved symbol after removing an unwanted library from the -L option

After removing -lmylibrary and the -lstream which is of AP format (see the below line for the updated libraries i used), i built my shared library libX and was able to use libX via binY succesfully

-lstd_v2 -lpthread -lCsup_v2 -lrwtool_v2 -lrpcsvc -lcl -Wl,+s

Thanks for the suggestions provided.
Dennis Handly
Acclaimed Contributor

Re: unresolved symbol after removing an unwanted library from the -L option

>-lstd_v2 -lpthread -lCsup_v2 -lrwtool_v2 -lrpcsvc -lcl -Wl,+s

This does NOT match the ordering in the above link. You must use:
-lrwtool_v2 -lstd_v2 -lCsup_v2 -lcl