On Sat, 16 Apr 2022, 06:40 Matthew R. Wilson, <mwilson@xxxxxxxxxxxxxx> 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 > >