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
cmd/link: cannot cross compile a linux plugin on macOS #22462
Comments
@forskning I can cross compile a linux exe with cgo on macOS with go1.9 and gcc 7.2.0. go version:go version go1.9 darwin/amd64 gcc version:
|
The 10-10-15 dated comment by T. de Zeeuw in the link I provided seems to indicate a failed attempt to utilise a gcc compiled for darwin, rather than following I.L. Taylor's suggestion in an earlier comment to that issue, to utilise a "Darwin -> GNU/Linux cross-compiler". |
https://github.com/golang/go/wiki/WindowsCrossCompiling Perhaps similar as A. Donizetti's above wiki page it would be of interest to the community to have a "LinuxCrossCompiling" wiki page. |
You need to have a cross-compiler. I guess I'll leave this issue open for documentation. |
CC @ALTree |
@forskning I'm not really the author of that wikipage, I just happen to be the last person who edited it : ) That said, I agree we could use a {Linux or OsX}CrossCompiling wiki page, since it's something that apparently trips a lot of people and issues about this always end up with someone writing the usual "you need a cross-compiling toolchain to do this." We could write down the procedure nicely once, and then just link the wiki page. |
FWIW, possibly #22041 could also use a HelpWanted label. |
Is it possible to just create a golang zip for macos/linux/windows that include a cross compile gcc for macos/linux/windows ? |
Why don’t we just make the Go tool refuse to operate if it is in cross compilation mode and cgo is enabled and the host cc options are not set?
… On 28 Oct 2017, at 00:48, Alberto Donizetti ***@***.***> wrote:
@forskning I'm not really the author of that wikipage, I just happen to be the last person who edited it : )
That said, I agree we could use {Linux,OsX}CrossCompiling wiki pages, since it's something that apparently trips a lot of people and issues about this always end up with someone writing the usual "you need a cross-compiling toolchain to do this." We could write it down nicely once and then just link the wiki page.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.
|
https://forum.golangbridge.org/t/go-mobile-commands/7002 There's a recent somewhat lengthy series of topics on golangbridge.org. Specifically pertaining to the subrepo mobile and external software; an install of Java8, Android Studio, and NDK, where just for the Android Studio/Android SDK there is the minimum requirement of an allocation of 2GB of free harddrive space. I think its worth noting here the comment of I.L.T. to (the now Abandoned) https://golang.org/cl/69430, inferring that in regards to that proposed change in the golang.org introductory documentation, that installation of a cross-compiler was more intermediate or advanced level coding. With host cc options not being set and a message output to that effect this might likewise infer that the coder was at an intermediate or advanced level, in order for that coder to interpret the shell message. https://forum.golangbridge.org/t/cannot-find-package-golang-org-x-tools-cmd-goimports/7000 With all due respect I like S. Binet's comment near the closing of a separate golangbridge.org "it’s left as an exercize for the reader" That is, with the documentation available, it's left to the reader to be able to locate that information. But, I note the drawing of R. French on golang.org/help. |
@davecheney works for me. Thanks. |
@forskning As the issue #12888 saying:
How do i get the Darwin -> GNU/Linux cross-compiler ? thx! |
@mrhoric the last line of the shell output from #22462 (comment) indicates that crosstool-NG was utilised |
Still not solved CGO_ENABLED=0
CGO_ENABLED=1
|
Still have this issue in golang 1.19 |
Base on the comments on related issues, I think we just need to set CGO_ENABLED=1 CC=arm-linux-gnueabihf-cc GOOS=linux GOARCH=arm GOARM=7 go build --buildmode=plugin Anybody know what should be the value for |
What version of Go are you using (
go version
)?go version go1.9.2 darwin/amd64
Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?macOS Sierra 10.12.6 with latest Xcode 9.0.1 and Command Line Tools installed.
What did you do?
With explicit
CGO_ENABLED=1
I get:What did you expect to see?
Successfully compiled plugin.
What did you see instead?
Failures.
The text was updated successfully, but these errors were encountered: