This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
to build an so containing libgcc.so and libstdc++.so
- From: "Ashay Shende" <ashende at cisco dot com>
- To: <gcc-help at gcc dot gnu dot org>
- Date: Fri, 29 Aug 2003 16:44:14 +0530
- Subject: to build an so containing libgcc.so and libstdc++.so
- Reply-to: <ashende at cisco dot com>
Hi,
I am building an application where the final executable has dependencies on
the libgcc_s.so.1 and libstdc++.so.5 files(apart from another application
shared object)
However, these two so files are not there on the target m/c.
What I want to do is build a shared object(libtest2.so:see below) which
contains the above mentioned shared objects so that the final executable
(testfinal2.out:see below) does not have dependencies on libgcc_s.so.1 and
libstdc++.so.5 files and resulatantly these two .so files need not be
present at run-time.
(I am quite new to all this)
Here's what I did:
(I have libgcc_s.so.1 and libstdc++.so.5 in my directory and I am taking it
from there and not from usr/local/lib)
1.I created libtest2.so(from test.o) by the following command:
g++3 -shared -fPIC -h libtest2.so -o ./libtest2.so -L.
./test.o -lstdc++ -lgcc_s
2. I created testfinal2.out as follows:
g++3 -o testfinal2.out -I. -L. -Xlinker -R. -ltest2 main.cpp
The dependencies are as follows:
$ ldd testfinal2.out
libtest2.so => ./libtest2.so
libstdc++.so.5 => ./libstdc++.so.5
libm.so.1 => /usr/lib/libm.so.1
libgcc_s.so.1 => ./libgcc_s.so.1
libc.so.1 => /usr/lib/libc.so.1
libdl.so.1 => /usr/lib/libdl.so.1
/usr/platform/SUNW,Sun-Fire/lib/libc_psr.so.1
$ ldd libtest2.so
libstdc++.so.5 => (file not found)
libgcc_s.so.1 => (file not found)
libm.so.1 => /usr/lib/libm.so.1
libc.so.1 => /usr/lib/libc.so.1
libdl.so.1 => /usr/lib/libdl.so.1
/usr/platform/SUNW,Sun-Fire/lib/libc_psr.so.1
As you can see, testfinal2.out still has dependencies on libgcc and
libstdc++ .so files.
where am I going wrong ??
Can someone tell me in detail how to build libtest2.so to include
libgcc_s.so.1 and libstdc++.so.5 so that these two files need not be present
at run-time ?
Thanks,
ashay