<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>சுதர்சன் சாந்தியப்பன் &#187; libgcc</title>
	<atom:link href="http://sudarsun.in/blog/tag/libgcc/feed/" rel="self" type="application/rss+xml" />
	<link>http://sudarsun.in/blog</link>
	<description>Dream of the Impossible™</description>
	<lastBuildDate>Sun, 05 Feb 2012 12:03:07 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Compile 32bit C/C++ Application in 64bit Linux</title>
		<link>http://sudarsun.in/blog/2009/10/compile-32bit-cc-application-in-64bit-linux/</link>
		<comments>http://sudarsun.in/blog/2009/10/compile-32bit-cc-application-in-64bit-linux/#comments</comments>
		<pubDate>Thu, 08 Oct 2009 12:59:19 +0000</pubDate>
		<dc:creator>sudarsun</dc:creator>
				<category><![CDATA[Hacks]]></category>
		<category><![CDATA[KnowHow]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[-m32]]></category>
		<category><![CDATA[-m64]]></category>
		<category><![CDATA[32bit]]></category>
		<category><![CDATA[64bit]]></category>
		<category><![CDATA[c++]]></category>
		<category><![CDATA[cross-compilation]]></category>
		<category><![CDATA[glibc]]></category>
		<category><![CDATA[libgcc]]></category>
		<category><![CDATA[libstdc++]]></category>
		<category><![CDATA[x64]]></category>
		<category><![CDATA[x86]]></category>

		<guid isPermaLink="false">http://sudarsun.in/blog/2009/10/compile-32bit-cc-application-in-64bit-linux/</guid>
		<description><![CDATA[To build (cross compilation) 32 bit C/C++ applications on 64 bit linux box, use &#8220;-m32&#8243; as a compiler argument.&#160; You would need the following 32bit libraries in place. Install glibc.i386, glibc-devel.i386 Install libgcc.i386 Install libstdc++.i386 #include &#60;cstdio&#62;#include &#60;iostream&#62;main(){&#160;&#160;&#160; std::cout &#60;&#60; &#8220;C++&#8221; &#60;&#60; std::endl;&#160;&#160;&#160; printf ( &#8220;long: %d\n&#8221;, sizeof(long) );&#160;&#160;&#160; printf ( &#8220;long long: %d\n&#8221;, sizeof(long [...]]]></description>
			<content:encoded><![CDATA[<p>To build (cross compilation) 32 bit C/C++ applications on 64 bit linux box, use &#8220;-m32&#8243; as a compiler argument.&nbsp; You would need the following 32bit libraries in place.
<ol>
<li>Install <b>glibc.i386</b>, <b>glibc-devel.i386</b></li>
<li>Install <b>libgcc.i386</b></li>
<li>Install <b>libstdc++.i386</b></li>
</ol>
<blockquote><p><font face="Courier New">#include &lt;cstdio&gt;<br />#include &lt;iostream&gt;<br />main()<br />{<br />&nbsp;&nbsp;&nbsp; std::cout &lt;&lt; &#8220;C++&#8221; &lt;&lt; std::endl;<br />&nbsp;&nbsp;&nbsp; printf ( &#8220;long: %d\n&#8221;, sizeof(long) );<br />&nbsp;&nbsp;&nbsp; printf ( &#8220;long long: %d\n&#8221;, sizeof(long long) );<br />&nbsp;&nbsp;&nbsp; return 0;<br />}</font></p></blockquote>
<blockquote><p><b>To compile in native 64bit:</b><br /><font color="#000066">[sudar@tstsrv12 tmp]</font>$ g++ <font color="#990000"><b>-m64</b></font> -o out64 code.cpp</p></blockquote>
<blockquote><p><font color="#000066">[sudar@tstsrv12 tmp]</font>$ ./out64<br />C++<br />long: 8<br />long long: 8</p></blockquote>
<blockquote><p><font color="#000066">[sudar@tstsrv12 tmp]</font>$ ldd out64<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; linux-vdso.so.1 =&gt;&nbsp; (0x00007fffc43fe000)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; libstdc++.so.6 =&gt; /usr/lib64/libstdc++.so.6 (0x0000003e7be00000)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; libm.so.6 =&gt; /lib64/libm.so.6 (0&#215;0000000000601000)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; libgcc_s.so.1 =&gt; /lib64/libgcc_s.so.1 (0x0000003e79e00000)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; libc.so.6 =&gt; /lib64/libc.so.6 (0&#215;0000000000886000)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /lib64/ld-linux-x86-64.so.2 (0&#215;0000000000110000)</p></blockquote>
<p>
<blockquote><b>To compile in 32bit:</b><br /><font color="#000066">[sudar@tstsrv12 tmp]</font>$ g++ <font color="#990000"><b>-m32</b></font> -o out32 code.cpp</p></blockquote>
<p>
<blockquote><font color="#000066">[sudar@tstsrv12 tmp]</font>$ ./out32<br />C++<br />long: 4<br />long long: 8</p></blockquote>
<p>
<blockquote><font color="#000066">[sudar@tstsrv12 tmp]</font>$ ldd out32<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; linux-gate.so.1 =&gt;&nbsp; (0&#215;00130000)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; libstdc++.so.6 =&gt; /usr/lib/libstdc++.so.6 (0&#215;00133000)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; libm.so.6 =&gt; /lib/libm.so.6 (0&#215;00223000)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; libgcc_s.so.1 =&gt; /lib/libgcc_s.so.1 (0x0024c000)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; libc.so.6 =&gt; /lib/libc.so.6 (0x0025a000)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /lib/ld-linux.so.2 (0&#215;00110000)</p>
</blockquote>
<div class="zemanta-pixie"><img class="zemanta-pixie-img" alt="" src="http://img.zemanta.com/pixy.gif?x-id=396b62b8-86bd-8f41-b78b-d1bc6fa538b1" /></div>
]]></content:encoded>
			<wfw:commentRss>http://sudarsun.in/blog/2009/10/compile-32bit-cc-application-in-64bit-linux/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
<!-- This Quick Cache file was built for (  sudarsun.in/blog/tag/libgcc/feed/ ) in 0.28555 seconds, on Feb 7th, 2012 at 5:18 pm UTC. -->
<!-- This Quick Cache file will automatically expire ( and be re-built automatically ) on Feb 7th, 2012 at 6:18 pm UTC -->
