Simple cross build fails out of the box on Fedora

Rot127 rot127@posteo.com
Thu Mar 12 19:50:03 GMT 2026


> A couple of observations, but I'm nowhere near a specialist:

Thanks for looking at it anyways :) > A couple of observations, but I'm 
nowhere near a specialist: Isn't the > trailing /usr wrong here, 
considering the ld output at the bottom?

This doesn't make a difference. With or without it is the same result 
because all libs are under usr/.

> Finally, "simple cross build" also doesn't look quite right. Aiui that 
names the case where you pass --target, but not --host.

Not setting host makes it use the x86_64 compiler. I am a little 
confused about the terminology tbh, since I am used to host="system 
which builds" and target="system being built for". But guess this is a 
flavor decision. The docs are pretty clear though: ``` ./configure 
--help | grep -E "\--(host|target)" --host=HOST cross-compile to build 
programs to run on HOST [BUILD] --target=TARGET configure for building 
compilers for TARGET [HOST] ```

------

If I run it with CFLAGS set it works during ./cofigure but fails later 
in the build.

```
CFLAGS="--sysroot=/usr/s390x-redhat-linux/sys-root/fc42/" ./configure
```

Simply fails due to missing include files:
```
s390x-linux-gnu-gcc -c -DHAVE_CONFIG_H 
--sysroot=/usr/s390x-redhat-linux/sys-root/fc42/      -I. 
-I./../include  -W -Wall -Wwrite-strings -Wc++-compat 
-Wstrict-prototypes -Wshadow=local -pedantic  -D_GNU_SOURCE ./regex.c -o 
regex.o
./regex.c:135:7: warning: conflicting types for built-in function 
‘malloc’; expected ‘void *(long unsigned int)’ 
[-Wbuiltin-declaration-mismatch]
   135 | char *malloc ();
       |       ^~~~~~
./regex.c:56:1: note: ‘malloc’ is declared in header ‘<stdlib.h>’
...
```

Adding those

```
CFLAGS="--sysroot=/usr/s390x-redhat-linux/sys-root/fc42/ 
-I/usr/include"  ./configure ...
```

Fails then with

```
checking for uintptr_t... no
checking for ssize_t... no
checking for pid_t... no
checking for library containing strerror... configure: error: Link tests 
are not allowed after GCC_NO_EXECUTABLES.
make[1]: *** [Makefile:8839: configure-libiberty] Error 1
make[1]: Leaving directory 
'/home/user/repos/rz-framework-cmp/data/binutils-2.46.0'
make: *** [Makefile:1033: all] Error 2
```




More information about the Binutils mailing list