Operating System - HP-UX
1833130 Members
3525 Online
110051 Solutions
New Discussion

unresolved symbol: __shlinit during shlload()

 
SOLVED
Go to solution

unresolved symbol: __shlinit during shlload()

I am compiling a lib using aCC (HP ANSI C++ B3910B A.03.13) on HP-UX 11.00 with patch PHSS_24303 installed. We have to use the Python interpreter which loads our library using shlload(). When I try to load our lib from python, I receive the following error message:

shl_load /tse/prj/itl/itlR3/itlR3-current/execs/lib/itl_hpx_debug_acc/itlmodule.sl
/usr/lib/dld.sl: Unresolved symbol: __shlinit (code) from /tse/prj/cos/cosR4/COSLibR4-current//execs/lib/hpx_debug_acc/libicudt20b.sl
/tse/prj/itl/itlR3/itlR3-current/execs/lib/itl_hpx_debug_acc/itlmodule.sl: Unresolved external

For debugging, I tried to load the same library, using shl_load(), from a test program. This works fine! Basically, python and the test program are using the same code for loading libs. (I tried out different flags with the shl_load() call.)

However, no matter what I try, I can't make Python load the library, it always gives me that unsatisfied symbol __shlinit . It does not happen with the test program.

I wonder where this symbol comes from. I suspect that is the code that gets executed as the startup code of the library for the C++ objects to initialize. However, we don't have a function that has the right signature for being given with the +init parameter on the command line, and our code runs fine on NT, AIX and Solaris, and, as I mentioned, the test program can shl_load() the lib.

Python is built using CC. Our code uses CC to compile C files and aCC to compile and link C++ files as well as linking the C files.
I also found out that __shlinit seems to be defined in /usr/lib/libCsup.sl , but linking to this didn't help.

I would appreciate any hint on this because I don't know anything more I could try. I browsed this forum and the docs extensively, but without success.

Thank you very much in advance

Martin
4 REPLIES 4
Steffi Jones_1
Esteemed Contributor

Re: unresolved symbol: __shlinit during shlload()

Hello,

I'm really not the expert in this area, but maybe I can help a bit.
Did you change the way you link ?
Did you install any patches?

Sometimes it makes sense to review the way you have linked.

And, you can't use the ld linker with C++ you must use the compiler .

Take care, Steffi Jones
Stefan Farrelly
Honored Contributor

Re: unresolved symbol: __shlinit during shlload()


__shlinit is an easily found symbol, its in the library in /lib called libCsup
You can easily add this library to your link command or change the order of your linked libraries to include it.

You can check this by doing;

cd /lib
nm libCsup.a | grep shlinit | grep CODE

And it comes up with;
libCsup.a __shlinit | 0|extern|entry |$CODE$


Im from Palmerston North, New Zealand, but somehow ended up in London...

Re: unresolved symbol: __shlinit during shlload()

HOORAY!
IT WORKS!

I recompiled the Python interpreter using aCC instead of cc, like this:

./configure --with-cxx=aCC --without-gcc --without-threads

Shiju, one of your documents gave me the decisive hint; although they were not directly related to my problem, one had the important sentence in it: "When mixing C++ modules with C modules, usually the overall control of the program must be written in C++", so I decided to recompile Python.

Steffi, Shiju and Stefan, thank you so much for your effort! I wasted so much time on this problem, and now it is solved!!

Thanks again,

Martin