-
Notifications
You must be signed in to change notification settings - Fork 17.9k
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
gccgo: Trouble cross-compiling to GOARCH=mips using gccgo #18942
Comments
It looks like your gccgo isn't the cross compiler, i.e. it's targeting the host (amd64) instead of mips. I don't know how to cross compile with gccgo though. You probably needs to set up some environment variable. |
Maybe |
and you should use the go tool bundled with gccgo, not go tool bundled with
gc due to various version skew problems.
|
@minux Well the key line seems to be
which is using gccgo directly. Not sure if I should try xgo or whether building my own cross-compiling version of GCC, a la https://github.com/golang/go/wiki/GccgoCrossCompilation#build-the-cross-compiler, is necessary. |
I'm pretty sure /usr/bin/gccgo is not a mips cross gccgo.
As cherrymui mentioned, you need to install a cross gccgo, and then use the
go command bundled with cross gccgo.
|
Setting |
|
This is my first time using gccgo and just wanting to cross-compile my go app for openwrt. Can anyone please tell me why importing non-standard package fails?
|
@adonespitogo you're expected to use the |
Thanks for the advice @cherrymui . I tried
|
Make sure that you are using the Make sure that |
My |
I've built
|
It's working now, I guess. Here's my new env and build params:
Though I can't confirm it yet since I still have to update my go codes to use golang |
Thanks, closing for now. |
What version of Go are you using (
go version
)?go version go1.8rc3 linux/amd64
What operating system and processor architecture are you using (
go env
)?linux/amd64
What did you do?
I tried cross-compiling a trivial "hello world" Go program -- namely https://github.com/elimisteve/hello/blob/master/hello.go -- with this command:
What did you expect to see?
No output and a successfully-compiled 32-bit MIPS binary in my local directory.
What did you see instead?
This is using
gccgo
6, which installed 'libgo9as a dependency when I ran
apt-get install gccgo`.At https://tip.golang.org/doc/install/gccgo it says,
so I believe this is supposed to work? Thanks!
The text was updated successfully, but these errors were encountered: