Re: Run time can't find libstdc++.so (2130 Views)
Reply
Advisor
John Dorak
Posts: 22
Registered: ‎08-08-2007
Message 1 of 13 (2,137 Views)
Accepted Solution

Run time can't find libstdc++.so

Our application runs HP-UX on Itanium. One of the libs I work on links with libstdc++.so and during run time we get the error: Unable to find library libstdc++.so. Is this something we have to distribute with our application?
The build and test systems are both running: HP-UX B.11.23 U

Thanks,
JJD
Honored Contributor
TY 007
Posts: 377
Registered: ‎08-06-2007
Message 2 of 13 (2,137 Views)

Re: Run time can't find libstdc++.so

Hello JJD,

Assume Application libstdc++.so.* location is:
/opt//lib/libstdc++.so.3

Issue command:
# cd /usr/lib/hpux32
# ln -s /opt//lib/libstdc++.so.3 libstdc++.so

Thanks
Acclaimed Contributor
Dennis Handly
Posts: 25,206
Registered: ‎03-06-2006
Message 3 of 13 (2,137 Views)

Re: Run time can't find libstdc++.so

>Is this something we have to distribute with our application?

Exactly. This foreign devil lib doesn't come with the system.

>TY 007: # ln -s /opt//lib/libstdc++.so.3 libstdc++.so

While you could do this, it is probably better to include the path to /opt//lib in the executable. That way there is less things to change on the end user's system.
Advisor
John Dorak
Posts: 22
Registered: ‎08-08-2007
Message 4 of 13 (2,137 Views)

Re: Run time can't find libstdc++.so

Thanks for the replies, we will be including this module in with our application libraries.

Another question, if I may.
Is there a way to flush out these run time link issues during build time?

Thanks,
JJD
Advisor
John Dorak
Posts: 22
Registered: ‎08-08-2007
Message 5 of 13 (2,137 Views)

Re: Run time can't find libstdc++.so

This is a follow-up on my previous posting.

I am also getting some Unsatisfied data symbol errors during run time. Is there a way to flush these out during link time?

Thanks again,
JJD
Acclaimed Contributor
Dennis Handly
Posts: 25,206
Registered: ‎03-06-2006
Message 6 of 13 (2,137 Views)

Re: Run time can't find libstdc++.so

>Is there a way to flush out these run time link issues during build time?

If you link with the -Wl,+b,path option to give the runtime path and you install there, you can at least make sure it runs. I'm not sure this is build time as you wanted?

>I am also getting some Unsatisfied data symbol errors during run time. Is there a way to flush these out during link time?

If you link with -Wl,-Bimmediate, you'll get these runtime unsats. Of course you'll need to install and run the application. And you then need to use "chatr -B deferred" to put put it back.

The linker does have the -Wl,+vshlibunsats option to print out shlib unsats.
Advisor
John Dorak
Posts: 22
Registered: ‎08-08-2007
Message 7 of 13 (2,137 Views)

Re: Run time can't find libstdc++.so

Thanks again Dennis, this worked great. Now on to the next step, is there any documentation on what symbols are in what libs? Here's a sample of what I'm seeing:

