public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* GCC builds with relative searchpaths instead of absolute
@ 2022-09-21 11:42 Nuno Silva
  2022-09-21 12:49 ` Jonathan Wakely
  2022-09-21 15:31 ` AW: " stefan
  0 siblings, 2 replies; 7+ messages in thread
From: Nuno Silva @ 2022-09-21 11:42 UTC (permalink / raw)
  To: gcc-help

Hello,
This is my first post in this mailing list, so I apologize if I do
anything wrong.

I'm working on a hobby operating system and, as part of making apps
for it, I'm trying to port gcc to it. To be clear: I already have my
cross compiler, I just want to make gcc run inside the OS.

However, gcc doesn't seem to find cc1, and when I look into the
searchdirs it shows relative paths (prepended with ".."), which means
it would never find cc1.
I'm configuring GCC with the following:

configure --host=x86_64-toast --prefix=/usr --target=x86_64-toast
--with-sysroot=/ --with-build-sysroot=<my sysroot dir>
--enable-languages=c,c++ --enable-initfini-array --disable-multilib
--disable-nls --enable-lto --with-system-zlib CFLAGS=-O2 CXXFLAGS=-O2

Then running make all-gcc all-target-libgcc all-target-libcstdc++-v3

Is there some sort of setting I could use to change the searchdirs to absolute?

Thank you very much for your time.

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

* Re: GCC builds with relative searchpaths instead of absolute
  2022-09-21 11:42 GCC builds with relative searchpaths instead of absolute Nuno Silva
@ 2022-09-21 12:49 ` Jonathan Wakely
  2022-09-21 12:56   ` Nuno Silva
  2022-09-21 15:31 ` AW: " stefan
  1 sibling, 1 reply; 7+ messages in thread
From: Jonathan Wakely @ 2022-09-21 12:49 UTC (permalink / raw)
  To: Nuno Silva; +Cc: gcc-help

On Wed, 21 Sept 2022 at 12:43, Nuno Silva via Gcc-help
<gcc-help@gcc.gnu.org> wrote:
>
> Hello,
> This is my first post in this mailing list, so I apologize if I do
> anything wrong.
>
> I'm working on a hobby operating system and, as part of making apps
> for it, I'm trying to port gcc to it. To be clear: I already have my
> cross compiler, I just want to make gcc run inside the OS.
>
> However, gcc doesn't seem to find cc1, and when I look into the
> searchdirs it shows relative paths (prepended with ".."), which means
> it would never find cc1.

Why not?

> I'm configuring GCC with the following:
>
> configure --host=x86_64-toast --prefix=/usr --target=x86_64-toast
> --with-sysroot=/ --with-build-sysroot=<my sysroot dir>
> --enable-languages=c,c++ --enable-initfini-array --disable-multilib
> --disable-nls --enable-lto --with-system-zlib CFLAGS=-O2 CXXFLAGS=-O2
>
> Then running make all-gcc all-target-libgcc all-target-libcstdc++-v3

Did you run make install?
Because that's what installs cc1 and gcc into the right locations so
that the relative paths work.

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

* Re: GCC builds with relative searchpaths instead of absolute
  2022-09-21 12:49 ` Jonathan Wakely
@ 2022-09-21 12:56   ` Nuno Silva
  2022-09-21 13:49     ` Jonathan Wakely
  0 siblings, 1 reply; 7+ messages in thread
From: Nuno Silva @ 2022-09-21 12:56 UTC (permalink / raw)
  To: Jonathan Wakely; +Cc: gcc-help

Hello Jonathan,
Why not:
Possibly I'm missing something on my OS that could be making it not
know where to find it: Right now it's just trying to run cc1 through
execve but doesn't pass a path for cc1, just a plan cc1, which fails
to be found as a result.

Did you run make install?
Yes, that's the next step actually, and cc1 is located in a libexec
path of my sysroot.

On Wed, Sep 21, 2022 at 1:49 PM Jonathan Wakely <jwakely.gcc@gmail.com> wrote:
>
> On Wed, 21 Sept 2022 at 12:43, Nuno Silva via Gcc-help
> <gcc-help@gcc.gnu.org> wrote:
> >
> > Hello,
> > This is my first post in this mailing list, so I apologize if I do
> > anything wrong.
> >
> > I'm working on a hobby operating system and, as part of making apps
> > for it, I'm trying to port gcc to it. To be clear: I already have my
> > cross compiler, I just want to make gcc run inside the OS.
> >
> > However, gcc doesn't seem to find cc1, and when I look into the
> > searchdirs it shows relative paths (prepended with ".."), which means
> > it would never find cc1.
>
> Why not?
>
> > I'm configuring GCC with the following:
> >
> > configure --host=x86_64-toast --prefix=/usr --target=x86_64-toast
> > --with-sysroot=/ --with-build-sysroot=<my sysroot dir>
> > --enable-languages=c,c++ --enable-initfini-array --disable-multilib
> > --disable-nls --enable-lto --with-system-zlib CFLAGS=-O2 CXXFLAGS=-O2
> >
> > Then running make all-gcc all-target-libgcc all-target-libcstdc++-v3
>
> Did you run make install?
> Because that's what installs cc1 and gcc into the right locations so
> that the relative paths work.

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

