How to set sysroot for cross compiling?

Kai Ruottu kai.ruottu@wippies.com
Sat Aug 12 08:57:30 GMT 2023


Kai Ruottu kirjoitti 10.8.2023 klo 14.15:
> unlvsur unlvsur kirjoitti 6.8.2023 klo 23.35:
>>
>> x86_64-ubuntu-linux-gnu-g++ -v
>>
>> Using built-in specs.
>>
>> COLLECT_GCC=x86_64-ubuntu-linux-gnu-g++
>>
>> COLLECT_LTO_WRAPPER=/home/cqwrteur/toolchains/x86_64-pc-linux-gnu/x86_64-ubuntu-linux-gnu/libexec/gcc/x86_64-ubuntu-linux-gnu/14.0.0/lto-wrapper 
>>
>>
>> Target: x86_64-ubuntu-linux-gnu
>>
>> <snip>
>>
>> gcc version 14.0.0 20230802 (experimental) (GCC)
>>
>> Arsen Arsenović via Gcc-help kirjoitti 3.8.2023 klo 13.06:
>>
>> > unlvsur unlvsur <unlvsur@live.com> writes:
>> >
>> >> i do set with multilib list, the problem is that gcc gets very 
>> messed up when
>> >> trying to find where the libs located at build. So the target was 
>> Ubuntu...
>
> Last when I tried this target there weren't the 'x32' libraries, only 
> the 32- and 64-bit ones.
> So maybe it was the time to try a newer Ubuntu target. The "22.04.2" 
> seemed to be suitable
> to try.
> As you told, the target headers and libraries seemed to be a big mess 
> when looking in which
> packages they were delivered. The "Desktop" release ISO-package seemed 
> to provide only a
> subset and one needed to look at the "pool/main" archives. The Ubuntu 
> mirror in Finland had
> even this somehow "stripped" because I got this error when trying 
> gcc-11.4.0 for
> the 'x86_64-ubuntu-linux22.04' target :
>
> In file included from 
> /opt/host-x86_64-ubuntu-linux22.04/usr/include/bits/errno.h:26,
>                  from 
> /opt/host-x86_64-ubuntu-linux22.04/usr/include/errno.h:28,
>                  from ../../../../libgcc/../gcc/tsystem.h:93,
>                  from ../../../../libgcc/libgcc2.c:27:
> /opt/host-x86_64-ubuntu-linux22.04/usr/include/linux/errno.h:1:10: 
> fatal error: asm/errno.h: No such file or directory
>     1 | #include <asm/errno.h>
>       |          ^~~~~~~~~~~~~
> compilation terminated.
>
> The 'kernel headers' were from the two 
> 'linux-libc-dev_5.15.0-78.85_*.deb' packages but something
> was missing for the '-mx32' case. Earlier there were a faulty symlink 
> to '/lib/ld-linux.so.2' or what the
> 32-bit one is. Of course this shouldn't be to the absolute '/lib' but 
> to the relative '../lib'. And all the
> 32-bit headers were missing, the desktop-image providing only a 
> 'linux-libc-dev_5.15.0-60.66_amd64.deb'
> package for which the 'linux-libc-dev_5.15.0-60.66_i386.deb' 
> equivalent wasn't found. Therefore using
> the '78.85' packages. Let's see whether the found 
> 'linux-headers-5.15.0-78-generic_5.15.0-78.85_amd64.deb'
> has all the required headers...
>
This problem seemed being seen earlier by others. And the solution being 
one kind of "hack" :
"Try installing |gcc-multilib|
@doug that's *the* solution. Funnily enough, all this package contains 
is a symlink||
|/usr/include/asm -> x86_64-linux-gnu/asm|.
If you post this as an answer, I'll accept it."
https://askubuntu.com/questions/959279/what-package-provides-asm-errno-h-for-x32-abi

The options used to configure the original Ubuntu 22.04 GCC which I 
partly copied without
first reasearching what they will do caused more errors during the 
build. Like the missing
'include/crypt.h' when the provided target libs didn't have zlib.


More information about the Gcc-help mailing list