Alvin Belden
2003-11-10 18:34:36 UTC
I'm trying to link my product's exes against shared libraries that I have
also created. The product/platform details are:
Red Hat Linux Advanced Server release 2.1AS/i686
gcc version 2.96 20000731 (Red Hat Linux 7.2 2.96-118.7.2)
GNU ld version 2.11.90.0.8 (with BFD 2.11.90.0.8)
I'm new to Linux but not to Unix. Our product is successfully deployed under
AIX and Digital Unix. I compile each source file with the following command:
g++ -W -pthread -fpermissive -w -c -fno-strict-prototype -O3
each source file is then inserted into 1 of approx. 20 libraries.
I then link the archive files to produce shared libraries with the following
commands.
g++ -shared -L/usr/lib -Wl,-soname,${curr_lib}.so \
-o ${curr_lib}.so.1.2 \
-Wl,--whole-archive,${curr_lib}.a \
-Wl,--no-whole-archive \
-Wl,-rpath, ./
ln -s ${curr_lib}.so.1.2 ${curr_lib}.so.1
ln -s ${curr_lib}.so.1 ${curr_lib}.so
I don't get any errors.
I then link one of our many exes against the shared libraries created above
as well as other libraries required by our product with the commands below:
g++ ${curr_exe}.o -o ${curr_exe} -Wl,--start-group <list of shared
libraries> -Wl,--end-group \
<additional libraries> -lstdc++-3-libc6.2-2-2.10.0 -lpthread -L<search
directory>
Again, there are no errors. When I run one of the exes it comes up and runs
as usual but a ps -vsz shows that the process has approximately 95 megs of
virtual space. If I run another instance of the exe the virtual size is the
same. The 95 megs is the approximate size of all of our products shared
libries. On the other Unix platforms the virtual size is much lower. It
seems that all our shared libries are being loaded for each instance of an
exe. Over the last several days I have tried a variety of additional
qualifiers in different combinations and orders. If I run ldd on one of our
exes it contains references to each of our shared libries. If I run ldd on
one of the shared libries it references only system shared libries and not o
ther of our shared libries even though there are certainly references
between several of our libries. I've consulted various documents but nothing
seems to help. If I run a normal set of our applications we are quickly out
of page space and the system grinds to a halt.
Any help, thoughts, etc. appreciated.
also created. The product/platform details are:
Red Hat Linux Advanced Server release 2.1AS/i686
gcc version 2.96 20000731 (Red Hat Linux 7.2 2.96-118.7.2)
GNU ld version 2.11.90.0.8 (with BFD 2.11.90.0.8)
I'm new to Linux but not to Unix. Our product is successfully deployed under
AIX and Digital Unix. I compile each source file with the following command:
g++ -W -pthread -fpermissive -w -c -fno-strict-prototype -O3
each source file is then inserted into 1 of approx. 20 libraries.
I then link the archive files to produce shared libraries with the following
commands.
g++ -shared -L/usr/lib -Wl,-soname,${curr_lib}.so \
-o ${curr_lib}.so.1.2 \
-Wl,--whole-archive,${curr_lib}.a \
-Wl,--no-whole-archive \
-Wl,-rpath, ./
ln -s ${curr_lib}.so.1.2 ${curr_lib}.so.1
ln -s ${curr_lib}.so.1 ${curr_lib}.so
I don't get any errors.
I then link one of our many exes against the shared libraries created above
as well as other libraries required by our product with the commands below:
g++ ${curr_exe}.o -o ${curr_exe} -Wl,--start-group <list of shared
libraries> -Wl,--end-group \
<additional libraries> -lstdc++-3-libc6.2-2-2.10.0 -lpthread -L<search
directory>
Again, there are no errors. When I run one of the exes it comes up and runs
as usual but a ps -vsz shows that the process has approximately 95 megs of
virtual space. If I run another instance of the exe the virtual size is the
same. The 95 megs is the approximate size of all of our products shared
libries. On the other Unix platforms the virtual size is much lower. It
seems that all our shared libries are being loaded for each instance of an
exe. Over the last several days I have tried a variety of additional
qualifiers in different combinations and orders. If I run ldd on one of our
exes it contains references to each of our shared libries. If I run ldd on
one of the shared libries it references only system shared libries and not o
ther of our shared libries even though there are certainly references
between several of our libries. I've consulted various documents but nothing
seems to help. If I run a normal set of our applications we are quickly out
of page space and the system grinds to a halt.
Any help, thoughts, etc. appreciated.