public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* 'posix_spawnp' error in build
@ 2023-12-25 14:41 Prashant
  2023-12-25 16:28 ` Segher Boessenkool
  0 siblings, 1 reply; 7+ messages in thread
From: Prashant @ 2023-12-25 14:41 UTC (permalink / raw)
  To: gcc-help, gcc

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

Hello,

I'm new to the GCC community, who is willing to contribute and expand my
knowledge on compilers. I hope this is the right forum I'm asking for help.

 I'm trying to build the gcc repository. Based on the instructions given on
the SummerOfCode - GCC Wiki (gnu.org)
<https://gcc.gnu.org/wiki/SummerOfCode#Before_you_apply> and GCC for New
Contributors — GCC Contributors Guide 0.1 documentation
(gcc-newbies-guide.readthedocs.io)
<https://gcc-newbies-guide.readthedocs.io/en/latest/>, I have tried the
following commands.

1) git clone git://gcc.gnu.org/git/gcc.git
2) cd gcc & ./contrib/download_prerequisites
3) mkdir objdir & cd objdir
4) ../gcc/configure --prefix=/home/path/to/gcc --enable-languages=c,c++
5) make -j 4

Running the 5th throws the following error:
'xgcc: fatal error: cannot execute ‘cc1plus’: posix_spawnp: No such file or
directory
compilation terminated.'

I have tried to search Google and take help of ChatGPT but even the
guidance didn't resolve my issue.

Following are the solutions that I tried.

Executing the command:

1) 'sudo apt-get install --reinstall build-essential'
2) 'sudo apt-get install --reinstall g++'
3) 'unset GCC_EXEC_PREFIX'

This is based on the following pages:
php - Compile error: "g++: error trying to exec 'cc1plus': execvp: No such
file or directory" - Stack Overflow
<https://stackoverflow.com/questions/8878676/compile-error-g-error-trying-to-exec-cc1plus-execvp-no-such-file-or-dir>

and ChatGPT inputs.

I haven't been able to find a solution for the same. Any guidance/input
will be appreciated.


Thanks

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

* Re: 'posix_spawnp' error in build
  2023-12-25 14:41 'posix_spawnp' error in build Prashant
@ 2023-12-25 16:28 ` Segher Boessenkool
  2023-12-25 16:33   ` Xi Ruoyao
                     ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Segher Boessenkool @ 2023-12-25 16:28 UTC (permalink / raw)
  To: Prashant; +Cc: gcc-help, gcc

Hi!

On Mon, Dec 25, 2023 at 08:11:23PM +0530, Prashant via Gcc-help wrote:
>  I'm trying to build the gcc repository. Based on the instructions given on
> the SummerOfCode - GCC Wiki (gnu.org)
> <https://gcc.gnu.org/wiki/SummerOfCode#Before_you_apply> and GCC for New
> Contributors — GCC Contributors Guide 0.1 documentation
> (gcc-newbies-guide.readthedocs.io)
> <https://gcc-newbies-guide.readthedocs.io/en/latest/>, I have tried the
> following commands.
> 
> 1) git clone git://gcc.gnu.org/git/gcc.git
> 2) cd gcc & ./contrib/download_prerequisites
> 3) mkdir objdir & cd objdir
> 4) ../gcc/configure --prefix=/home/path/to/gcc --enable-languages=c,c++

That is wrong.  Build dir as a subdir of the source dir is not
supported.  It might work in many cases, but that does not mean it is
okay to do.

> Running the 5th throws the following error:
> 'xgcc: fatal error: cannot execute ‘cc1plus’: posix_spawnp: No such file or
> directory
> compilation terminated.'

I don't know if that is one of the weird problems caused by this.  Easy
enough to find out.  First "make distclean", and then "git status".

The error message says that the newly compiled compiler driver ("xgcc",
which will be insbtalled as just "gcc" eventually) cannot execute the
newly compiled actual C++ compiler ("cc1plus"), not from the place it
thinks it put it, anyway.

gl;hf, happy holidays, let us know how it went / what else you find out,


Segher

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

* Re: 'posix_spawnp' error in build
  2023-12-25 16:28 ` Segher Boessenkool
@ 2023-12-25 16:33   ` Xi Ruoyao
  2023-12-25 23:00     ` Segher Boessenkool
  2023-12-25 18:26   ` Prashant
  2023-12-29 22:40   ` Dave Blanchard
  2 siblings, 1 reply; 7+ messages in thread
