public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* How to set sysroot for cross compiling?
@ 2023-08-02  4:09 unlvsur unlvsur
  2023-08-02 10:19 ` Arsen Arsenović
  0 siblings, 1 reply; 10+ messages in thread
From: unlvsur unlvsur @ 2023-08-02  4:09 UTC (permalink / raw)
  To: gcc-help

[-- Attachment #1: Type: text/plain, Size: 142 bytes --]

I try to do crossback compilation, but how do I set sysroot?

Sent from Mail<https://go.microsoft.com/fwlink/?LinkId=550986> for Windows


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: How to set sysroot for cross compiling?
  2023-08-02  4:09 How to set sysroot for cross compiling? unlvsur unlvsur
@ 2023-08-02 10:19 ` Arsen Arsenović
  2023-08-02 13:55   ` unlvsur unlvsur
  0 siblings, 1 reply; 10+ messages in thread
From: Arsen Arsenović @ 2023-08-02 10:19 UTC (permalink / raw)
  To: unlvsur unlvsur; +Cc: gcc-help

[-- Attachment #1: Type: text/plain, Size: 222 bytes --]


unlvsur unlvsur via Gcc-help <gcc-help@gcc.gnu.org> writes:

> I try to do crossback compilation, but how do I set sysroot?

--with-sysroot=... to configure, see: https://gcc.gnu.org/install/
-- 
Arsen Arsenović

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 251 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: How to set sysroot for cross compiling?
  2023-08-02 10:19 ` Arsen Arsenović
@ 2023-08-02 13:55   ` unlvsur unlvsur
  2023-08-02 13:58     ` Arsen Arsenović
  0 siblings, 1 reply; 10+ messages in thread
From: unlvsur unlvsur @ 2023-08-02 13:55 UTC (permalink / raw)
  To: Arsen Arsenović; +Cc: gcc-help

