You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
---------- Forwarded message ----------
From: Stetson <stetsongafford@gmail.com>
Date: Thu, Jan 26, 2012 at 11:12
Subject: [go-nuts] Cross compiling OSX to Linux 386 with Go tool ("cannot use cgo
when compiling for a different operating system")
To: golang-nuts <golang-nuts@googlegroups.com>
Hi all,
I've been developing with Go on OSX targeting Linux 386 for about 8
months, but now I'm trying to do so with the latest Weekly (01-20).
I installed and compiled the weekly under OSX, and then did the same
in a Linux VM and copied the /pkg/linux_386/ folder over to the OSX
install, which is how I did it before.
I've mostly figured out how to use the go tool for building and
installing my own packages, and I like it a lot now that I'm used to
it, but it doesn't seem to like cross compiling when using packages
that rely on cgo.
When I try to compile my package (which imports net/http, which I
think relies on cgo) with GOOS=linux using 8g, it seems to work just
fine. When I try to 'go install' the package, I get the error "cannot
use cgo when compiling for a different operating system".
Do I just need to do all of my compiling and copying manually or is
there some way to use the go tool with this setup?
Thanks
The text was updated successfully, but these errors were encountered:
This should be fixed now. If you are working outside $GOROOT
(in a $GOPATH), then the go command does not try to recompile
packages inside $GOROOT, which means it will not try to recompile
net, which means it will not invoke cgo, which means it will not
provoke that message.
On release (12872:920e9d1ffd1f), bsiegert's command works for me so long as I change
DISABLE_CGO=1 to CGO_ENABLED=0. Without that flag, I get the same "cannot use cgo
when..." error as Stetson when "go build" tries to build runtime/cgo.
The text was updated successfully, but these errors were encountered: