{"id":5173,"date":"2014-03-30T19:20:04","date_gmt":"2014-03-30T19:20:04","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/03\/30\/cross-compiling-a-c-application-using-gcc-collection-of-common-programming-errors\/"},"modified":"2014-03-30T19:20:04","modified_gmt":"2014-03-30T19:20:04","slug":"cross-compiling-a-c-application-using-gcc-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2014\/03\/30\/cross-compiling-a-c-application-using-gcc-collection-of-common-programming-errors\/","title":{"rendered":"Cross compiling a C application using GCC-Collection of common programming errors"},"content":{"rendered":"<p>I would like to build an application for i386 architecture but currently I&#8217;m running x86_64 OS and shared libraries which I use to link to generate application binaries are built for i386 architecture. If I run file command on shared libraries I use I get following output<\/p>\n<pre><code>ELF 32-bit LSB shared object, Intel 80386, version 1 (S?Size: 13064788 SV), dynamically linked, not stripped \n<\/code><\/pre>\n<p>But gcc skips this shared library saying it as incompatible one. So I was just wondering is there any option with which I can tell GCC to compile for i386 architecture rather than for my native machine architecture?<\/p>\n<p>Yes I&#8217;ve gone through many cross compilation questions on this forums but I didn&#8217;t fully understand the funda as I&#8217;m new to cross compilation stuffs. Does cross compilation requires me to have a gcc which is built for same architecture as the architecture for which I&#8217;m trying to compile? Is use of tool chains like binutils is mandatory for cross compilation?<\/p>\n<p>I&#8217;m using a simple handwritten make file and not using any tool specific tool chains.<\/p>\n<p>Thanks in Advance<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I would like to build an application for i386 architecture but currently I&#8217;m running x86_64 OS and shared libraries which I use to link to generate application binaries are built for i386 architecture. If I run file command on shared libraries I use I get following output ELF 32-bit LSB shared object, Intel 80386, version [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-5173","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/5173","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=5173"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/5173\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=5173"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=5173"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=5173"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}