Google Groups

Re: [go-nuts] Cross-compiling with the go tool


Dorival Pedroso Mar 7, 2012 2:10 PM
Posted in group: golang-nuts
what about with cgo enabled?

On Thursday, March 8, 2012 5:28:10 AM UTC+10, Kyle Lemons wrote:
I do this for three different servers; I develop on my mac and build (via a script, of course) with CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build $NAME -o ${NAME}_linux and then I copy it over (and the harness notices and restarts).  Works quite nicely.  Compared to my experiences trying to cross-compile with GCC, it's practically a pleasure.

On Wed, Mar 7, 2012 at 10:44 AM, Mostafa Hajizadeh <most...@gmail.com> wrote:
Thank you very much. I finally managed to run my app on my server. :)

On Wednesday, March 7, 2012 6:56:28 PM UTC+3:30, Norbert Roos wrote:

> cannot use cgo when compiling for a different operating system

You can try "export CGO_ENABLED=0" (and maybe ./make.bash instead of
./all.bash).

I think this doesn't build all, so if you are using the wrong packets,
this won't help you.

Norbert