g++ and libstdc++.a

lrtaylor@micron.com lrtaylor@micron.com
Fri Aug 29 16:29:00 GMT 2003


Have you tried telling it explicitly to link statically rather than using the shared library?  Try passing -static as the last argument on your link command line or something like that.  That should cause GCC to try to link in all following (i.e., default) libraries statically.

Thanks,
Lyle Taylor
IS Applications

-----Original Message-----
From: Venkatakrishnan, V [mailto:v.venkatakrishnan@channels.usa.xerox.com]
Sent: Friday, August 29, 2003 12:20 AM
To: 'ashende@cisco.com'
Cc: gcc-help@gcc.gnu.org
Subject: RE: g++ and libstdc++.a

Well I tried copying the libstdc++.a file from my development machine to the
target m/c under /usr/local/lib and that still led to...

0509-150   Dependent module /usr/local/lib/libstdc++.a(libstdc++.so.5)
             could not be loaded.
0509-153   File /usr/local/lib/libstdc++.a is not an archive or
           the file could not be read properly.

this despite the fact that both my dev. and target machine are at 4.3.3.0
oslevel.  I'm not sure why the same .a is not recognized as a proper archive
file.  I did an
ar -t libstdc++.a
and that clearly showed that libstdc++.so.5 is included.

Yeah, u can build libxyz.so to include gcc and stdc++ shared objects, and
theoretically no these two would not have to be present at run-time on the
target machine, that's the reason why we link them explicitly so that the
output shared object is self-contained alongwith gcc/stdc++ objects.  This
brings me back to the fact that explicitly linking stdc++ in my app did not
work, I mean something, somewhere still asks for libstdc++.a in
/usr/local/lib, which beats me :O.


-----Original Message-----
From: Ashay Shende [mailto:ashende@cisco.com]
Sent: Friday, August 29, 2003 11:27 AM
To: Venkatakrishnan, V
Subject: RE: g++ and libstdc++.a


same here :-)

Well, getting back to the issue, one solution (in my case) is to provide the
two .so files(libgcc and libstdc++) along with the other dependencies on the
target m/c. This can solve the problem.

But as a primary solution, I wonder if I can build the application shared
object(libxyz.so) which includes the gcc and stdc++ shared object. But in
the first place , is this possible ? Even if I manage to build the libxyz.so
including libgcc_s.so1 and libstdc++.so.5, wont the output .so file have
dependencies on these 2 files ?? So in other words, these 2 .so files will
have to be present at run-time. Am I not correct ?
So can I do away with these 2 .so files ??


(Am i making sense :-). Actually I am new to all this.)

-----Original Message-----
From: Venkatakrishnan, V
[mailto:v.venkatakrishnan@channels.usa.xerox.com]
Sent: Friday, August 29, 2003 11:08 AM
To: 'ashende@cisco.com'
Subject: RE: g++ and libstdc++.a


good to have another one on board Ashay :)
Hope to hear from the forum soon

Meanwhile back on my box Googling away...

-----Original Message-----
From: Ashay Shende [mailto:ashende@cisco.com]
Sent: Friday, August 29, 2003 11:09 AM
To: gcc-help@gcc.gnu.org
Subject: RE: g++ and libstdc++.a


Hi,
I have a similar problem (mentioned in the mail below)

My final execitable has dependencies on libgcc_s.so.1 and libstdc++.so.5(in
usr/local/lib on developement m/c) apart from a dependency on a shared
object(say libxyz.so) which is produced during the building of the
application. My target m/c does not have libgcc_s.so.1 and libstdc++.so.5
files.
I want to know how I can build libxyz.so including the libgcc_s.so.1 and
libstdc++.so.5 so that the final executable does not have a dependency on
these two files. I have also tried explictly linking libgcc_s.so.1 and
libstdc++.so.5 with my app but this did not remove the dependency.

Could anyone give me some pointers ?

Thanks,

-----Original Message-----
From: gcc-help-owner@gcc.gnu.org [mailto:gcc-help-owner@gcc.gnu.org]On
Behalf Of Venkatakrishnan, V
Sent: Friday, August 29, 2003 10:47 AM
To: gcc-help@gcc.gnu.org
Subject: g++ and libstdc++.a


Hi,
        I've this application on AIX 4.3.3 built using g++.  When I deploy
it on the target machine and run it I get the following error.

exec(): 0509-036 Cannot load program myApp because of the following errors:
          0509-150 Dependent module libstdc++.a(libstdc++.so.5) could not be
loaded.
          0509-022 Cannot load module libstdc++.a(libstdc++.so.5).
        0509-026 System error: A file or directory in the path name does not
exist.

        My development machine has /usr/local/lib/libstdc++.a whereas my
target machine does not.  I'm not really sure why. Is libstdc++.a installed
as part of the gcc binaries installed on AIX (not installed on my target
m/c) or is it part of bos.adt.lib?
        Also, I could remove the dependency on libstdc++.a by compiling my
app using gcc, but that would require a lot of effort in converting the code
to C.  I did try explicitly linking libstdc++.a to my app during linking but
that does not remove the dependency.
        Has any of you faced such a thing?  Need some help here please.



More information about the Gcc-help mailing list