* Re: GCC builds with relative searchpaths instead of absolute
  2022-09-21 12:56   ` Nuno Silva
@ 2022-09-21 13:49     ` Jonathan Wakely
  2022-09-21 13:53       ` Nuno Silva
  0 siblings, 1 reply; 7+ messages in thread
From: Jonathan Wakely @ 2022-09-21 13:49 UTC (permalink / raw)
  To: Nuno Silva; +Cc: gcc-help

On Wed, 21 Sept 2022 at 13:57, Nuno Silva wrote:
>
> Hello Jonathan,
> Why not:
> Possibly I'm missing something on my OS that could be making it not
> know where to find it: Right now it's just trying to run cc1 through
> execve but doesn't pass a path for cc1, just a plan cc1, which fails
> to be found as a result.

OK, I thought you meant that relative paths would mean it can never be found.

In any case, when I run gcc it uses a complete path to cc1:

execve("/home/jwakely/gcc/13/libexec/gcc/x86_64-pc-linux-gnu/13.0.0/cc1", ...)

That is a native compiler, not a cross compiler, but I get the same
behaviour for my cross-compilers.

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

* Re: GCC builds with relative searchpaths instead of absolute
  2022-09-21 13:49     ` Jonathan Wakely
@ 2022-09-21 13:53       ` Nuno Silva
  0 siblings, 0 replies; 7+ messages in thread
From: Nuno Silva @ 2022-09-21 13:53 UTC (permalink / raw)
  To: Jonathan Wakely; +Cc: gcc-help

I see, then maybe GCC is not finding its base path or something, do
you happen to know where that execve is being called from so I can
investigate the source?

Thank you very much!

On Wed, Sep 21, 2022 at 2:49 PM Jonathan Wakely <jwakely.gcc@gmail.com> wrote:
>
> On Wed, 21 Sept 2022 at 13:57, Nuno Silva wrote:
> >
> > Hello Jonathan,
> > Why not:
> > Possibly I'm missing something on my OS that could be making it not
> > know where to find it: Right now it's just trying to run cc1 through
> > execve but doesn't pass a path for cc1, just a plan cc1, which fails
> > to be found as a result.
>
> OK, I thought you meant that relative paths would mean it can never be found.
>
> In any case, when I run gcc it uses a complete path to cc1:
>
> execve("/home/jwakely/gcc/13/libexec/gcc/x86_64-pc-linux-gnu/13.0.0/cc1", ...)
>
> That is a native compiler, not a cross compiler, but I get the same
> behaviour for my cross-compilers.

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

* AW: GCC builds with relative searchpaths instead of absolute
  2022-09-21 11:42 GCC builds with relative searchpaths instead of absolute Nuno Silva
  2022-09-21 12:49 ` Jonathan Wakely
@ 2022-09-21 15:31 ` stefan
  2022-09-21 15:57   ` Xi Ruoyao
  1 sibling, 1 reply; 7+ messages in thread
From: stefan @ 2022-09-21 15:31 UTC (permalink / raw)
  To: gcc-help

> -----Ursprüngliche Nachricht-----
> Von: Gcc-help <gcc-help-bounces+bebbo=bejy.net@gcc.gnu.org> Im
> Auftrag von Nuno Silva via Gcc-help
> Gesendet: Mittwoch, 21. September 2022 13:43
> An: gcc-help@gcc.gnu.org
> Betreff: GCC builds with relative searchpaths instead of absolute
> 
> Hello,
> This is my first post in this mailing list, so I apologize if I do anything wrong.
> 
> I'm working on a hobby operating system and, as part of making apps for it,
> I'm trying to port gcc to it. To be clear: I already have my cross compiler, I just
> want to make gcc run inside the OS.
> 
> However, gcc doesn't seem to find cc1, and when I look into the searchdirs it
> shows relative paths (prepended with ".."), which means it would never find
> cc1.
> I'm configuring GCC with the following:
> 
> configure --host=x86_64-toast --prefix=/usr --target=x86_64-toast --with-
> sysroot=/ --with-build-sysroot=<my sysroot dir> --enable-languages=c,c++ --
> enable-initfini-array --disable-multilib --disable-nls --enable-lto --with-
> system-zlib CFLAGS=-O2 CXXFLAGS=-O2
> 
> Then running make all-gcc all-target-libgcc all-target-libcstdc++-v3
> 
> Is there some sort of setting I could use to change the searchdirs to
> absolute?
> 
> Thank you very much for your time.

Really:  --prefix=/usr ???

Installing locally built applications with prefix /usr is a really bad idea as the files installed may easily overwrite files installed by package managers.






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

* Re: AW: GCC builds with relative searchpaths instead of absolute
  2022-09-21 15:31 ` AW: " stefan
@ 2022-09-21 15:57   ` Xi Ruoyao
  0 siblings, 0 replies; 7+ messages in thread
From: Xi Ruoyao @ 2022-09-21 15:57 UTC (permalink / raw)
  To: stefan, gcc-help

On Wed, 2022-09-21 at 17:31 +0200, stefan@franke.ms wrote:
> 
> Really:  --prefix=/usr ???
> 
> Installing locally built applications with prefix /usr is a really bad
> idea as the files installed may easily overwrite files installed by
> package managers.

See the context from OP:

   I'm working on a hobby operating system and, as part of making apps
   for it, I'm trying to port gcc to it. To be clear: I already have my
   cross compiler, I just want to make gcc run inside the OS.
   
So there should be no package manager for his new OS.


-- 
Xi Ruoyao <xry111@xry111.site>
School of Aerospace Science and Technology, Xidian University

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

end of thread, other threads:[~2022-09-21 15:57 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-21 11:42 GCC builds with relative searchpaths instead of absolute Nuno Silva
2022-09-21 12:49 ` Jonathan Wakely
2022-09-21 12:56   ` Nuno Silva
2022-09-21 13:49     ` Jonathan Wakely
2022-09-21 13:53       ` Nuno Silva
2022-09-21 15:31 ` AW: " stefan
2022-09-21 15:57   ` 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).