{"id":2049,"date":"2016-12-01T10:47:47","date_gmt":"2016-12-01T15:47:47","guid":{"rendered":"https:\/\/bitpost.com\/news\/?p=2049"},"modified":"2016-12-01T11:34:36","modified_gmt":"2016-12-01T16:34:36","slug":"cross-compiling-is-somewhat-under-my-thumb","status":"publish","type":"post","link":"https:\/\/bitpost.com\/news\/2016\/cross-compiling-is-somewhat-under-my-thumb\/","title":{"rendered":"Cross compiling is somewhat under my thumb"},"content":{"rendered":"<p>Ubuntu has a few cross compile toolchains available, for example:<\/p>\n<pre><code>sudo apt install gcc-arm-linux-gnueabi # for arm chips\r\nsudo apt install gcc-arm-linux-gnueabihf # for arm chips with floating point registers<\/code><\/pre>\n<p>Crosstool-NG is a great help in getting the tougher cross compile toolchains built. I was targeting a specific ARM 926EJ-S chipset, and the vendor had <a class=\"linkification-ext\" title=\"Linkification: https:\/\/bitbucket.org\/bbsmartworx\" href=\"https:\/\/bitbucket.org\/bbsmartworx\">their own toolchain<\/a>.<\/p>\n<p>Trying to cross compile on newer versions of ubuntu was a headache though.  I would get &#8220;FATAL: kernel tool old&#8221; errors from the executable on the target system, and the autotools configure option to limit kernel version (&#8211;enable-kernel=&#8230;) did not fix it.<\/p>\n<p>In the end, I was able to build zlib and openssl and libwebsockets statically, with a Crosstool-NG toolchain on an older ubuntu, but had to deal with <a class=\"linkification-ext\" title=\"Linkification: https:\/\/sourceware.org\/bugzilla\/show_bug.cgi?id=17250\" href=\"https:\/\/sourceware.org\/bugzilla\/show_bug.cgi?id=17250\">this glibc bug<\/a> by explicitly specifying the system lib folder, or getaddrinfo, gethostbyname, and all other NSS based functions just plain old failed (lost some hair to that fine feature &#8211; cmon RMS and Drepper, get along better so your code doesn&#8217;t stink&#8230;):<\/p>\n<pre><code>LD_LIBRARY_PATH=\/lib .\/my_static_app<\/code><\/pre>\n<p>Details as usual on the <a href=\"https:\/\/bitpost.com\/wiki\/Cross_Compiling\">wiki<\/a>.  Onwards.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Ubuntu has a few cross compile toolchains available, for example: sudo apt install gcc-arm-linux-gnueabi # for arm chips sudo apt install gcc-arm-linux-gnueabihf # for arm chips with floating point registers Crosstool-NG is a great help in getting the tougher cross compile toolchains built. I was targeting a specific ARM 926EJ-S chipset, and the vendor had [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"enabled":false},"version":2}},"categories":[258,5,19],"tags":[],"class_list":["post-2049","post","type-post","status-publish","format-standard","hentry","category-c","category-linux-projects","category-opensource"],"aioseo_notices":[],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p9M11L-x3","jetpack_likes_enabled":true,"_links":{"self":[{"href":"https:\/\/bitpost.com\/news\/wp-json\/wp\/v2\/posts\/2049","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/bitpost.com\/news\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/bitpost.com\/news\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/bitpost.com\/news\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/bitpost.com\/news\/wp-json\/wp\/v2\/comments?post=2049"}],"version-history":[{"count":6,"href":"https:\/\/bitpost.com\/news\/wp-json\/wp\/v2\/posts\/2049\/revisions"}],"predecessor-version":[{"id":2056,"href":"https:\/\/bitpost.com\/news\/wp-json\/wp\/v2\/posts\/2049\/revisions\/2056"}],"wp:attachment":[{"href":"https:\/\/bitpost.com\/news\/wp-json\/wp\/v2\/media?parent=2049"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/bitpost.com\/news\/wp-json\/wp\/v2\/categories?post=2049"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/bitpost.com\/news\/wp-json\/wp\/v2\/tags?post=2049"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}