public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Error when building gcc w/ Go language on Solaris
@ 2022-04-16  5:39 Matthew R. Wilson
  2022-04-16  6:33 ` Jonathan Wakely
  0 siblings, 1 reply; 10+ messages in thread
From: Matthew R. Wilson @ 2022-04-16  5:39 UTC (permalink / raw)
  To: gcc-help

Hello,

I am revisiting my attempts to build GCC with Go language support on
Solaris/SPARCv9.

The error I get when I make is:

/export/home/mwilson/gcc-build/gcc-11.2.0/host-sparcv9-sun-solaris2.11/gcc/gccgo -B/export/home/mwilson/gcc-build/gcc-11.2.0/host-sparcv9-sun-solaris2.11/gcc/ -B/opt/mrwgcc/sparcv9-sun-solaris2.11/bin/ -B/opt/mrwgcc/sparcv9-sun-solaris2.11/lib/ -isystem /opt/mrwgcc/sparcv9-sun-solaris2.11/include -isystem /opt/mrwgcc/sparcv9-sun-solaris2.11/sys-include   -g -O2 -I ../sparcv9-sun-solaris2.11/libgo  -L ../sparcv9-sun-solaris2.11/libgo -L ../sparcv9-sun-solaris2.11/libgo/.libs -o go ../.././gotools/../libgo/go/cmd/go/alldocs.go ../.././gotools/../libgo/go/cmd/go/go11.go ../.././gotools/../libgo/go/cmd/go/main.go ../sparcv9-sun-solaris2.11/libgo/libgotool.a  
../.././gotools/../libgo/go/cmd/go/main.go:10:16: error: /export/home/mwilson/gcc-build/gcc-11.2.0/host-sparcv9-sun-solaris2.11/gcc/context.o exists but does not contain any Go export data

...followed by many errors about import files (starting with 'context')
not found.

This is when trying to build GCC 11.2, but I had the same problem over
many attempts to build GCC 11.1 a while ago.

(I've gotten the same error when I get this far when trying to build on
AIX/ppc64, but we'll just stay focused on Solaris here.)

It must be possible to build gccgo support on this platform, because the
latest Solaris 11.4 update includes it.

With the gcc that is included in Solaris, I can run `gcc -v` and see:

Configured with: /builds2/ulhg/mrcarson-trunk_111/components/gcc11/gcc-11.2.0/configure --prefix=/usr/gcc/11 --mandir=/usr/gcc/11/share/man --bindir=/usr/gcc/11/bin --sbindir=/usr/gcc/11/sbin --libdir=/usr/gcc/11/lib --infodir=/usr/gcc/11/share/info --libexecdir=/usr/gcc/11/lib --enable-languages=ada,c,c++,fortran,go,objc --enable-shared --enable-initfini-array --disable-rpath --with-system-zlib --with-build-config=no --without-gnu-ld --with-ld=/usr/bin/ld --with-gnu-as --with-as=/usr/gnu/bin/as --disable-bootstrap 'BOOT_CFLAGS=-g -O2' sparcv9-sun-solaris2.11

To try to build my own from scratch, I have done the following on
Solaris 11.4.42.111.0:

1) build the latest gnu binutils and installed at prefix /opt/mrwgcc
    (building gcc w/ go seems to *require* objcopy be present)

2) renamed the binutils-provided "ld" to "gnuld" just to make sure it
isn't picked up by anything in preference to the Solaris ld. (The GCC
platform notes for Solaris recommend using the Solaris ld.)

3) Set my PATH to: /opt/mrwgcc:/usr/bin:/usr/sbin

4) configured gcc 11.2 with a similar set of options as the
Solaris-provided gcc:

./configure --prefix=/opt/mrwgcc \
	--enable-languages=c,c++,go  --enable-shared \
	--enable-initfini-array \
	--disable-rpath --with-system-zlib --with-build-config=no \
	--without-gnu-ld --with-ld=/usr/bin/ld \
	--with-gnu-as --with-as=/opt/mrwgcc/bin/as sparcv9-sun-solaris2.11

Despite using what appear to be the same options (in particular, using
the Solaris ld and not binutils ld) as the working gccgo that comes with
Solaris, I can't get my build to work. I hit that "/context.o exists but
does not contain any Go export data" error no matter what I try.

A build with only --enable-languages=c,c++ works fine.

I'm thinking there must be something else about my environment that
differs from the package build environment, but I don't know what the
magic needed to build gccgo is.

If anyone has any suggestions, I'd appreciate them.

Thanks,
Matthew


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

* Re: Error when building gcc w/ Go language on Solaris
  2022-04-16  5:39 Error when building gcc w/ Go language on Solaris Matthew R. Wilson
@ 2022-04-16  6:33 ` Jonathan Wakely
  2022-04-16 19:24   ` Matthew R. Wilson
  0 siblings, 1 reply; 10+ messages in thread
From: Jonathan Wakely @ 2022-04-16  6:33 UTC (permalink / raw)
  To: Matthew R. Wilson; +Cc: gcc-help

On Sat, 16 Apr 2022, 06:40 Matthew R. Wilson, <mwilson@mattwilson.org>
wrote:

> Hello,
>
> I am revisiting my attempts to build GCC with Go language support on
> Solaris/SPARCv9.
>
> The error I get when I make is:
>
> /export/home/mwilson/gcc-build/gcc-11.2.0/host-sparcv9-sun-solaris2.11/gcc/gccgo
> -B/export/home/mwilson/gcc-build/gcc-11.2.0/host-sparcv9-sun-solaris2.11/gcc/
> -B/opt/mrwgcc/sparcv9-sun-solaris2.11/bin/
> -B/opt/mrwgcc/sparcv9-sun-solaris2.11/lib/ -isystem
> /opt/mrwgcc/sparcv9-sun-solaris2.11/include -isystem
> /opt/mrwgcc/sparcv9-sun-solaris2.11/sys-include   -g -O2 -I
> ../sparcv9-sun-solaris2.11/libgo  -L ../sparcv9-sun-solaris2.11/libgo -L
> ../sparcv9-sun-solaris2.11/libgo/.libs -o go
> ../.././gotools/../libgo/go/cmd/go/alldocs.go
> ../.././gotools/../libgo/go/cmd/go/go11.go
> ../.././gotools/../libgo/go/cmd/go/main.go
> ../sparcv9-sun-solaris2.11/libgo/libgotool.a
> ../.././gotools/../libgo/go/cmd/go/main.go:10:16: error:
> /export/home/mwilson/gcc-build/gcc-11.2.0/host-sparcv9-sun-solaris2.11/gcc/context.o
> exists but does not contain any Go export data
>
> ...followed by many errors about import files (starting with 'context')
> not found.
>
> This is when trying to build GCC 11.2, but I had the same problem over
> many attempts to build GCC 11.1 a while ago.
>
> (I've gotten the same error when I get this far when trying to build on
> AIX/ppc64, but we'll just stay focused on Solaris here.)
>
> It must be possible to build gccgo support on this platform, because the
> latest Solaris 11.4 update includes it.
>
> With the gcc that is included in Solaris, I can run `gcc -v` and see:
>
> Configured with:
> /builds2/ulhg/mrcarson-trunk_111/components/gcc11/gcc-11.2.0/configure
> --prefix=/usr/gcc/11 --mandir=/usr/gcc/11/share/man
> --bindir=/usr/gcc/11/bin --sbindir=/usr/gcc/11/sbin
> --libdir=/usr/gcc/11/lib --infodir=/usr/gcc/11/share/info
> --libexecdir=/usr/gcc/11/lib --enable-languages=ada,c,c++,fortran,go,objc
> --enable-shared --enable-initfini-array --disable-rpath --with-system-zlib
> --with-build-config=no --without-gnu-ld --with-ld=/usr/bin/ld --with-gnu-as
> --with-as=/usr/gnu/bin/as --disable-bootstrap 'BOOT_CFLAGS=-g -O2'
> sparcv9-sun-solaris2.11
>
> To try to build my own from scratch, I have done the following on
> Solaris 11.4.42.111.0:
>
> 1) build the latest gnu binutils and installed at prefix /opt/mrwgcc
>     (building gcc w/ go seems to *require* objcopy be present)
>
> 2) renamed the binutils-provided "ld" to "gnuld" just to make sure it
> isn't picked up by anything in preference to the Solaris ld. (The GCC
> platform notes for Solaris recommend using the Solaris ld.)
>
> 3) Set my PATH to: /opt/mrwgcc:/usr/bin:/usr/sbin
>
> 4) configured gcc 11.2 with a similar set of options as the
> Solaris-provided gcc:
>
> ./configure --prefix=/opt/mrwgcc \
>         --enable-languages=c,c++,go  --enable-shared \
>         --enable-initfini-array \
>         --disable-rpath --with-system-zlib --with-build-config=no \
>         --without-gnu-ld --with-ld=/usr/bin/ld \
>         --with-gnu-as --with-as=/opt/mrwgcc/bin/as sparcv9-sun-solaris2.11
>
> Despite using what appear to be the same options (in particular, using
> the Solaris ld and not binutils ld) as the working gccgo that comes with
> Solaris, I can't get my build to work. I hit that "/context.o exists but
> does not contain any Go export data" error no matter what I try.
>
> A build with only --enable-languages=c,c++ works fine.
>
> I'm thinking there must be something else about my environment that
> differs from the package build environment, but I don't know what the
> magic needed to build gccgo is.
>
> If anyone has any suggestions, I'd appreciate them.
>


Just a guess, but maybe the Go build uses sed or another command like that,
and relies on the POSIX-conforming version in /usr/xpg4/bin rather than the
/usr/bin one. Try putting /usr/xpg4/bin in your path, just after
/opt/mrwgcc/bin



>
>

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

* Re: Error when building gcc w/ Go language on Solaris
  2022-04-16  6:33 ` Jonathan Wakely
@ 2022-04-16 19:24   ` Matthew R. Wilson
  2022-04-16 19:41     ` Jonathan Wakely
  0 siblings, 1 reply; 10+ messages in thread
From: Matthew R. Wilson @ 2022-04-16 19:24 UTC (permalink / raw)
  To: Jonathan Wakely; +Cc: gcc-help

On 04.16.2022 07:33, Jonathan Wakely wrote:
>On Sat, 16 Apr 2022, 06:40 Matthew R. Wilson, <mwilson@mattwilson.org>
>wrote:
>
>> I am revisiting my attempts to build GCC with Go language support on
>> Solaris/SPARCv9.
>>
>> The error I get when I make is:
>> ../.././gotools/../libgo/go/cmd/go/main.go:10:16: error:
>> /export/home/mwilson/gcc-build/gcc-11.2.0/host-sparcv9-sun-solaris2.11/gcc/context.o
>> exists but does not contain any Go export data
>>
>> 3) Set my PATH to: /opt/mrwgcc:/usr/bin:/usr/sbin
>>
>> 4) configured gcc 11.2 with a similar set of options as the
>> Solaris-provided gcc:
>>
>> ./configure --prefix=/opt/mrwgcc \
>>         --enable-languages=c,c++,go  --enable-shared \
>>         --enable-initfini-array \
>>         --disable-rpath --with-system-zlib --with-build-config=no \
>>         --without-gnu-ld --with-ld=/usr/bin/ld \
>>         --with-gnu-as --with-as=/opt/mrwgcc/bin/as sparcv9-sun-solaris2.11
>
>Just a guess, but maybe the Go build uses sed or another command like
>that, and relies on the POSIX-conforming version in /usr/xpg4/bin
>rather than the /usr/bin one. Try putting /usr/xpg4/bin in your path,
>just after /opt/mrwgcc/bin

