Operating System - HP-UX
1833800 Members
2675 Online
110063 Solutions
New Discussion

Cannot execute a binary produced by g++ across hpux systems

 
SOLVED
Go to solution
Fay_1
Contributor

Cannot execute a binary produced by g++ across hpux systems

Hello,
I install binutil and gcc in a HPUX 10.20 system. I finally got that system to compile and run a simple program using iostream and other STL library like list and map. But I tried to run the executable on another HPUX system that does not have the g++ package installed, I have the following error:

/usr/lib/dld.sl: Can't open shared library: /opt/gcc/lib/gcc-lib/hppa1.1-hp-hpux
10.20/3.0.1/../../../libstdc++.sl.3
/usr/lib/dld.sl: No such file or directory
Abort(coredump)

Does this mean I have to installed the gcc package in every hpux system that I need to run that binary? Is there a way to include the library into the binary instead of needing the linker to find that shared library?
Thanks for your help.
2 REPLIES 2
A. Clay Stephenson
Acclaimed Contributor
Solution

Re: Cannot execute a binary produced by g++ across hpux systems

Hi:

If you want to avoid this problem, you need to statically link your executables so that you link using the '.a' libraries rather than the '.sl' libraries. If you statically link, the executables will be bigger but everything they need to run will be self-contained. Your linker documentation should direct you to the right options.

If it ain't broke, I can fix that.
Steven Gillard_2
Honored Contributor

Re: Cannot execute a binary produced by g++ across hpux systems

Try compiling / linking with the -static flag, this will prevent shared libraries from being used.

If that doesn't work, try -Wl,-a,archive

Regards,
Steve