This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Custom compile of gcc 9.2.1 toolchain, not relocatable

Hi!

I have made a custom compilation of the gcc 9.2.1 toolchain (https://developer.arm.com/tools-and-software/open-source-software/developer-tools/gnu-toolchain/gnu-a/downloads)

using this manifest : gcc-arm-arm-none-linux-gnueabihf-abe-manifest.txt and following the ABE build guide in the link above.

Everything works as expected, and I get a compiler toolchain out in the end. It is, however, not relocatable! I cannot move the toolchain to another location, as

it seems like the sysroot path in the toolchain is hardcoded. I have wrapped the ABE build in a simple docker image, instead of building it on my own PC, but the sysroot of the resulting toolchain that I extract from the docker image, still points to a fixed path inside the docker container. This means that I cannot run the toolchain, outside the docker container, or move it to any other location for that matter.

Ex:

       arm-none-linux-gnueabihf-gcc -print-sysroot ----------> /build/builds/destdir/x86_64-unknown-linux-gnu/arm-linux-gnueabi/libc

Is there a config option I am missing in the manifest somewhere? The manifest I built from is 100& as-is. I did not edit it. The toolchain supplied on the link above that is prebuilt, is relocatable, as shown by this sysroot:

       arm-none-linux-gnueabihf-gcc -print-sysroot ----------> /my/user/location/environments/arm_8.2.1_cross/compiler/bin/../arm-linux-gnueabi/libc

I can move this compiler around, and the sysroot changes. My own build of the toolchain does not do this.

What gives? :) Any help would be greatly appreciated.

  • One of the causes could be the macro TARGET_SYSTEM_ROOT_RELOCATABLE remaining undefined.

    An internal configuration file, gcc-9.2.0/gcc/configure, checks if a given sysroot lies within certain prefixes. If it does, or if certain prefixes are empty, it emits the predefinition of the macro.

    In the absence of a suitable "--prefix=" option when running gcc-9.2.0/configure, the above checks fail, the predefinition is not emitted, and so the macro remains undefined. This causes the removal of the code responsible for fixing up the path to the sysroot.

    The manifest you linked is labelled by Arm as an example manifest; the one included in their latest .xz release has different content, notably the presence of "--prefix= " option. Note that there's a space after the '=' sign. Providing an empty prefix allows the macro to be predefined.

    In your example manifest, you may want to add the empty prefix option, "--prefix= ", on the gcc-configure commands for the two stages, and see if that helps.