Aha! What a great guess -- that fixed it! Thank you so much!

All the best,
Matthew


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

* Re: Error when building gcc w/ Go language on Solaris
  2022-04-16 19:24   ` Matthew R. Wilson
@ 2022-04-16 19:41     ` Jonathan Wakely
  2022-04-16 19:47       ` Marc Glisse
  2022-04-17  0:38       ` Ian Lance Taylor
  0 siblings, 2 replies; 10+ messages in thread
From: Jonathan Wakely @ 2022-04-16 19:41 UTC (permalink / raw)
  To: Matthew R. Wilson; +Cc: gcc-help

On Sat, 16 Apr 2022, 20:24 Matthew R. Wilson, <mwilson@mattwilson.org>
wrote:

> On 04.16.2022 07:33, Jonathan Wakely wrote:
> >On Sat, 16 Apr 2022, 06:40 Matthew R. Wilson, <mwilson@mattwilson.org>
> >wrote:
> >
> >> I am revisiting my attempts to build GCC with Go language support on
> >> Solaris/SPARCv9.
> >>
> >> The error I get when I make is:
> >> ../.././gotools/../libgo/go/cmd/go/main.go:10:16: error:
> >>
> /export/home/mwilson/gcc-build/gcc-11.2.0/host-sparcv9-sun-solaris2.11/gcc/context.o
> >> exists but does not contain any Go export data
> >>
> >> 3) Set my PATH to: /opt/mrwgcc:/usr/bin:/usr/sbin
> >>
> >> 4) configured gcc 11.2 with a similar set of options as the
> >> Solaris-provided gcc:
> >>
> >> ./configure --prefix=/opt/mrwgcc \
> >>         --enable-languages=c,c++,go  --enable-shared \
> >>         --enable-initfini-array \
> >>         --disable-rpath --with-system-zlib --with-build-config=no \
> >>         --without-gnu-ld --with-ld=/usr/bin/ld \
> >>         --with-gnu-as --with-as=/opt/mrwgcc/bin/as
> sparcv9-sun-solaris2.11
> >
> >Just a guess, but maybe the Go build uses sed or another command like
> >that, and relies on the POSIX-conforming version in /usr/xpg4/bin
> >rather than the /usr/bin one. Try putting /usr/xpg4/bin in your path,
> >just after /opt/mrwgcc/bin
>
> Aha! What a great guess -- that fixed it! Thank you so much!
>

Great! We should document this, if we don't already. And even better would
be if the build failed with a clear error mentioning the need for POSIX sed
(or whichever command it was).

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

* Re: Error when building gcc w/ Go language on Solaris
  2022-04-16 19:41     ` Jonathan Wakely
@ 2022-04-16 19:47       ` Marc Glisse
  2022-04-16 23:17         ` Jonathan Wakely
  2022-04-17  0:38       ` Ian Lance Taylor
  1 sibling, 1 reply; 10+ messages in thread
From: Marc Glisse @ 2022-04-16 19:47 UTC (permalink / raw)
  To: Jonathan Wakely; +Cc: Matthew R. Wilson, gcc-help

On Sat, 16 Apr 2022, Jonathan Wakely via Gcc-help wrote:

>>> Just a guess, but maybe the Go build uses sed or another command like
>>> that, and relies on the POSIX-conforming version in /usr/xpg4/bin
>>> rather than the /usr/bin one. Try putting /usr/xpg4/bin in your path,
>>> just after /opt/mrwgcc/bin
>>
>> Aha! What a great guess -- that fixed it! Thank you so much!
>
> Great! We should document this, if we don't already. And even better would
> be if the build failed with a clear error mentioning the need for POSIX sed
> (or whichever command it was).

https://gcc.gnu.org/install/specific.html#x-x-solaris2 says
"The build process works more smoothly with the legacy Solaris tools so, 
if you have /usr/xpg4/bin in your PATH, we recommend that you place 
/usr/bin before /usr/xpg4/bin for the duration of the build."

So we actually document the opposite...

-- 
Marc Glisse

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

* Re: Error when building gcc w/ Go language on Solaris
  2022-04-16 19:47       ` Marc Glisse
@ 2022-04-16 23:17         ` Jonathan Wakely
  0 siblings, 0 replies; 10+ messages in thread
From: Jonathan Wakely @ 2022-04-16 23:17 UTC (permalink / raw)
  To: gcc-help

On Sat, 16 Apr 2022, 20:47 Marc Glisse, <marc.glisse@inria.fr> wrote:

> On Sat, 16 Apr 2022, Jonathan Wakely via Gcc-help wrote:
>
> >>> Just a guess, but maybe the Go build uses sed or another command like
> >>> that, and relies on the POSIX-conforming version in /usr/xpg4/bin
> >>> rather than the /usr/bin one. Try putting /usr/xpg4/bin in your path,
> >>> just after /opt/mrwgcc/bin
> >>
> >> Aha! What a great guess -- that fixed it! Thank you so much!
> >
> > Great! We should document this, if we don't already. And even better
> would
> > be if the build failed with a clear error mentioning the need for POSIX
> sed
> > (or whichever command it was).
>
> https://gcc.gnu.org/install/specific.html#x-x-solaris2 says
> "The build process works more smoothly with the legacy Solaris tools so,
> if you have /usr/xpg4/bin in your PATH, we recommend that you place
> /usr/bin before /usr/xpg4/bin for the duration of the build."
>
> So we actually document the opposite...
>

Ouch.

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

* Re: Error when building gcc w/ Go language on Solaris
  2022-04-16 19:41     ` Jonathan Wakely
  2022-04-16 19:47       ` Marc Glisse
@ 2022-04-17  0:38       ` Ian Lance Taylor
  2022-04-17  8:23         ` Jonathan Wakely
  1 sibling, 1 reply; 10+ messages in thread
From: Ian Lance Taylor @ 2022-04-17  0:38 UTC (permalink / raw)
  To: Jonathan Wakely; +Cc: Matthew R. Wilson, gcc-help

On Sat, Apr 16, 2022 at 12:42 PM Jonathan Wakely via Gcc-help
<gcc-help@gcc.gnu.org> wrote:
>
> On Sat, 16 Apr 2022, 20:24 Matthew R. Wilson, <mwilson@mattwilson.org>
> wrote:
>
> > On 04.16.2022 07:33, Jonathan Wakely wrote:
> > >On Sat, 16 Apr 2022, 06:40 Matthew R. Wilson, <mwilson@mattwilson.org>
> > >wrote:
> > >
> > >> I am revisiting my attempts to build GCC with Go language support on
> > >> Solaris/SPARCv9.
> > >>
> > >> The error I get when I make is:
> > >> ../.././gotools/../libgo/go/cmd/go/main.go:10:16: error:
> > >>
> > /export/home/mwilson/gcc-build/gcc-11.2.0/host-sparcv9-sun-solaris2.11/gcc/context.o
> > >> exists but does not contain any Go export data
> > >>
> > >> 3) Set my PATH to: /opt/mrwgcc:/usr/bin:/usr/sbin
> > >>
> > >> 4) configured gcc 11.2 with a similar set of options as the
> > >> Solaris-provided gcc:
> > >>
> > >> ./configure --prefix=/opt/mrwgcc \
> > >>         --enable-languages=c,c++,go  --enable-shared \
> > >>         --enable-initfini-array \
> > >>         --disable-rpath --with-system-zlib --with-build-config=no \
> > >>         --without-gnu-ld --with-ld=/usr/bin/ld \
> > >>         --with-gnu-as --with-as=/opt/mrwgcc/bin/as
> > sparcv9-sun-solaris2.11
> > >
> > >Just a guess, but maybe the Go build uses sed or another command like
> > >that, and relies on the POSIX-conforming version in /usr/xpg4/bin
> > >rather than the /usr/bin one. Try putting /usr/xpg4/bin in your path,
> > >just after /opt/mrwgcc/bin
> >
> > Aha! What a great guess -- that fixed it! Thank you so much!
> >
>
> Great! We should document this, if we don't already. And even better would
> be if the build failed with a clear error mentioning the need for POSIX sed
> (or whichever command it was).

I'm happy to fix the POSIX sed requirement if we can find out where it comes in.

I can't seem to access any Solaris systems at the moment so I can't
recreate it myself.

It's true that the Go build requires objcopy.  It's interesting that
the error message refers to context.o.  At that point in the build
there should be context.gox in the libgo build directory, and the
compiler should find that one first.  And even if content.gox doesn't
exist for some reason, the context.o file should contain export data
in the ".go_export" section.  So I'm puzzled.

Ian

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

