HI All, We have a 32bit Gui application created using C++. We ported the application from Solaris to Linux. Issue we are facing is the size of the library and executable is very large in LINUX compared to Solaris. Red Hat Enterprise Linux 5.4 is the Linux version we using. Please find a sample dynamic library created. We would like to know the following behavior of LINUX is normal or not. Consider we created two files test1.cc and test2.cc. Both having a single line of code. a-2720@N530 /data1/users/a-2720/samp :ls -lrt test1.cc test2.cc -rw-rw-r-- 1 a-2720 mcs 21 May 18 06:16 test1.cc -rw-rw-r-- 1 a-2720 mcs 21 May 18 06:16 test2.cc a-2720@N530 /data1/users/a-2720/samp :cat test1.cc
a-2720@N530 /data1/users/a-2720/samp :cat test2.cc
Thus the files have only only one line inside them I created a Shared library using these files. SOLARISCC -c -library=iostream -g -mt test1.cc CC -c -library=iostream -g -mt test2.cc CC -G -h libtestsolaris.so test1.o test2.o -o libtestsolaris.so -library=iostream a-2720@N530 /data1/users/a-2720/samp :ls -lrt test1.o test2.o libtestsolaris.so -rw-rw-r-- 1 a-2720 mcs 20944 May 18 06:16 test1.o -rw-rw-r-- 1 a-2720 mcs 20944 May 18 06:16 test2.o -rwxrwxr-x 1 a-2720 mcs 7384 May 18 06:16 libtestsolaris.so LINUXCC -m32 -c -library=iostream -g -mt test1.cc CC -m32 -c -library=iostream -g -mt test2.cc CC -m32 -G -h libtestlinux.so test1.o test2.o -o libtestlinux.so -library=iostream /data1/users/adarsh/samp :ls -lrt test1.o test2.o libtestlinux.so -rw-r--r-- 1 adarsh ifo 20220 May 18 06:44 test1.o -rw-r--r-- 1 adarsh ifo 20220 May 18 06:44 test2.o -rwxr-xr-x 1 adarsh ifo 41680 May 18 06:44 libtestlinux.so Here we can see that the Linux shared library are in much bigger size than solaris once. Please note that the source file for these libraries are same. Our application uses thousand of files having these header files and hence a notable difference in size occurs. We would like to know this size difference is a normal behavior of LINUX. System Details/data1/users/adarsh/samp :cat /etc/*-release Red Hat Enterprise Linux Server release 5.4 (Tikanga) /data1/users/adarsh/samp :uname -a Linux N280 2.6.18-164.el5 #1 SMP Tue Aug 18 15:51:48 EDT 2009 x86_64 x86_64 x86_64 GNU/Linux Thanks in advance. Sanush Chacko asked 18 May '11, 23:47 1234567890 Jazz ♦ |
Have you tried using another compiler like g++? g++ has a lot of optimization options, most notably -Os. I haven't created shared libraries yet, so the following might not be correct or the best way to do it, but it might help you:
to
in the test-files. The difference is explained here.
answered 19 May '11, 09:25 Jazz ♦ |