Re: [go-nuts] GCCGO Go compiled import pkg not found error

393 views
Skip to first unread message
Message has been deleted

Ian Lance Taylor

unread,
Feb 26, 2014, 11:19:40 AM2/26/14
to darkofpain, golang-nuts
On Wed, Feb 26, 2014 at 3:10 AM, darkofpain <batuha...@gmail.com> wrote:
> With GCC c, c + +, go languages installed
>
> but test.go when I want to compile the code fails because it can not find
> libraries
>
> How can I solve this problem.
>
> batuhangoksu:~ batuhangoksu$ gccgo -c /Users/batuhangoksu/Desktop/test.go
> /Users/batuhangoksu/Desktop/test.go:3:11: error: import file ‘fmt’ not
> found
> import "fmt"

Something is wrong with your installation. Did you run "make install"
from the top level of your build tree? Did you move files around
after running "make install"?

Ian

Dave Cheney

unread,
Feb 26, 2014, 7:17:28 PM2/26/14
to golan...@googlegroups.com, darkofpain
In addition to what Ian said, it is probably something strange with your gccgo install.

Where did you install gccgo from ? From source ? From some operating system distribution ? At the moment I'd recommend doing a source build,

../gcc/trunk/configure --prefix=/opt/gccgo --enable-languages=go --disable-bootstrap

^ this is the configure line I use to build gccgo myself, make install will install it to /opt/gccgo and I recommend no moving it from there.

Brendan Tracey

unread,
Oct 22, 2014, 4:48:19 PM10/22/14
to golan...@googlegroups.com, batuha...@gmail.com
Hi,

I'm seeing this problem. I'm on OSX 10.9. I followed the instructions in the "Build commands" section of https://golang.org/doc/install/gccgo (though without the gold linker). The source directory is unrelated to $GOPATH and $GOROOT, and the binary is installed to /opt/gccgo .
 I ran make install from 'objdir' like the build commands imply, and I have not moved any files. Does gccgo assume a certain $GOROOT? That's all I can think of that's weird about my installation. Error and other details below. Thanks.

brendan:~$ cd $GOPATH/src
brendan:~/Documents/mygo/src$ go install -compiler=gccgo github.com/gonum/floats/
# github.com/gonum/floats
github.com/gonum/floats/floats.go:14:8: error: import file ‘errors’ not found
  "errors"
        ^
github.com/gonum/floats/floats.go:15:6: error: import file ‘math’ not found
  "math"
      ^
github.com/gonum/floats/floats.go:16:6: error: import file ‘sort’ not found
  "sort"

brendan:~$ go version
go version go1.3 darwin/amd64
brendan:~$ go env
GOARCH="amd64"
GOBIN=""
GOCHAR="6"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/brendan/Documents/mygo"
GORACE=""
GOROOT="/Users/brendan/gover/go_1_3_0"
GOTOOLDIR="/Users/brendan/gover/go_1_3_0/pkg/tool/darwin_amd64"
CC="clang"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fno-common"
CXX="clang++"
CGO_ENABLED="1"

Brendan Tracey

unread,
Oct 22, 2014, 7:20:55 PM10/22/14
to Chris Manghane, golan...@googlegroups.com, batuha...@gmail.com
Ah, well that would explain it. Is there a reason this is not stated in https://golang.org/doc/install/gccgo ? Would have saved me some time…

On Oct 22, 2014, at 3:49 PM, Chris Manghane <cm...@google.com> wrote:

Hi,

Unfortunately gccgo does not work on Darwin (http://gcc.gnu.org/PR46986).  Sorry.

Chris

Chris Manghane

unread,
Oct 22, 2014, 10:20:46 PM10/22/14
to Brendan Tracey, golan...@googlegroups.com, batuha...@gmail.com

Ian Taylor

unread,
Oct 22, 2014, 11:37:57 PM10/22/14
to Brendan Tracey, Chris Manghane, golang-nuts, batuha...@gmail.com
On Wed, Oct 22, 2014 at 4:20 PM, Brendan Tracey
<tracey....@gmail.com> wrote:
> Ah, well that would explain it. Is there a reason this is not stated in
> https://golang.org/doc/install/gccgo ? Would have saved me some time…

I sent out https://gcc.gnu.org/ml/gcc-patches/2014-10/msg02329.html to
prevent attempts to build gccgo on some systems that are known to not
work.

Ian


> On Oct 22, 2014, at 3:49 PM, Chris Manghane <cm...@google.com> wrote:
>
> Hi,
>
> Unfortunately gccgo does not work on Darwin (http://gcc.gnu.org/PR46986).
> Sorry.
>
> Chris
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "golang-nuts" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to golang-nuts...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Brendan Tracey

unread,
Oct 23, 2014, 11:57:16 AM10/23/14
to Ian Taylor, Chris Manghane, golang-nuts, batuha...@gmail.com
Thanks.
Reply all
Reply to author
Forward
0 new messages