* Re: Error when building gcc w/ Go language on Solaris
  2022-04-17  0:38       ` Ian Lance Taylor
@ 2022-04-17  8:23         ` Jonathan Wakely
  2022-04-19 13:36           ` Jonathan Wakely
  0 siblings, 1 reply; 10+ messages in thread
From: Jonathan Wakely @ 2022-04-17  8:23 UTC (permalink / raw)
  To: Ian Lance Taylor; +Cc: Matthew R. Wilson, gcc-help

On Sun, 17 Apr 2022, 01:39 Ian Lance Taylor, <iant@golang.org> wrote:

> On Sat, Apr 16, 2022 at 12:42 PM Jonathan Wakely via Gcc-help
> <gcc-help@gcc.gnu.org> wrote:
> >
> > On Sat, 16 Apr 2022, 20:24 Matthew R. Wilson, <mwilson@mattwilson.org>
> > wrote:
> >
> > > On 04.16.2022 07:33, Jonathan Wakely wrote:
> > > >On Sat, 16 Apr 2022, 06:40 Matthew R. Wilson, <mwilson@mattwilson.org
> >
> > > >wrote:
> > > >
> > > >> I am revisiting my attempts to build GCC with Go language support on
> > > >> Solaris/SPARCv9.
> > > >>
> > > >> The error I get when I make is:
> > > >> ../.././gotools/../libgo/go/cmd/go/main.go:10:16: error:
> > > >>
> > >
> /export/home/mwilson/gcc-build/gcc-11.2.0/host-sparcv9-sun-solaris2.11/gcc/context.o
> > > >> exists but does not contain any Go export data
> > > >>
> > > >> 3) Set my PATH to: /opt/mrwgcc:/usr/bin:/usr/sbin
> > > >>
> > > >> 4) configured gcc 11.2 with a similar set of options as the
> > > >> Solaris-provided gcc:
> > > >>
> > > >> ./configure --prefix=/opt/mrwgcc \
> > > >>         --enable-languages=c,c++,go  --enable-shared \
> > > >>         --enable-initfini-array \
> > > >>         --disable-rpath --with-system-zlib --with-build-config=no \
> > > >>         --without-gnu-ld --with-ld=/usr/bin/ld \
> > > >>         --with-gnu-as --with-as=/opt/mrwgcc/bin/as
> > > sparcv9-sun-solaris2.11
> > > >
> > > >Just a guess, but maybe the Go build uses sed or another command like
> > > >that, and relies on the POSIX-conforming version in /usr/xpg4/bin
> > > >rather than the /usr/bin one. Try putting /usr/xpg4/bin in your path,
> > > >just after /opt/mrwgcc/bin
> > >
> > > Aha! What a great guess -- that fixed it! Thank you so much!
> > >
> >
> > Great! We should document this, if we don't already. And even better
> would
> > be if the build failed with a clear error mentioning the need for POSIX
> sed
> > (or whichever command it was).
>
> I'm happy to fix the POSIX sed requirement if we can find out where it
> comes in.
>
> I can't seem to access any Solaris systems at the moment so I can't
> recreate it myself.
>


We have a couple in the GCC compiler farm. I'll look into it on Tuesday.



> It's true that the Go build requires objcopy.  It's interesting that
> the error message refers to context.o.  At that point in the build
> there should be context.gox in the libgo build directory, and the
> compiler should find that one first.  And even if content.gox doesn't
> exist for some reason, the context.o file should contain export data
> in the ".go_export" section.  So I'm puzzled.
>
> Ian
>

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

* Re: Error when building gcc w/ Go language on Solaris
  2022-04-17  8:23         ` Jonathan Wakely
@ 2022-04-19 13:36           ` Jonathan Wakely
  2022-04-19 19:50             ` Ian Lance Taylor
  0 siblings, 1 reply; 10+ messages in thread
From: Jonathan Wakely @ 2022-04-19 13:36 UTC (permalink / raw)
  To: Ian Lance Taylor; +Cc: Matthew R. Wilson, gcc-help

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

