[Help] Options to cross compile gcc14

Kai Ruottu kai.ruottu@wippies.com
Thu Jun 19 06:01:21 GMT 2025


Jose Gomez via Gcc-help kirjoitti 18.6.2025 klo 20.58:
> Thanks for your explanation.
>
>> If build=host=target, this is a "native compiler".
>> You typically configure this by specifying none of --build=, --host=,
>> or --target= .
>> If build=host but not equal to the target, it is a cross-compiler.  You
>> usually configure with just a suitable --target= , and not more.
>
> I tried again setting --host=x86_64-linux-gnu --build=x86_64-linux-gnu 
> --target=arm-linux-gnueabihf --disable-multilib 
> --with-sysroot=/usr/arm-linux-gnueabihf 
> --with-native-system-header-dir=/include and I got the following output:
>
> /usr/bin/arm-linux-gnueabihf-ld: cannot find 
> /usr/arm-linux-gnueabihf/lib/libc.so.6 inside /usr/arm-linux-gnueabihf
> /usr/bin/arm-linux-gnueabihf-ld: cannot find 
> /usr/arm-linux-gnueabihf/lib/libc_nonshared.a inside 
> /usr/arm-linux-gnueabihf
> /usr/bin/arm-linux-gnueabihf-ld: cannot find 
> /usr/arm-linux-gnueabihf/lib/ld-linux-armhf.so.3 inside 
> /usr/arm-linux-gnueabihf
> collect2: error: ld returned 1 exit status
> make[2]: *** [Makefile:1005: libgcc_s.so] Error 1
> make[2]: Leaving directory 
> '/gcc-host/build/armhf/arm-linux-gnueabihf/libgcc'
> make[1]: *** [Makefile:14662: all-target-libgcc] Error 2
> make[1]: Leaving directory '/gcc-host/build/armhf'
> make: *** [Makefile:1062: all] Error 2
>
> The path is in the SEARCH_DIR:
>
> SEARCH_DIR("=/usr/local/lib/arm-linux-gnueabihf"); 
> SEARCH_DIR("=/lib/arm-linux-gnueabihf"); 
> SEARCH_DIR("=/usr/lib/arm-linux-gnueabihf"); 
> SEARCH_DIR("=/usr/local/lib"); SEARCH_DIR("=/lib"); 
> SEARCH_DIR("=/usr/lib"); SEARCH_DIR("=/usr/arm-linux-gnueabihf/lib");
>
> I tried to see if the files are in the directory and they are:
>
> -rwxr-xr-x 1 root root  126500 Jan 15  2023 ld-linux-armhf.so.3
> -rwxr-xr-x 1 root root 1102644 Jan 15  2023 libc.so.6
> -rw-r--r-- 1 root root    8862 Jan 15  2023 libc_nonshared.a
>
> Maybe one of the options is not correct
>
> Jose
>
This looks like some Debian-style arrangement where 
"--with-sysroot=$SYSROOT" is not necessary  - all the $target stuff is 
already in some
absolute place on the host, not "sysrooted" in some user-chosen place 
like "/opt/host-$target" which I myself have use. Furthermore the
glibc install packages use symlinks to absolute addresses, not to 
"../../lib" from the "/usr/lib". I have always fixed these symlinks when 
using
prebuilt glibc packages from Debian distros in a $SYSROOT.


More information about the Gcc-help mailing list