-
-
Notifications
You must be signed in to change notification settings - Fork 229
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
mac->linux cross compiling fails on linking "unknown option: --no-undefined" #462
Comments
To cross-compile something that uses CGO you need to have a toolchain and compiler for that platform installed. For example, CC=x86_64-w64-mingw32-gcc when you cross compile for Windows, or CC=arm-linux-androideabi-clang for Android etc. It seems you are just trying to add GOOS=linux and GOARCH=amd64 with your native compiler? |
Now that you say this (and after sleeping on it), this makes perfect sense. I did install Is there a homebrew package for linux-gcc? Is |
Got the same issue on Linux using (no cross-compilation here):
The previous libraries (with go1.13.8 & gcc 7.5.0) didn't have this issue. Output when go build-ing (-tags static):
After some searching (edit): The issue might be caused by a bug in elfutils & binutils.
Since I'm using binutils 2.30 I assume a recent elfutils is used for building the static libraries (0.176 or more recent). References: |
I'm having trouble cross-compiling from mac (darwin) to linux, both amd64. I am running go version go1.14.3 darwin/amd64.
The program in question can be statically compiled for macOS (compiler host), and statically cross-compiled from macOS to Windows. But static cross-compiling from macOS to linux gives the following error during linking:
I've read elsewhere that this is a gcc/clang difference, and I can see that the sdl sources include that flag for building linux binaries, but I don't know how to either tell it to use the gcc linker or switch that flag for something clang-appropriate.
Also, when I statically compile on linux for linux:
Dynamic builds under mac->mac and linux->linux work fine.
It might be something silly, I admit that I haven't dug too deep into the options here. Thanks for any help you can provide!
PS - I really like this project... I sure hope I can get a completely cross-platform build process working.
The text was updated successfully, but these errors were encountered: