{"id":103,"date":"2025-02-23T08:24:53","date_gmt":"2025-02-23T08:24:53","guid":{"rendered":"https:\/\/haco.club\/?p=103"},"modified":"2025-02-27T07:07:23","modified_gmt":"2025-02-27T07:07:23","slug":"how-to-compile-coreutils-binutils-for-aarch64-in-x64","status":"publish","type":"post","link":"https:\/\/haco.club\/?p=103","title":{"rendered":"How to compile coreutils \/ binutils for aarch64 in x64"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\">Dockcross<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>git clone https:\/\/github.com\/dockcross\/dockcross.git\ncd dockcross\ndocker run --rm dockcross\/linux-arm64&gt; .\/dockcross-linux-arm64\nchmod +x .\/dockcross-linux-arm64\nmv .\/dockcross-linux-arm64 ~\/bin\/<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Coreutils \/ Binutils<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>\/\/Go to the repository diretory\ndockcross-linux-arm64 bash\n\n\/\/In the docker work diretory\n.\/bootstrap(only for coreutils)\nmkdir aarch64\ncd aarch64\n..\/configure\nmake\n\nmake check(run official test)<\/code><\/pre>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><\/blockquote>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity is-style-dots\"\/>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity is-style-wide\"\/>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity is-style-dots\"\/>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p><a href=\"https:\/\/sourceware.org\/gdb\/wiki\/BuildingNatively#:~:text=Your%20distribution%20may%20install%20debuginfo,dir=\/usr\/lib\/debug\">https:\/\/sourceware.org\/gdb\/wiki\/BuildingNatively#:~:text=Your%20distribution%20may%20install%20debuginfo,dir=\/usr\/lib\/debug<\/a><\/p>\n<\/blockquote>\n\n\n\n<h1 class=\"wp-block-heading\" id=\"Building_GDB_Natively\">Building GDB Natively<\/h1>\n\n\n\n<p>Ever since the GDB and the binutils repositories were integrated (due to the git migration), it has become a bit more complex to build GDB. Of course, you can still do a simple&nbsp;.\/configure&nbsp;&amp;&amp;&nbsp;make, but you might actually want to disable a few projects that don&#8217;t need to be built (and that take a long time to build).<\/p>\n\n\n\n<p>The first thing you will have to do is to clone the GDB repository. See&nbsp;<a href=\"https:\/\/sourceware.org\/gdb\/current\/\">this page<\/a>&nbsp;for instructions on how to do that.<\/p>\n\n\n\n<p>The command line to build GDB today, assuming you&#8217;re not inside the source tree (which is named&nbsp;binutils-gdb\/&nbsp;in this example), is:<\/p>\n\n\n\n<p>..\/binutils-gdb\/configure&nbsp;&#8211;disable-binutils&nbsp;&#8211;disable-ld&nbsp;&#8211;disable-gold&nbsp;&#8211;disable-gas&nbsp;&#8211;disable-sim&nbsp;&#8211;disable-gprof&nbsp;&#8211;disable-gprofng<\/p>\n\n\n\n<p>If you don&#8217;t need translations, you can also add&nbsp;&#8211;disable-intl.<\/p>\n\n\n\n<p>In-tree builds don&#8217;t currently work (and haven&#8217;t worked for some time now), so you will need to build out-of-tree.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"Build_flags\">Build flags<\/h2>\n\n\n\n<p>GDB is now a C++ program, so you need to provide the build flags using the&nbsp;CXXFLAGS&nbsp;environment variable:<\/p>\n\n\n\n<p>..\/binutils-gdb\/configure&nbsp;&#8211;disable-binutils&nbsp;&#8211;disable-ld&nbsp;&#8211;disable-gold&nbsp;&#8211;disable-gas&nbsp;&#8211;disable-sim&nbsp;&#8211;disable-gprof&nbsp;CXXFLAGS=&#8217;-g3&nbsp;-O0&#8242;&nbsp;CFLAGS=&#8217;-g3&nbsp;-O0&#8242;<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"Making_GDB_use_the_debuginfo_files_from_your_distro\">Making GDB use the debuginfo files from your distro<\/h2>\n\n\n\n<p>Your distribution may install debuginfo files for GDB to use, so it&#8217;s a good idea to tell GDB to use them by default. You can do that by specifying the&nbsp;&#8211;with-separate-debug-dir&nbsp;option to the&nbsp;configure&nbsp;script, like:<\/p>\n\n\n\n<p>..\/binutils-gdb\/configure&nbsp;&#8211;disable-binutils&nbsp;&#8211;disable-ld&nbsp;&#8211;disable-gold&nbsp;&#8211;disable-gas&nbsp;&#8211;disable-sim&nbsp;&#8211;disable-gprof&nbsp;&#8211;with-separate-debug-dir=\/usr\/lib\/debug<\/p>\n\n\n\n<p>If you forgot to specify this flag during the build, you can still pass it to GDB by using the&nbsp;set&nbsp;debug-file-directory&nbsp;command.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Dockcross Coreutils \/ Binutils https:\/\/sourceware.org\/gdb\/wiki\/BuildingNatively#:~:text=Your%20distribution%20may%20install%20debuginfo,dir=\/usr\/lib\/debug Building GDB Natively Ever since [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7],"tags":[13,10],"class_list":["post-103","post","type-post","status-publish","format-standard","hentry","category-tutotial","tag-aarch64","tag-toolchain"],"_links":{"self":[{"href":"https:\/\/haco.club\/index.php?rest_route=\/wp\/v2\/posts\/103","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/haco.club\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/haco.club\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/haco.club\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/haco.club\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=103"}],"version-history":[{"count":2,"href":"https:\/\/haco.club\/index.php?rest_route=\/wp\/v2\/posts\/103\/revisions"}],"predecessor-version":[{"id":110,"href":"https:\/\/haco.club\/index.php?rest_route=\/wp\/v2\/posts\/103\/revisions\/110"}],"wp:attachment":[{"href":"https:\/\/haco.club\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=103"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/haco.club\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=103"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/haco.club\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=103"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}