ld: (Warning) Unsatisfied symbol "std::__rw_std_streams" in file CC_PropertySet.o
ld: (Warning) Unsatisfied symbol "_Unwind_SetIP" in file /usr/local/lib/hpux64/libstdc++.so
ld: (Warning) Unsatisfied symbol "_Unwind_SetGR" in file /usr/local/lib/hpux64/libstdc++.so
ld: (Warning) Unsatisfied symbol "_Unwind_GetIP" in file /usr/local/lib/hpux64/libstdc++.so
ld: (Warning) Unsatisfied symbol "_Unwind_GetGR" in file /usr/local/lib/hpux64/libstdc++.so
ld: (Warning) Unsatisfied symbol "std::basic_ostream >::_C_opfx()" in file CC_PropertySet.o
ld: (Warning) Unsatisfied symbol "__udivdi3" in file /usr/local/lib/hpux64/libstdc++.so
ld: (Warning) Unsatisfied symbol "__divdi3" in file /usr/local/lib/hpux64/libstdc++.so
ld: (Warning) Unsatisfied symbol "_Unwind_RaiseException" in file /usr/local/lib/hpux64/libstdc++.so
ld: (Warning) Unsatisfied symbol "_Unwind_GetRegionStart" in file /usr/local/lib/hpux64/libstdc++.so
ld: (Warning) Unsatisfied symbol "std::ios_base::_C_sync_with_stdio" in file CC_PropertySet.o
ld: (Warning) Unsatisfied symbol "std::ios_base::_C_unsafe_clear(int,int)" in file CC_PropertySet.o
ld: (Warning) Unsatisfied symbol "std::basic_istream >::_C_unsafe_get(long*,int,int)" in file /builds/Prebuilt/HPia64/icu/3.2/lib/libicuio.so
ld: (Warning) Unsatisfied symbol "_end" in file /usr/lib/hpux32/libc.so.1
ld: (Warning) Unsatisfied symbol "std::basic_istream >::_C_ipfx(int)" in file /builds/Prebuilt/HPia64/icu/3.2/lib/libicuio.so
ld: (Warning) Unsatisfied symbol "_Unwind_Resume" in file CC_Accessor.o
ld: (Warning) Unsatisfied symbol "main" in file /usr/lib/hpux32/libc.so.1
ld: (Warning) Unsatisfied symbol "_Unwind_GetLanguageSpecificData" in file /usr/local/lib/hpux64/libstdc++.so
ld: (Warning) Unsatisfied symbol "_Unwind_DeleteException" in file /usr/local/lib/hpux64/libstdc++.so
19 warnings.
Completion of ./cc_common_build.sh build script


Advisor
John Dorak
Posts: 22
Registered: ‎08-08-2007
Message 8 of 13 (2,137 Views)

Re: Run time can't find libstdc++.so

At run time it is not as bad (probably the library path is a bit more complete) but I still get the following and can't trace down the home library for them.

symbol not found: _ZSt16__rw_std_streams (/u1/IBM/InformationServer/ASBNode/lib/cpp/libfcl.so)
symbol not found: _ZNSt8ios_base18_C_sync_with_stdioE (/u1/IBM/InformationServer/ASBNode/lib/cpp/libfcl.so)
symbol not found: _ZTVSt14__rw_exception (/u1/IBM/InformationServer/ASBNode/lib/cpp/libfcl.so)
symbol not found: _ZNSs9__nullrefE (/u1/IBM/InformationServer/ASBNode/lib/cpp/libfcl.so)
symbol not found: _ZTVN4__rw17__rw_thread_errorE (/u1/IBM/InformationServer/ASBNode/lib/cpp/libfcl.so)
symbol not found: _ZTIN4__rw17__rw_thread_errorE (/u1/IBM/InformationServer/ASBNode/lib/cpp/libfcl.so)
symbol not found: _ZNSt6locale9_C_globalE (/u1/IBM/InformationServer/ASBNode/lib/cpp/libfcl.so)
symbol not found: _ZSt16__rw_std_streams (/u1/IBM/InformationServer/Server/DSComponents/lib/libicuio.so.32)
symbol not found: _ZNSt8ios_base18_C_sync_with_stdioE (/u1/IBM/InformationServer/Server/DSComponents/lib/libicuio.so.32)
bash-2.03$
Acclaimed Contributor
Dennis Handly
Posts: 25,206
Registered: ‎03-06-2006
Message 9 of 13 (2,137 Views)

Re: Run time can't find libstdc++.so

[ Edited ]

You are appropriately hosed. You are mixing g++ and aC++.

>is there any documentation on what symbols are in what libs?

Why look up documentation when you can scan the libs:
$ nm -pxAN /usr/lib/hpux64/lib* /usr/local/lib/hpux64/lib* | grep -e foo1 -e foo2
(Or use grep -f and put the symbols in a file.)

Were you creating an executable or shlib (with -b)?