[-- Attachment #1: Type: text/plain, Size: 623 bytes --]

the problem is that with sysroot does not do anything on how to find multilibs for gcc

Get Outlook for Android<https://aka.ms/AAb9ysg>

________________________________
From: Arsen Arsenović <arsen@aarsen.me>
Sent: Wednesday, August 2, 2023, 06:25
To: unlvsur unlvsur <unlvsur@live.com>
Cc: gcc-help@gcc.gnu.org <gcc-help@gcc.gnu.org>
Subject: Re: How to set sysroot for cross compiling?


unlvsur unlvsur via Gcc-help <gcc-help@gcc.gnu.org> writes:

> I try to do crossback compilation, but how do I set sysroot?

--with-sysroot=... to configure, see: https://gcc.gnu.org/install/
--
Arsen Arsenović


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: How to set sysroot for cross compiling?
  2023-08-02 13:55   ` unlvsur unlvsur
@ 2023-08-02 13:58     ` Arsen Arsenović
  2023-08-02 14:12       ` unlvsur unlvsur
  0 siblings, 1 reply; 10+ messages in thread
From: Arsen Arsenović @ 2023-08-02 13:58 UTC (permalink / raw)
  To: unlvsur unlvsur; +Cc: gcc-help

[-- Attachment #1: Type: text/plain, Size: 441 bytes --]


unlvsur unlvsur <unlvsur@live.com> writes:

> the problem is that with sysroot does not do anything on how to find multilibs for gcc

I'm sorry, I'm not sure I follow.  What problem are you running into and
trying to solve?

Please present more context and, if applicable, logs.

Also see the flags present in the GCC configure specifically:

  ./gcc/configure --help

... namely, --with-multilib-list
-- 
Arsen Arsenović

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 251 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: How to set sysroot for cross compiling?
  2023-08-02 13:58     ` Arsen Arsenović
@ 2023-08-02 14:12       ` unlvsur unlvsur
  2023-08-03 10:06         ` Arsen Arsenović
  0 siblings, 1 reply; 10+ messages in thread
From: unlvsur unlvsur @ 2023-08-02 14:12 UTC (permalink / raw)
  To: Arsen Arsenović; +Cc: gcc-help

[-- Attachment #1: Type: text/plain, Size: 1079 bytes --]

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.

like only trying to find lib64 in $targettriple/$targettriple/lib, lib32 in $targettriple/$targettriple/lib/32, libx32 in $targettriple/$targettriple/lib/x32

It won't find anywhere else for libc

Get Outlook for Android<https://aka.ms/AAb9ysg>

________________________________
From: Arsen Arsenović <arsen@aarsen.me>
Sent: Wednesday, August 2, 2023, 10:03
To: unlvsur unlvsur <unlvsur@live.com>
Cc: gcc-help@gcc.gnu.org <gcc-help@gcc.gnu.org>
Subject: Re: How to set sysroot for cross compiling?


unlvsur unlvsur <unlvsur@live.com> writes:

> the problem is that with sysroot does not do anything on how to find multilibs for gcc

I'm sorry, I'm not sure I follow. What problem are you running into and
trying to solve?

Please present more context and, if applicable, logs.

Also see the flags present in the GCC configure specifically:

./gcc/configure --help

... namely, --with-multilib-list
--
Arsen Arsenović


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: How to set sysroot for cross compiling?
  2023-08-02 14:12       ` unlvsur unlvsur
@ 2023-08-03 10:06         ` Arsen Arsenović
  2023-08-04 19:43           ` Kai Ruottu
  0 siblings, 1 reply; 10+ messages in thread
From: Arsen Arsenović @ 2023-08-03 10:06 UTC (permalink / raw)
  To: unlvsur unlvsur; +Cc: gcc-help

[-- Attachment #1: Type: text/plain, Size: 590 bytes --]


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.
>
> like only trying to find lib64 in $targettriple/$targettriple/lib, lib32 in
> $targettriple/$targettriple/lib/32, libx32 in
> $targettriple/$targettriple/lib/x32
>
> It won't find anywhere else for libc

Please post more information.  This could, perhaps, be binutils
misconfiguration.

It'd be good to see your configuration, gcc -v output, your filesystem
layout, etc.
-- 
Arsen Arsenović

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 251 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: How to set sysroot for cross compiling?
  2023-08-03 10:06         ` Arsen Arsenović
@ 2023-08-04 19:43           ` Kai Ruottu
  2023-08-06 20:35             ` unlvsur unlvsur
  0 siblings, 1 reply; 10+ messages in thread
From: Kai Ruottu @ 2023-08-04 19:43 UTC (permalink / raw)
  To: Arsen Arsenović, unlvsur unlvsur; +Cc: gcc-help

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.
>>
>> like only trying to find lib64 in $targettriple/$targettriple/lib, lib32 in
>> $targettriple/$targettriple/lib/32, libx32 in
>> $targettriple/$targettriple/lib/x32
>>
>> It won't find anywhere else for libc
> Please post more information.  This could, perhaps, be binutils
> misconfiguration.
Sounds sane if one forgot to use the '--with-sysroot=' when configuring 
the GNU binutils for
the target system. Here seemingly 'x86_64-linux-androideabi' when 
mentioning these three
multilib directories.

> It'd be good to see your configuration, gcc -v output, your filesystem
> layout, etc.
I checked if I ever had tried building any '*-linux-androideabi' 
targeted crosstoolchains. This
happened last in 2015 for the 'arm-linux-androideabi' and with the 
latest gcc-4.7, gcc-4.8 and
gcc-4.9 sources being available then. The Android release being "10c" or 
something from where
the target C libraries were used. All builds succeeded as expected.

Maybe I could check now the 'x86_64-linux-androideabi' target with the 
"Android release 21"
or somehow for which I seem to have the 'lib32', 'libx32' and 'lib64' 
subdir stuff for the '/usr' native
install place. Maybe there are newer "NDK"s for Android nowadays. 
Telling for which Android
release one aims to build the toolchain is recommended so someone could 
use the same target
stuff.

Wondering where on earth the '$targettriple/$targettriple/lib' was 
adopted for this job. The
target libraries should be in the "native mirror" places, 
'$sysroot/usr/lib*' and the target headers
in the '$sysroot/usr/include', not in the '$prefix/$targettriple/lib*' 
and '$prefix/$targettriple/include'
which is the default if one doesn't use the '--with-sysroot='. How the 
'$targettriple' became doubled
in the install place?

^ permalink raw reply	[flat|nested] 10+ messages in thread

* RE: How to set sysroot for cross compiling?
  2023-08-04 19:43           ` Kai Ruottu
@ 2023-08-06 20:35             ` unlvsur unlvsur
  2023-08-10 11:15               ` Kai Ruottu
  0 siblings, 1 reply; 10+ messages in thread
From: unlvsur unlvsur @ 2023-08-06 20:35 UTC (permalink / raw)
  To: Kai Ruottu, gcc-help

[-- Attachment #1: Type: text/plain, Size: 3451 bytes --]

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
Configured with: /home/cqwrteur/toolchains_build/gcc/configure --with-gxx-libcxx-include-dir=/home/cqwrteur/toolchains/x86_64-pc-linux-gnu/x86_64-ubuntu-linux-gnu/x86_64-ubuntu-linux-gnu/include/c++/v1 --prefix=/home/cqwrteur/toolchains/x86_64-pc-linux-gnu/x86_64-ubuntu-linux-gnu --build=x86_64-pc-linux-gnu --host=x86_64-pc-linux-gnu --target=x86_64-ubuntu-linux-gnu --disable-nls --disable-werror --enable-languages=c,c++ --enable-multilib --with-multilib-list=m32,m64,mx32 --disable-bootstrap --disable-libstdcxx-verbose --with-libstdcxx-eh-pool-obj-count=0 --disable-sjlj-exceptions --enable-libstdcxx-threads --enable-libstdcxx-backtrace
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 14.0.0 20230802 (experimental) (GCC)

Sent from Mail<https://go.microsoft.com/fwlink/?LinkId=550986> for Windows

From: Kai Ruottu<mailto:kai.ruottu@wippies.com>
Sent: Friday, August 4, 2023 15:43
To: Arsen Arsenović<mailto:arsen@aarsen.me>; unlvsur unlvsur<mailto:unlvsur@live.com>
Cc: gcc-help@gcc.gnu.org<mailto:gcc-help@gcc.gnu.org>
Subject: Re: How to set sysroot for cross compiling?

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.
>>
>> like only trying to find lib64 in $targettriple/$targettriple/lib, lib32 in
>> $targettriple/$targettriple/lib/32, libx32 in
>> $targettriple/$targettriple/lib/x32
>>
>> It won't find anywhere else for libc
> Please post more information.  This could, perhaps, be binutils
> misconfiguration.
Sounds sane if one forgot to use the '--with-sysroot=' when configuring
the GNU binutils for
the target system. Here seemingly 'x86_64-linux-androideabi' when
mentioning these three
multilib directories.

> It'd be good to see your configuration, gcc -v output, your filesystem
> layout, etc.
I checked if I ever had tried building any '*-linux-androideabi'
targeted crosstoolchains. This
happened last in 2015 for the 'arm-linux-androideabi' and with the
latest gcc-4.7, gcc-4.8 and
gcc-4.9 sources being available then. The Android release being "10c" or
something from where
the target C libraries were used. All builds succeeded as expected.

Maybe I could check now the 'x86_64-linux-androideabi' target with the
"Android release 21"
or somehow for which I seem to have the 'lib32', 'libx32' and 'lib64'
subdir stuff for the '/usr' native
install place. Maybe there are newer "NDK"s for Android nowadays.
Telling for which Android
release one aims to build the toolchain is recommended so someone could
use the same target
stuff.

Wondering where on earth the '$targettriple/$targettriple/lib' was
adopted for this job. The
target libraries should be in the "native mirror" places,
'$sysroot/usr/lib*' and the target headers
in the '$sysroot/usr/include', not in the '$prefix/$targettriple/lib*'
and '$prefix/$targettriple/include'
which is the default if one doesn't use the '--with-sysroot='. How the
'$targettriple' became doubled
in the install place?


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: How to set sysroot for cross compiling?
  2023-08-06 20:35             ` unlvsur unlvsur
@ 2023-08-10 11:15               ` Kai Ruottu
  2023-08-12  8:57                 ` Kai Ruottu
  0 siblings, 1 reply; 10+ messages in thread
From: Kai Ruottu @ 2023-08-10 11:15 UTC (permalink / raw)
  To: unlvsur unlvsur, gcc-help

[-- Attachment #1: Type: text/plain, Size: 4064 bytes --]

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.
> >>
> >> like only trying to find lib64 in $targettriple/$targettriple/lib, 
> lib32 in
> >> $targettriple/$targettriple/lib/32, libx32 in
> >> $targettriple/$targettriple/lib/x32
> >>
> >> It won't find anywhere else for libc
> > Please post more information.  This could, perhaps, be binutils
> > misconfiguration.
> Sounds sane if one forgot to use the '--with-sysroot=' when configuring
> the GNU binutils for
> the target system. Here seemingly 'x86_64-linux-androideabi' when
> mentioning these three multilib directories.
>
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 :

/home/src/gcc-11.4.0/build/./gcc/xgcc 
-B/home/src/gcc-11.4.0/build/./gcc/ 
-B/opt/cross/x86_64-ubuntu-linux22.04/bin/ 
-B/opt/cross/x86_64-ubuntu-linux22.04/lib/ -isystem 
/opt/cross/x86_64-ubuntu-linux22.04/include -isystem 
/opt/cross/x86_64-ubuntu-linux22.04/sys-include    -g -O2 -mx32 -O2 -g 
-O2 -DIN_GCC  -DCROSS_DIRECTORY_STRUCTURE  -W -Wall -Wno-narrowing 
-Wwrite-strings -Wcast-qual -Wstrict-prototypes -Wmissing-prototypes 
-Wold-style-definition  -isystem ./include -fpic -mlong-double-80 
-DUSE_ELF_SYMVER -fcf-protection -mshstk -g -DIN_LIBGCC2 
-fbuilding-libgcc -fno-stack-protector  -fpic -mlong-double-80 
-DUSE_ELF_SYMVER -fcf-protection -mshstk -I. -I. -I../../.././gcc 
-I../../../../libgcc -I../../../../libgcc/. -I../../../../libgcc/../gcc 
-I../../../../libgcc/../include -I../../../../libgcc/config/libbid 
-DENABLE_DECIMAL_BID_FORMAT -DHAVE_CC_TLS  -DUSE_TLS -o _muldi3.o -MT 
_muldi3.o -MD -MP -MF _muldi3.dep -DL_muldi3 -c 
../../../../libgcc/libgcc2.c -fvisibility=hidden -DHIDE_EXPORTS
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...

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: How to set sysroot for cross compiling?
  2023-08-10 11:15               ` Kai Ruottu
@ 2023-08-12  8:57                 ` Kai Ruottu
  0 siblings, 0 replies; 10+ messages in thread
From: Kai Ruottu @ 2023-08-12  8:57 UTC (permalink / raw)
  To: unlvsur unlvsur, gcc-help

[-- Attachment #1: Type: text/plain, Size: 3296 bytes --]

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.

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2023-08-12  8:57 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-02  4:09 How to set sysroot for cross compiling? unlvsur unlvsur
2023-08-02 10:19 ` Arsen Arsenović
2023-08-02 13:55   ` unlvsur unlvsur
2023-08-02 13:58     ` Arsen Arsenović
2023-08-02 14:12       ` unlvsur unlvsur
2023-08-03 10:06         ` Arsen Arsenović
2023-08-04 19:43           ` Kai Ruottu
2023-08-06 20:35             ` unlvsur unlvsur
2023-08-10 11:15               ` Kai Ruottu
2023-08-12  8:57                 ` Kai Ruottu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).