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.
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.
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.
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.
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.
> -----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.
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