ld: (Warning) Unsatisfied symbol "_Unwind_SetIP" in file /usr/local/lib/hpux64/libstdc++.so

This is why I don't use -Wl,+vshlibunsats. This is defined in libunwind. And it shouldn't have been listed. (I assume g++ is smart enough to include -lunwind.)

ld: (Warning) Unsatisfied symbol "__udivdi3" in file /usr/local/lib/hpux64/libstdc++.so

This lib is broken. It was linked incorrectly and should have its own copy of these functions.

ld: (Warning) Unsatisfied symbol "_end" in file libc.so.1
ld: (Warning) Unsatisfied symbol "main"

These are found in your executable.

>At run time it is not as bad (probably the library path is a bit more complete)

No, because +vshlibunsats gives too much info. There is a better tool for PA32, show_remaining_imports:
http://forums.itrc.hp.com/service/forums/questionanswer.do?threadId=1115429
http://forums.itrc.hp.com/service/forums/questionanswer.do?threadId=1151071
But you need show_remaining_imports_elf which I haven't attached yet.

>but I still get the following and can't trace down the home library for them.
symbol not found: _ZSt16__rw_std_streams (/u1/IBM/InformationServer/ASBNode/lib/cpp/libfcl.so)

It should be obvious. ;-) They come from aC++, not your foreign devil g++. The nm(1) fragment above would have told you that.

You must not use libfcl.so and libicuio.so.32 in your g++ application, or you must port everything to aC++. I doubt IBM would port those libs to g++ or C for you.

Advisor
John Dorak
Posts: 22
Registered: ‎08-08-2007
Message 10 of 13 (2,137 Views)

Re: Run time can't find libstdc++.so

Thanks Dennis,
The libfcl.so is the component I'm porting to HP Itanium. This shared lib is ported across a number of OS platforms but this is the first time for this module on HPUX Itanium.

I'm not surprised some g++ got in there, some of the libs we use are from open source projects.

I'll give some of your suggestions a try.

Regards,
JJD
dorak@us.ibm.com
Acclaimed Contributor
Dennis Handly
Posts: 25,206
Registered: ‎03-06-2006
Message 11 of 13 (2,130 Views)

Re: Run time can't find libstdc++.so

>I'm not surprised some g++ got in there, some of the libs we use are from open source projects.

It seems like you are saying this backward. The title of your thread says "I'm using g++, not aC++". Unless you mistakenly added -lstdc++?
Advisor
John Dorak
Posts: 22
Registered: ‎08-08-2007
Message 12 of 13 (2,130 Views)

Re: Run time can't find libstdc++.so

I think I may have mislead you. I am building using aCC. That's what threw me when the dependencies started calling out libstdc++.

Here's my current link cmd line:

aCC +DD64 -b -o libfcl.so\
CC_Accessor.o . . . CC_Threads.o fcl.o -L/builds/Prebuilt/HPia64/icu/3.2/lib -L/builds/Prebuilt/HPia64/xml4c5_6_3-hpia64/lib -L/opt/aCC/lib -lxml4c -licuuc -licui18n -licutu -licuio -lCsup -lstd -lstream -lc -ldld -lcl

Regards,
JJD
Acclaimed Contributor
Dennis Handly
Posts: 25,206
Registered: ‎03-06-2006
Message 13 of 13 (2,130 Views)

Re: Run time can't find libstdc++.so

[ Edited ]

>That's what threw me when the dependencies started calling out libstdc++.

You'll have to rebuild them.

>Here's my current link cmd line:
aCC +DD64 -b -o libfcl.so -L/opt/aCC/lib

There are no IPF libs here remove it.

-lCsup -lstd -lstream -lc -ldld -lcl

This is completely broken. You have the -AP libs and they are in the wrong order. The correct link order is:
http://docs.hp.com/en/10946/distributing.htm#linking

Or -lstd_v2 -lCsup -lunwind -lm
You can leave off -lm if not needed.

NEVER EVER link with -lc.
And on IPF, -lcl should be -lunwind.

The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the Terms of Use and Rules of Participation.