From: Xi Ruoyao @ 2023-12-25 16:33 UTC (permalink / raw)
  To: Segher Boessenkool, Prashant; +Cc: gcc-help, gcc

On Mon, 2023-12-25 at 10:28 -0600, Segher Boessenkool wrote:
> Hi!
> 
> On Mon, Dec 25, 2023 at 08:11:23PM +0530, Prashant via Gcc-help wrote:
> >  I'm trying to build the gcc repository. Based on the instructions given on
> > the SummerOfCode - GCC Wiki (gnu.org)
> > <https://gcc.gnu.org/wiki/SummerOfCode#Before_you_apply> and GCC for New
> > Contributors — GCC Contributors Guide 0.1 documentation
> > (gcc-newbies-guide.readthedocs.io)
> > <https://gcc-newbies-guide.readthedocs.io/en/latest/>, I have tried the
> > following commands.
> > 
> > 1) git clone git://gcc.gnu.org/git/gcc.git
> > 2) cd gcc & ./contrib/download_prerequisites
> > 3) mkdir objdir & cd objdir
> > 4) ../gcc/configure --prefix=/home/path/to/gcc --enable-languages=c,c++
> 
> That is wrong.  Build dir as a subdir of the source dir is not
> supported.  It might work in many cases, but that does not mean it is
> okay to do.

It *is* supported, per discussion at
https://gcc.gnu.org/pipermail/gcc-patches/2023-November/638760.html.

But then you should use "../configure", not "../gcc/configure".  Running
the configure script of a GCC component (instead of the top-level
configure) directly is completely unsupported.

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

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

* Re: 'posix_spawnp' error in build
  2023-12-25 16:28 ` Segher Boessenkool
  2023-12-25 16:33   ` Xi Ruoyao
@ 2023-12-25 18:26   ` Prashant
  2023-12-29 22:40   ` Dave Blanchard
  2 siblings, 0 replies; 7+ messages in thread
From: Prashant @ 2023-12-25 18:26 UTC (permalink / raw)
  To: Segher Boessenkool; +Cc: gcc-help, gcc

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

On Mon, 25 Dec 2023 at 22:00, Segher Boessenkool <segher@kernel.crashing.org>
wrote:

> Hi!
>
> > That is wrong.  Build dir as a subdir of the source dir is not
> > supported.  It might work in many cases, but that does not mean it is
> > okay to do.
>
> I'm really sorry to miss out this important piece of information. Before
> the execution of step 3, I'm out of the gcc repo. So 'gcc' and 'objdir' are
> in the same level.



>

> I don't know if that is one of the weird problems caused by this.  Easy
> > enough to find out.  First "make distclean", and then "git status".
>
> I don't know if we require it to execute above, specially if it's outside
the actual gcc repo.


> >The error message says that the newly compiled compiler driver ("xgcc",
> > which will be insbtalled as just "gcc" eventually) cannot execute the
> > newly compiled actual C++ compiler ("cc1plus"), not from the place it
> > thinks it put it, anyway.
>
> Any solution for this> Problem still exists.


> > gl;hf, happy holidays, let us know how it went / what else you find out,
>
> Thank you and happy holidays to everyone!
> Segher
>

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

* Re: 'posix_spawnp' error in build
  2023-12-25 16:33   ` Xi Ruoyao
@ 2023-12-25 23:00     ` Segher Boessenkool
  2023-12-26 14:04       ` Prashant
  0 siblings, 1 reply; 7+ messages in thread
From: Segher Boessenkool @ 2023-12-25 23:00 UTC (permalink / raw)
  To: Xi Ruoyao; +Cc: Prashant, gcc-help, gcc

On Tue, Dec 26, 2023 at 12:33:40AM +0800, Xi Ruoyao wrote:
> On Mon, 2023-12-25 at 10:28 -0600, Segher Boessenkool wrote:
> > > 1) git clone git://gcc.gnu.org/git/gcc.git
> > > 2) cd gcc & ./contrib/download_prerequisites
> > > 3) mkdir objdir & cd objdir
> > > 4) ../gcc/configure --prefix=/home/path/to/gcc --enable-languages=c,c++
> > 
> > That is wrong.  Build dir as a subdir of the source dir is not
> > supported.  It might work in many cases, but that does not mean it is
> > okay to do.
> 
> It *is* supported, per discussion at
> https://gcc.gnu.org/pipermail/gcc-patches/2023-November/638760.html.

Huh, okay.  That changed "recently" then, for some elongated timescale
anyway :-)

> But then you should use "../configure", not "../gcc/configure".

Ha!  I didn't even notice that.

> Running
> the configure script of a GCC component (instead of the top-level
> configure) directly is completely unsupported.

Without all the necessary configuration arguments, yeah.  So it is still
easier to just make an actually  separate object dir -- even if only so
you can just blow it away when you want to start over :-)


Segher

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

* Re: 'posix_spawnp' error in build
  2023-12-25 23:00     ` Segher Boessenkool
