-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
go build error #491
Comments
my os is linux-amd64, only linux-amd64 can go build |
Because you don't install cross C compiler for linux-i386. |
Similar issue. Trying to compile for linux/x86_84 on my mac. Code will run on my hosting provider which doesn't have gcc installed. So I need to compile on my mac for use on linux.
|
You must install cross C compiler for Linux on your Mac. |
Any hints on installing that? |
thanks |
@utdrmac I don't have Mac. Sorry. |
@utdrmac Were able to compile linux binary on mac? |
Nope. I just booted up a VirtualBox with the same OS as my hosting provider, installed go, etc, compiled, copied. works well. Took about 10m to download/install a CentOS6 VM. Another 10m to install/setup Go. Would have spent a lot longer figuring out cross-compile stuff. |
Simillar problem here. I can not cross compile this library for linux/amd64 on macOS now. |
Do you use cross C compiler? Maybe you are using host compiler. Check |
@mattn Yes I was using the host compiler, it was the cause. So I installed the cross compiler for linux on mac: http://crossgcc.rts-software.org/doku.php?id=compiling_for_linux and ran the build command, the results was successful. (Of course, I did not run this output binary on linux instance yet) Thank you. @utdrmac I solved the cross compilation problem on mac with gcc for linux for mac |
@mingrammer do you have gcc for linux for windows |
@yincongcyincong I did not find one for windows. You should search it yourself, sorry. |
While building this package for linux on OS X, I'm seeing following error. I tried everything you mentioned on the thread but nothing is working for me. Please let me know your thoughts on this. (I'm using - GOOS=linux GOARCH=amd64) With CGO_ENABLED=1 runtime/cgo |
you need to use cross-C-compiler. you are doing:
This should be:
So you need to set environment variable CC to the cross-C-compiler. |
I tried as suggested but it is failing on the target linux server with following error. Error on linux server: Linux server has following installed: |
@meeramn you obviously need to update your glibc package on the linux server to 2.14. |
For those having this issue on linux (especially if you're using Ubuntu), please do the following: $ sudo apt-get install gcc-mingw-w64 The above command will install cross compiler for C. Then you can build with the following code: To build for windows amd64: GOOS=windows GOARCH=amd64 CC=x86_64-w64-mingw32-gcc CGO_ENABLED=1 go build -o binary_name_amd64.exe . Similarly for windows 386: GOOS=windows GOARCH=386 CC=i686-w64-mingw32-gcc CGO_ENABLED=1 go build -o binary_name_386.exe . Hope this helps. |
@mattn Can you suggest me some good cross compiler for mac on linux (Ubuntu 16.04)?. I came across a few that I found out on the internet which I listed below.
Thanks. |
@bharath-srinivas sorry, I don't have Mac. |
Compile Section Closes mattn#175 Compile Section Closes mattn#201 Compile Section Closes mattn#206 Compile Section Closes mattn#404 Compile Section Closes mattn#217 Compile Section Closes mattn#224 Compile Section Closes mattn#234 Compile Section Closes mattn#242 Feature table Closes mattn#255 Description Section Closes mattn#232 Golang:1.6 not supported Closes mattn#272 Golang:1.5 not supported + compilation section Closes mattn#283 usleep Implemented Closes mattn#285 FAQ Section Closes mattn#289 Compile Section closes mattn#295 FAQ Section Closes mattn#305 PR339 Closes mattn#318 mattn#321 Compilation Section Closes mattn#341 PR407 Closes mattn#364 Feature `sqlite_vtable` Closes mattn#393 Compile Section Closes mattn#416 sqlite_trace feature Closes mattn#433 Compilation Section Closes mattn#435 Compilation Section Closes mattn#443 Golang:1.6 Not Supported Closes mattn#445 Compilation Section Closes mattn#451 Compilation Section Closes mattn#467 Compilation Section Closes mattn#491 Compilation Section Closes mattn#495 Compilation Section Closes mattn#505 Compilation Section Closes mattn#557 Compilation Section Closes mattn#560
Does anyone have the correct incantation (or value for CC) to use the "cross compiler" on mac? I have gcc installed via brew but can't figure it out so I'm still getting this error, we could then improve the documentation by listing the actual steps required! The url in the page earlier linked is now extinct so it's of no use. |
@utdrmac @mingrammer could you please write an update for the compilation section for MAC within the README. Hope you can take some time for it. I think it will help a lot of people. Don't have Mac myself. |
@gjrtimmer Sorry, I gave up on using SQLite3 in my project because this was too complicated to cross-compile for each OS. I switched to https://github.com/coreos/bbolt in my project which is 100% Go and allows me to compile for each os/arch on my mac. |
here new problem is "i686-w64-mingw32-gcc: error: CreateProcess: No such file or directory", how to resolve? |
I have this bug:
|
i use shell script to go build, but i failed
GOOS=linux GOARCH=386 go build && mv proxyWebApplication proxyWeb/proxyWebApplication && tar zcfv "zip/proxy-linux-386.tar.gz" proxyWeb
why?
this is error information
../github.com/mattn/go-sqlite3/sqlite3_go18.go:26: undefined: SQLiteConn ../github.com/mattn/go-sqlite3/sqlite3_go18.go:27: undefined: namedValue
The text was updated successfully, but these errors were encountered: