On Sun, 17 Apr 2022 at 09:23, Jonathan Wakely wrote: > > > > On Sun, 17 Apr 2022, 01:39 Ian Lance Taylor, wrote: >> >> On Sat, Apr 16, 2022 at 12:42 PM Jonathan Wakely via Gcc-help >> wrote: >> > >> > On Sat, 16 Apr 2022, 20:24 Matthew R. Wilson, >> > wrote: >> > >> > > On 04.16.2022 07:33, Jonathan Wakely wrote: >> > > >On Sat, 16 Apr 2022, 06:40 Matthew R. Wilson, >> > > >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.