On Sun, 17 Apr 2022 at 09:23, Jonathan Wakely <jwakely.gcc@gmail.com> wrote:
>
>
>
> On Sun, 17 Apr 2022, 01:39 Ian Lance Taylor, <iant@golang.org> wrote:
>>
>> On Sat, Apr 16, 2022 at 12:42 PM Jonathan Wakely via Gcc-help
>> <gcc-help@gcc.gnu.org> wrote:
>> >
>> > On Sat, 16 Apr 2022, 20:24 Matthew R. Wilson, <mwilson@mattwilson.org>
>> > wrote:
>> >
>> > > On 04.16.2022 07:33, Jonathan Wakely wrote:
>> > > >On Sat, 16 Apr 2022, 06:40 Matthew R. Wilson, <mwilson@mattwilson.org>
>> > > >wrote:
>> > > >
>> > > >> I am revisiting my attempts to build GCC with Go language support on
>> > > >> Solaris/SPARCv9.
>> > > >>
>> > > >> The error I get when I make is:
>> > > >> ../.././gotools/../libgo/go/cmd/go/main.go:10:16: error:
>> > > >>
>> > > /export/home/mwilson/gcc-build/gcc-11.2.0/host-sparcv9-sun-solaris2.11/gcc/context.o
>> > > >> exists but does not contain any Go export data
>> > > >>
>> > > >> 3) Set my PATH to: /opt/mrwgcc:/usr/bin:/usr/sbin
>> > > >>
>> > > >> 4) configured gcc 11.2 with a similar set of options as the
>> > > >> Solaris-provided gcc:
>> > > >>
>> > > >> ./configure --prefix=/opt/mrwgcc \
>> > > >>         --enable-languages=c,c++,go  --enable-shared \
>> > > >>         --enable-initfini-array \
>> > > >>         --disable-rpath --with-system-zlib --with-build-config=no \
>> > > >>         --without-gnu-ld --with-ld=/usr/bin/ld \
>> > > >>         --with-gnu-as --with-as=/opt/mrwgcc/bin/as
>> > > sparcv9-sun-solaris2.11
>> > > >
>> > > >Just a guess, but maybe the Go build uses sed or another command like
>> > > >that, and relies on the POSIX-conforming version in /usr/xpg4/bin
>> > > >rather than the /usr/bin one. Try putting /usr/xpg4/bin in your path,
>> > > >just after /opt/mrwgcc/bin
>> > >
>> > > Aha! What a great guess -- that fixed it! Thank you so much!
>> > >
>> >
>> > Great! We should document this, if we don't already. And even better would
>> > be if the build failed with a clear error mentioning the need for POSIX sed
>> > (or whichever command it was).
>>
>> I'm happy to fix the POSIX sed requirement if we can find out where it comes in.
>>
>> I can't seem to access any Solaris systems at the moment so I can't
>> recreate it myself.
>
>
>
> We have a couple in the GCC compiler farm. I'll look into it on Tuesday.

The 'check-tail' target in libgo/Makefile.am does:

...  | sed -n -e 's/.* \(version.*$$\)/\1/p'` >> libgo.sum

This doesn't work with Solaris sed (and is documented by Autoconf as
being non-portable). The $ needs to be outside the back-reference
expression:

...  | sed -n -e 's/.* \(version.*\)$$/\1/p'` >> libgo.sum

This should be OK to change, because the $ is just an anchor and
doesn't need to be captured.

More significantly, I see errors like:

/export/home/jwakely/src/gcc/libgo/match.sh: line 114: ((: go1.13 :
syntax error: invalid arithmetic operator (error token is ".13 ")

That script uses \+ in a sed script, which is not supported by POSIX
sed, because it's not in the BRE grammar. That seems to be the cause
of the match.sh errors. The attached patch fixes it.

[-- Attachment #2: patch.txt --]
[-- Type: text/plain, Size: 526 bytes --]

diff --git a/libgo/match.sh b/libgo/match.sh
index 139d0cdbe64..7ed587ff794 100755
--- a/libgo/match.sh
+++ b/libgo/match.sh
@@ -100,7 +100,7 @@ fi
 
 gobuild() {
     line=$(echo "$1" | sed -e 's|//go:build ||')
-    line=$(echo "$line" | sed -e 's/go1\.[0-9]\+/1/g' -e 's/goexperiment\./goexperiment/')
+    line=$(echo "$line" | sed -e 's/go1\.[0-9][0-9]*/1/g' -e 's/goexperiment\./goexperiment/')
     line=" $line "
     wrap='[ ()!&|]'
     for ones in $goarch $goos $cgotag $cmdlinetag gccgo goexperimentfieldtrack; do

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

* Re: Error when building gcc w/ Go language on Solaris
  2022-04-19 13:36           ` Jonathan Wakely
@ 2022-04-19 19:50             ` Ian Lance Taylor
  0 siblings, 0 replies; 10+ messages in thread
From: Ian Lance Taylor @ 2022-04-19 19:50 UTC (permalink / raw)
  To: Jonathan Wakely; +Cc: Matthew R. Wilson, gcc-help, gcc-patches, gofrontend-dev

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

On Tue, Apr 19, 2022 at 6:36 AM Jonathan Wakely <jwakely.gcc@gmail.com> wrote:
>
> The 'check-tail' target in libgo/Makefile.am does:
>
> ...  | sed -n -e 's/.* \(version.*$$\)/\1/p'` >> libgo.sum
>
> This doesn't work with Solaris sed (and is documented by Autoconf as
> being non-portable). The $ needs to be outside the back-reference
> expression:
>
> ...  | sed -n -e 's/.* \(version.*\)$$/\1/p'` >> libgo.sum
>
> This should be OK to change, because the $ is just an anchor and
> doesn't need to be captured.
>
> More significantly, I see errors like:
>
> /export/home/jwakely/src/gcc/libgo/match.sh: line 114: ((: go1.13 :
> syntax error: invalid arithmetic operator (error token is ".13 ")
>
> That script uses \+ in a sed script, which is not supported by POSIX
> sed, because it's not in the BRE grammar. That seems to be the cause
> of the match.sh errors. The attached patch fixes it.

Thanks for looking.  Committed to mainline like so.

Ian

[-- Attachment #2: patch.txt --]
[-- Type: text/plain, Size: 1629 bytes --]

75f7b65d3f775f06be08c5d2a9573b49a4b4b1d5
diff --git a/gcc/go/gofrontend/MERGE b/gcc/go/gofrontend/MERGE
index 2321f67ca5d..63238715bd0 100644
--- a/gcc/go/gofrontend/MERGE
+++ b/gcc/go/gofrontend/MERGE
@@ -1,4 +1,4 @@
-22b0ccda3aa4d16f770a26a3eb251f8da615c318
+99ca6be406a5781be078ff23f45a72b4c84b16e3
 
 The first line of this file holds the git revision number of the last
 merge done from the gofrontend repository.
diff --git a/libgo/Makefile.am b/libgo/Makefile.am
index e0a1eec52a2..a5d4b6a3525 100644
--- a/libgo/Makefile.am
+++ b/libgo/Makefile.am
@@ -1305,7 +1305,7 @@ check-tail: check-recursive check-multi
 	if test "$$untested" -ne "0"; then \
 	  echo "# of untested testcases		$$untested" >> libgo.sum; \
 	fi; \
-	echo `echo $(GOC) | sed -e 's/ .*//'`  `$(GOC) -v 2>&1 | grep " version" | sed -n -e 's/.* \(version.*$$\)/\1/p'` >> libgo.sum; \
+	echo `echo $(GOC) | sed -e 's/ .*//'`  `$(GOC) -v 2>&1 | grep " version" | sed -n -e 's/.* \(version.*\)$$/\1/p'` >> libgo.sum; \
 	echo >> libgo.log; \
 	echo "runtest completed at `date`" >> libgo.log; \
 	if test "$$fail" -ne "0"; then \
diff --git a/libgo/match.sh b/libgo/match.sh
index 139d0cdbe64..7ed587ff794 100755
--- a/libgo/match.sh
+++ b/libgo/match.sh
@@ -100,7 +100,7 @@ fi
 
 gobuild() {
     line=$(echo "$1" | sed -e 's|//go:build ||')
-    line=$(echo "$line" | sed -e 's/go1\.[0-9]\+/1/g' -e 's/goexperiment\./goexperiment/')
+    line=$(echo "$line" | sed -e 's/go1\.[0-9][0-9]*/1/g' -e 's/goexperiment\./goexperiment/')
     line=" $line "
     wrap='[ ()!&|]'
     for ones in $goarch $goos $cgotag $cmdlinetag gccgo goexperimentfieldtrack; do

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

end of thread, other threads:[~2022-04-19 19:50 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-16  5:39 Error when building gcc w/ Go language on Solaris Matthew R. Wilson
2022-04-16  6:33 ` Jonathan Wakely
2022-04-16 19:24   ` Matthew R. Wilson
2022-04-16 19:41     ` Jonathan Wakely
2022-04-16 19:47       ` Marc Glisse
2022-04-16 23:17         ` Jonathan Wakely
2022-04-17  0:38       ` Ian Lance Taylor
2022-04-17  8:23         ` Jonathan Wakely
2022-04-19 13:36           ` Jonathan Wakely
2022-04-19 19:50             ` Ian Lance Taylor

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