@ 2023-12-26 14:04       ` Prashant
  0 siblings, 0 replies; 7+ messages in thread
From: Prashant @ 2023-12-26 14:04 UTC (permalink / raw)
  To: Segher Boessenkool; +Cc: Xi Ruoyao, gcc-help, gcc

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

Hello,

Any solution you have in mind?

Thanks,
Prashanth

On Tue, 26 Dec 2023 at 04:32, Segher Boessenkool <segher@kernel.crashing.org>
wrote:

> On Tue, Dec 26, 2023 at 12:33:40AM +0800, Xi Ruoyao wrote:
> > On Mon, 2023-12-25 at 10:28 -0600, Segher Boessenkool wrote:
> > > > 1) git clone git://gcc.gnu.org/git/gcc.git
> > > > 2) cd gcc & ./contrib/download_prerequisites
> > > > 3) mkdir objdir & cd objdir
> > > > 4) ../gcc/configure --prefix=/home/path/to/gcc
> --enable-languages=c,c++
> > >
> > > That is wrong.  Build dir as a subdir of the source dir is not
> > > supported.  It might work in many cases, but that does not mean it is
> > > okay to do.
> >
> > It *is* supported, per discussion at
> > https://gcc.gnu.org/pipermail/gcc-patches/2023-November/638760.html.
>
> Huh, okay.  That changed "recently" then, for some elongated timescale
> anyway :-)
>
> > But then you should use "../configure", not "../gcc/configure".
>
> Ha!  I didn't even notice that.
>
> > Running
> > the configure script of a GCC component (instead of the top-level
> > configure) directly is completely unsupported.
>
> Without all the necessary configuration arguments, yeah.  So it is still
> easier to just make an actually  separate object dir -- even if only so
> you can just blow it away when you want to start over :-)
>
>
> Segher
>

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

* Re: 'posix_spawnp' error in build
  2023-12-25 16:28 ` Segher Boessenkool
  2023-12-25 16:33   ` Xi Ruoyao
  2023-12-25 18:26   ` Prashant
@ 2023-12-29 22:40   ` Dave Blanchard
  2 siblings, 0 replies; 7+ messages in thread
From: Dave Blanchard @ 2023-12-29 22:40 UTC (permalink / raw)
  To: gcc

On Mon, 25 Dec 2023 10:28:14 -0600
Segher Boessenkool <segher@kernel.crashing.org> wrote:

> That is wrong.  Build dir as a subdir of the source dir is not
> supported.  It might work in many cases, but that does not mean it is
> okay to do.

Works perfectly fine on every version of GCC I've used, from 5 to 12, and I've done this countless times in various configurations. 

If there is any kind of problem here, GCC needs to fix its junk build process, instead of being the one package on the planet requiring some absurd out-of-directory build.

> I don't know if that is one of the weird problems caused by this.  Easy
> enough to find out.  First "make distclean", and then "git status".
> 
> The error message says that the newly compiled compiler driver ("xgcc",
> which will be insbtalled as just "gcc" eventually) cannot execute the
> newly compiled actual C++ compiler ("cc1plus"), not from the place it
> thinks it put it, anyway.

It's GNU software, so go figure. 

A mysterious "No such file or directory" error here can also indicate the binary isn't finding the libc loader for some reason, due to bad rpath or some such. Use 'readelf -a' to ensure the C library loader path is correct.

Dave

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

end of thread, other threads:[~2023-12-29 22:37 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-12-25 14:41 'posix_spawnp' error in build Prashant
2023-12-25 16:28 ` Segher Boessenkool
2023-12-25 16:33   ` Xi Ruoyao
2023-12-25 23:00     ` Segher Boessenkool
2023-12-26 14:04       ` Prashant
2023-12-25 18:26   ` Prashant
2023-12-29 22:40   ` Dave Blanchard

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