How to compile coreutils / binutils for aarch64 in x64

Dockcross

git clone https://github.com/dockcross/dockcross.git
cd dockcross
docker run --rm dockcross/linux-arm64> ./dockcross-linux-arm64
chmod +x ./dockcross-linux-arm64
mv ./dockcross-linux-arm64 ~/bin/

Coreutils / Binutils

//Go to the repository diretory
dockcross-linux-arm64 bash

//In the docker work diretory
./bootstrap(only for coreutils)
mkdir aarch64
cd aarch64
../configure
make

make check(run official test)



https://sourceware.org/gdb/wiki/BuildingNatively#:~:text=Your%20distribution%20may%20install%20debuginfo,dir=/usr/lib/debug

Building GDB Natively

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 ./configure && make, but you might actually want to disable a few projects that don’t need to be built (and that take a long time to build).

The first thing you will have to do is to clone the GDB repository. See this page for instructions on how to do that.

The command line to build GDB today, assuming you’re not inside the source tree (which is named binutils-gdb/ in this example), is:

../binutils-gdb/configure –disable-binutils –disable-ld –disable-gold –disable-gas –disable-sim –disable-gprof –disable-gprofng

If you don’t need translations, you can also add –disable-intl.

In-tree builds don’t currently work (and haven’t worked for some time now), so you will need to build out-of-tree.

Build flags

GDB is now a C++ program, so you need to provide the build flags using the CXXFLAGS environment variable:

../binutils-gdb/configure –disable-binutils –disable-ld –disable-gold –disable-gas –disable-sim –disable-gprof CXXFLAGS=’-g3 -O0′ CFLAGS=’-g3 -O0′

Making GDB use the debuginfo files from your distro

Your distribution may install debuginfo files for GDB to use, so it’s a good idea to tell GDB to use them by default. You can do that by specifying the –with-separate-debug-dir option to the configure script, like:

../binutils-gdb/configure –disable-binutils –disable-ld –disable-gold –disable-gas –disable-sim –disable-gprof –with-separate-debug-dir=/usr/lib/debug

If you forgot to specify this flag during the build, you can still pass it to GDB by using the set debug-file-directory command.

Leave a Reply

Your email address will not be published. Required fields are marked *