* architecture dependent directory of C header
@ 2022-03-26 12:37 Da Shi Cao
2022-03-26 14:50 ` Xi Ruoyao
0 siblings, 1 reply; 6+ messages in thread
From: Da Shi Cao @ 2022-03-26 12:37 UTC (permalink / raw)
To: gcc-help
When compiling a C source using gcc, the following list of directories to search for included header files could be displayed:
/usr/lib/gcc/x86_64-linux-gnu/8/include
/usr/local/include
/usr/lib/gcc/x86_64-linux-gnu/8/include-fixed
/usr/include/x86_64-linux-gnu <--- arch dependent?
/usr/include
I'd like to know how this arch dependent directory (/usr/include/x86_64-linux-gnu) be incorporated into the gcc if a gcc compiler is to be built?
Thanks,
Dashi Cao
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: architecture dependent directory of C header
2022-03-26 12:37 architecture dependent directory of C header Da Shi Cao
@ 2022-03-26 14:50 ` Xi Ruoyao
2022-03-26 23:53 ` Da Shi Cao
0 siblings, 1 reply; 6+ messages in thread
From: Xi Ruoyao @ 2022-03-26 14:50 UTC (permalink / raw)
To: Da Shi Cao, gcc-help
On Sat, 2022-03-26 at 12:37 +0000, Da Shi Cao via Gcc-help wrote:
> When compiling a C source using gcc, the following list of directories
> to search for included header files could be displayed:
> /usr/lib/gcc/x86_64-linux-gnu/8/include
> /usr/local/include
> /usr/lib/gcc/x86_64-linux-gnu/8/include-fixed
> /usr/include/x86_64-linux-gnu <--- arch dependent?
> /usr/include
>
> I'd like to know how this arch dependent directory
> (/usr/include/x86_64-linux-gnu) be incorporated into the gcc if a gcc
> compiler is to be built?
Configure GCC with --enable-multiarch.
--
Xi Ruoyao <xry111@mengyan1223.wang>
School of Aerospace Science and Technology, Xidian University
^ permalink raw reply [flat|nested] 6+ messages in thread
* RE: architecture dependent directory of C header
2022-03-26 14:50 ` Xi Ruoyao
@ 2022-03-26 23:53 ` Da Shi Cao
2022-03-27 9:37 ` Xi Ruoyao
0 siblings, 1 reply; 6+ messages in thread
From: Da Shi Cao @ 2022-03-26 23:53 UTC (permalink / raw)
To: Xi Ruoyao, gcc-help
Hi Ruoyao,
Thanks a lot. I’ll have a try of it.
But this arch dependent including directory is in the default search path of the compiler if aarch64 cross gcc is built on x86_64 without the option “--enable-multiarch”. It is missing when arm cross gcc is built.
Dashi Cao
Sent from Mail<https://go.microsoft.com/fwlink/?LinkId=550986> for Windows
From: Xi Ruoyao<mailto:xry111@mengyan1223.wang>
Sent: Saturday, March 26, 2022 22:50
To: Da Shi Cao<mailto:dscao999@hotmail.com>; gcc-help@gcc.gnu.org<mailto:gcc-help@gcc.gnu.org>
Subject: Re: architecture dependent directory of C header
On Sat, 2022-03-26 at 12:37 +0000, Da Shi Cao via Gcc-help wrote:
> When compiling a C source using gcc, the following list of directories
> to search for included header files could be displayed:
> /usr/lib/gcc/x86_64-linux-gnu/8/include
> /usr/local/include
> /usr/lib/gcc/x86_64-linux-gnu/8/include-fixed
> /usr/include/x86_64-linux-gnu <--- arch dependent?
> /usr/include
>
> I'd like to know how this arch dependent directory
> (/usr/include/x86_64-linux-gnu) be incorporated into the gcc if a gcc
> compiler is to be built?
Configure GCC with --enable-multiarch.
--
Xi Ruoyao <xry111@mengyan1223.wang>
School of Aerospace Science and Technology, Xidian University
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: architecture dependent directory of C header
2022-03-26 23:53 ` Da Shi Cao
@ 2022-03-27 9:37 ` Xi Ruoyao
2022-03-27 15:14 ` Da Shi Cao
0 siblings, 1 reply; 6+ messages in thread
From: Xi Ruoyao @ 2022-03-27 9:37 UTC (permalink / raw)
To: Da Shi Cao, gcc-help
On Sat, 2022-03-26 at 23:53 +0000, Da Shi Cao wrote:
> Hi Ruoyao,
> Thanks a lot. I’ll have a try of it.
> But this arch dependent including directory is in the default search
> path of the compiler if aarch64 cross gcc is built on x86_64 without
> the option “--enable-multiarch”.
Do you mean "$PREFIX/aarch64-linux-gnu/include" or
"$PREFIX/include/aarch64-linux-gnu"?
The previous one is a standard location for a cross compiler. The
latter is not enabled without --enable-multiarch, at least for the
upstream GCC code. Note that if you get a GCC source tarball elsewhere,
it's unlikely you may get an answer here because we have no way to know
how the source code is modified.
--
Xi Ruoyao <xry111@mengyan1223.wang>
School of Aerospace Science and Technology, Xidian University
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: architecture dependent directory of C header
2022-03-27 9:37 ` Xi Ruoyao
@ 2022-03-27 15:14 ` Da Shi Cao
2022-03-28 10:29 ` Xi Ruoyao
0 siblings, 1 reply; 6+ messages in thread
From: Da Shi Cao @ 2022-03-27 15:14 UTC (permalink / raw)
To: Xi Ruoyao, gcc-help
Hi Ruoyao,
I'm trying to build a cross gcc on X86_64, with target armhf. The cross gcc will have /usr/include/arm-linux-gnueabihf, which is already populated, as its header search directory if the gcc is configured with:
--enable-multiarch --with-arch=armv7-a --with-fpu=neon-vfpv4 --with-float=hard
But to build a gcc with target aarch64, only --with-arch=armv8-a is used in the configuration and /usr/include/aarch64-linux-gnueabi will be among the header search directories of the resulting gcc. I'll do this build again to confirm it.
Thank you very much.
Dashi Cao
________________________________________
From: Xi Ruoyao <xry111@mengyan1223.wang>
Sent: Sunday, March 27, 2022 5:37 PM
To: Da Shi Cao; gcc-help@gcc.gnu.org
Subject: Re: architecture dependent directory of C header
On Sat, 2022-03-26 at 23:53 +0000, Da Shi Cao wrote:
> Hi Ruoyao,
> Thanks a lot. I’ll have a try of it.
> But this arch dependent including directory is in the default search
> path of the compiler if aarch64 cross gcc is built on x86_64 without
> the option “--enable-multiarch”.
Do you mean "$PREFIX/aarch64-linux-gnu/include" or
"$PREFIX/include/aarch64-linux-gnu"?
The previous one is a standard location for a cross compiler. The
latter is not enabled without --enable-multiarch, at least for the
upstream GCC code. Note that if you get a GCC source tarball elsewhere,
it's unlikely you may get an answer here because we have no way to know
how the source code is modified.
--
Xi Ruoyao <xry111@mengyan1223.wang>
School of Aerospace Science and Technology, Xidian University
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: architecture dependent directory of C header
2022-03-27 15:14 ` Da Shi Cao
@ 2022-03-28 10:29 ` Xi Ruoyao
0 siblings, 0 replies; 6+ messages in thread
From: Xi Ruoyao @ 2022-03-28 10:29 UTC (permalink / raw)
To: Da Shi Cao, gcc-help
On Sun, 2022-03-27 at 15:14 +0000, Da Shi Cao wrote:
> Hi Ruoyao,
>
> I'm trying to build a cross gcc on X86_64, with target armhf. The
> cross gcc will have /usr/include/arm-linux-gnueabihf, which is already
> populated, as its header search directory if the gcc is configured
> with:
> --enable-multiarch --with-arch=armv7-a --with-fpu=neon-vfpv4 --with-
> float=hard
>
> But to build a gcc with target aarch64, only --with-arch=armv8-a is
> used in the configuration and /usr/include/aarch64-linux-gnueabi will
> be among the header search directories of the resulting gcc. I'll do
> this build again to confirm it.
>
Yes this is the expected behavior.
Note that the "multiarch" directory is normally not used for a cross
compiler. If your cross compiler relies on something in /usr/include,
it looks like you are doing something wrong. Generally a sysroot is
used by a cross compiler to find target headers and libraries.
--
Xi Ruoyao <xry111@mengyan1223.wang>
School of Aerospace Science and Technology, Xidian University
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2022-03-28 10:29 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-26 12:37 architecture dependent directory of C header Da Shi Cao
2022-03-26 14:50 ` Xi Ruoyao
2022-03-26 23:53 ` Da Shi Cao
2022-03-27 9:37 ` Xi Ruoyao
2022-03-27 15:14 ` Da Shi Cao
2022-03-28 10:29 ` Xi Ruoyao
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).