os : Windows 7 x64
go: 1.7.1 x64 msi
I installed go in D:\Go, and want to cross compile a linux x64 version. I tried the following steps:
and get the following error:
Building Go bootstrap tool.
Building Go toolchain using D:\Go.
go: open D:\Go\src\runtime\internal\sys\zversion.go: The system cannot find the file specified.
go tool dist: FAILED: D:\Go\bin\go install -gcflags=-l -v bootstrap/…: exit status 1
How could I solve this problem? Thanks for andy help.
I think you’ve mixed up two independent concepts.
The first is uaing your windows machine to build a program to run on a Linux machine. In which case this is simply.
go build $yourprogram
Where $yourprogram is the import path of your program. If compilation is successful a file called $yourprogram will be present in the current directory. It will be a 64bit Linux binary.
If instead you were hoping to use your windows machine to build a version of the go compiler and runtime that works on Linux, this is not the correct procedure. Instead I recommend you use the download tarball from golang.org and install it directly on your Linux host. There is no need to cross compile anything
Thanks for your reply.
I have not use golang for a long time (Go 1.3 when I use it last time).I search on the internet, finding that “cross compile” has changed much after Go 1.5. Now I do not need to precompile the linux lib using “all.bat”, just set env and go build. I tried your method, and it does work.
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.