Search code examples
compiler-errorsgogccgo

gccgo does not know -fgo-relative-import-path


I tried to compile some code with gccgo on my machine:

$ export LANG=C
$ go get -d github.com/fuzxxl/ppm
$ cd $GOPATH/src /github.com/fuzxxl/ppm
$ go build -compiler gcc
gccgo: error: unrecognized command line option '-fgo-relative-import-path=_/home/fuz/src/go/src/github.com/fuzxxl/ppm'

These are the tools on my machine:

$ go version
go version devel +dda87c8bcba1 Wed Apr 17 13:25:28 2013 -0700 linux/amd64
$ gccgo --version
gccgo (Ubuntu/Linaro 4.7.2-2ubuntu1) 4.7.2
Copyright (C) 2012 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Why do I get the error shown above? What can I do to fix this?


Solution

  • The -fgo-relative-import-path option was committed on 2012-10-30, whereas GCC 4.7.2 (including gccgo) was already released on 2012-09-20. So gccgo 4.7.2 simply does not yet contain support for this option.

    Upgrading gccgo to 4.7.3 (or 4.8.0) should fix this.