Questions Tagged With solarishttp://linuxexchange.org/tags/solaris/?type=rssquestions tagged <span class="tag">solaris</span>enWed, 18 May 2011 23:47:55 -0400Size of the Library/Executable is high in LINUXhttp://linuxexchange.org/questions/2556/size-of-the-libraryexecutable-is-high-in-linux<p>HI All,</p> <p>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.</p> <p>Red Hat Enterprise Linux 5.4 is the Linux version we using.</p> <p>Please find a sample dynamic library created. We would like to know the following behavior of LINUX is normal or not.</p> <p>Consider we created two files <a href="http://test1.cc">test1.cc</a> and <a href="http://test2.cc">test2.cc</a>. Both having a single line of code.</p> <p>a-2720@N530 /data1/users/a-2720/samp :ls -lrt <a href="http://test1.cc">test1.cc</a> <a href="http://test2.cc">test2.cc</a> -rw-rw-r-- 1 a-2720 mcs 21 May 18 06:16 <a href="http://test1.cc">test1.cc</a> -rw-rw-r-- 1 a-2720 mcs 21 May 18 06:16 <a href="http://test2.cc">test2.cc</a></p> <p>a-2720@N530 /data1/users/a-2720/samp :cat <a href="http://test1.cc">test1.cc</a></p> <pre><code>#include&lt;iostream.h&gt; </code></pre> <p>a-2720@N530 /data1/users/a-2720/samp :cat <a href="http://test2.cc">test2.cc</a></p> <pre><code>#include&lt;iostream.h&gt; </code></pre> <p>Thus the files have only only one line inside them</p> <p>I created a Shared library using these files.</p> <h2>SOLARIS</h2> <p>CC -c -library=iostream -g -mt <a href="http://test1.cc">test1.cc</a></p> <p>CC -c -library=iostream -g -mt <a href="http://test2.cc">test2.cc</a></p> <p>CC -G -h <a href="http://libtestsolaris.so">libtestsolaris.so</a> test1.o test2.o -o <a href="http://libtestsolaris.so">libtestsolaris.so</a> -library=iostream </p> <p>a-2720@N530 /data1/users/a-2720/samp :ls -lrt test1.o test2.o <a href="http://libtestsolaris.so">libtestsolaris.so</a></p> <p>-rw-rw-r-- 1 a-2720 mcs 20944 May 18 06:16 test1.o</p> <p>-rw-rw-r-- 1 a-2720 mcs 20944 May 18 06:16 test2.o</p> <p>-rwxrwxr-x 1 a-2720 mcs 7384 May 18 06:16 <a href="http://libtestsolaris.so">libtestsolaris.so</a></p> <h2>LINUX</h2> <p>CC -m32 -c -library=iostream -g -mt <a href="http://test1.cc">test1.cc</a></p> <p>CC -m32 -c -library=iostream -g -mt <a href="http://test2.cc">test2.cc</a></p> <p>CC -m32 -G -h <a href="http://libtestlinux.so">libtestlinux.so</a> test1.o test2.o -o <a href="http://libtestlinux.so">libtestlinux.so</a> -library=iostream </p> <p>/data1/users/adarsh/samp :ls -lrt test1.o test2.o <a href="http://libtestlinux.so">libtestlinux.so</a></p> <p>-rw-r--r-- 1 adarsh ifo 20220 May 18 06:44 test1.o</p> <p>-rw-r--r-- 1 adarsh ifo 20220 May 18 06:44 test2.o</p> <p>-rwxr-xr-x 1 adarsh ifo 41680 May 18 06:44 <a href="http://libtestlinux.so">libtestlinux.so</a></p> <p>Here we can see that the Linux shared library are in much bigger size than solaris once. Please note that the source file for </p> <p>these libraries are same. Our application uses thousand of files having these header files and hence a notable difference in size occurs.</p> <p>We would like to know this size difference is a normal behavior of LINUX.</p> <h2>System Details</h2> <p>/data1/users/adarsh/samp :cat /etc/*-release Red Hat Enterprise Linux Server release 5.4 (Tikanga)</p> <p>/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</p> <p>Thanks in advance.</p> <p>Sanush Chacko</p>1234567890Wed, 18 May 2011 23:47:55 -0400http://linuxexchange.org/questions/2556/size-of-the-libraryexecutable-is-high-in-linuxsolarisprogrammingc++linux