This post is about how I am fixing things... for a HOWTO on gccgo, check gccgo mini-HOWTO
Continued... Part 1...
As the post is growing bigger everyday, I am splitting it... :)
I am back... :)
The issue with import is that they can't find the library files... I tried adding them manually using -I.
$ gccgo hello.go -I ~/go/objdir/i686-pc-linux-gnu/libgo/fmt/
/usr/bin/ld: crtbegin.o: No such file: No such file or directory
collect2: ld returned 1 exit status
/usr/bin/ld: crtbegin.o: No such file: No such file or directory
collect2: ld returned 1 exit status
So, now they got fmt... I tried just compiling (no linking)...
$ gccgo -c hello.go -I ~/go/objdir/i686-pc-linux-gnu/libgo/fmt/
It worked... but linking gives same error...
$ gccgo -o hello hello.go -I ~/go/objdir/i686-pc-linux-gnu/libgo/fmt/
/usr/bin/ld: crtbegin.o: No such file: No such file or directory
collect2: ld returned 1 exit status
/usr/bin/ld: crtbegin.o: No such file: No such file or directory
collect2: ld returned 1 exit status
The file is inside objdir and also installed at location
/usr/lib/gcc/i486-linux-gnu/4.4/... the problem is that location is for gcc 4.4.1, but new gccgo is using gcc version 4.5.0...Maybe, the
make install error is the culprit... let's fix that first...Apply this patch to
./gcc/go/Make-lang.in... [Link: [gccgo] Add go.install-plugin target]Index: Make-lang.in
===================================================================
--- Make-lang.in (revision 154084)
+++ Make-lang.in (working copy)
@@ -96,6 +96,7 @@ go.install-common: installdirs
-$(INSTALL_PROGRAM) gccgo$(exeext) $(DESTDIR)$(bindir)/$(GCCGO_INSTALL_NAME)$(exeext)
-chmod a+x $(DESTDIR)$(bindir)/$(GCCGO_INSTALL_NAME)$(exeext)
+go.install-plugin:
go.install-man:
go.uninstall:
===================================================================
--- Make-lang.in (revision 154084)
+++ Make-lang.in (working copy)
@@ -96,6 +96,7 @@ go.install-common: installdirs
-$(INSTALL_PROGRAM) gccgo$(exeext) $(DESTDIR)$(bindir)/$(GCCGO_INSTALL_NAME)$(exeext)
-chmod a+x $(DESTDIR)$(bindir)/$(GCCGO_INSTALL_NAME)$(exeext)
+go.install-plugin:
go.install-man:
go.uninstall:
Installing...
$ sudo make install
Another error...
/usr/bin/ld: cannot find -lgcc
collect2: ld returned 1 exit status
make[2]: *** [cc1-dummy] Error 1
make[2]: Leaving directory `/more/go/objdir/gcc'
make[1]: *** [install-gcc] Error 2
make[1]: Leaving directory `/more/go/objdir'
make: *** [install] Error 2
collect2: ld returned 1 exit status
make[2]: *** [cc1-dummy] Error 1
make[2]: Leaving directory `/more/go/objdir/gcc'
make[1]: *** [install-gcc] Error 2
make[1]: Leaving directory `/more/go/objdir'
make: *** [install] Error 2
Will check it out...
I tried
make again... showed another error...checking for C compiler default output file name...
configure: error: in `/more/go/objdir':
configure: error: C compiler cannot create executables
See `config.log' for more details.
configure: error: in `/more/go/objdir':
configure: error: C compiler cannot create executables
See `config.log' for more details.
Tried distclean and configure again... same error !!!
The problem was gcc version 4.5.0 was being used and it is not fully installed... I removed and reinstalled gcc 4.4.1...
$ sudo apt-get remove gcc
$ sudo rm /usr/local/bin/gcc
$ sudo apt-get -y install gcc
$ sudo rm /usr/local/bin/gcc
$ sudo apt-get -y install gcc
Have to close the shell and take another shell to have gcc back again...
configure working now... complete...make... later... bye again...I'm back again... :)
make complete... it took more that 5 hours (exact time I don't know)...On to the next phase...
$ sudo make install
Got the same error...
make[2]: *** No rule to make target `go.install-plugin', needed by `lang.install-plugin'. Stop.
make[2]: Leaving directory `/more/go/objdir/gcc'
make[1]: *** [install-gcc] Error 2
make[1]: Leaving directory `/more/go/objdir'
make: *** [install] Error 2
make[2]: Leaving directory `/more/go/objdir/gcc'
make[1]: *** [install-gcc] Error 2
make[1]: Leaving directory `/more/go/objdir'
make: *** [install] Error 2
Let me check the Make-lang.in file...
Oops... I had added
go-install-plugin: instead of go.install-plugin: !!! Tried
make install again... libgcc gone... the cycle continues...Let's put back gcc 4.4.1... now trying to install again...
$ sudo make install
Got another error...
/usr/bin/ld: cannot find -lstdc++
collect2: ld returned 1 exit status
make[2]: *** [go1] Error 1
make[2]: Leaving directory `/more/go/objdir/gcc'
make[1]: *** [install-gcc] Error 2
make[1]: Leaving directory `/more/go/objdir'
make: *** [install] Error 2
collect2: ld returned 1 exit status
make[2]: *** [go1] Error 1
make[2]: Leaving directory `/more/go/objdir/gcc'
make[1]: *** [install-gcc] Error 2
make[1]: Leaving directory `/more/go/objdir'
make: *** [install] Error 2
Let's put back g++ 4.4.1... trying... another error...
cc1: warnings being treated as errors
../../gccgo/gcc/gcc.c: In function ‘execute’:
../../gccgo/gcc/gcc.c:3109: error: format not a string literal and no format arguments
make[2]: *** [gcc.o] Error 1
make[2]: Leaving directory `/more/go/objdir/gcc'
make[1]: *** [install-gcc] Error 2
make[1]: Leaving directory `/more/go/objdir'
make: *** [install] Error 2
../../gccgo/gcc/gcc.c: In function ‘execute’:
../../gccgo/gcc/gcc.c:3109: error: format not a string literal and no format arguments
make[2]: *** [gcc.o] Error 1
make[2]: Leaving directory `/more/go/objdir/gcc'
make[1]: *** [install-gcc] Error 2
make[1]: Leaving directory `/more/go/objdir'
make: *** [install] Error 2
To be continued... Part 3...
Check out the mini-HOWTO on gccgo... gccgo mini-HOWTO
Reference: Setting up and using gccgo


0 comments:
Post a Comment