-
Notifications
You must be signed in to change notification settings - Fork 896
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
Cross Compilation(Linux->Win) error #228
Comments
i have same problem.
|
Same problem. |
I may have fixed this in Go 1.13. At least it works when cross compiling from Linux to Windows. env GOOS=windows \
GOARCH=amd64 \
CGO_ENABLED=1 \
CC=x86_64-w64-mingw32-gcc-posix \
CXX=x86_64-w64-mingw32-g++-posix \
CGO_CFLAGS="`go env CGO_CFLAGS` -I/usr/local/x86_64-w64-mingw32/include" \
CGO_LDFLAGS="`go env CGO_LDFLAGS` -L/usr/local/x86_64-w64-mingw32/lib -L/usr/local/x86_64-w64-mingw32/lib" \
go build -x -trimpath -ldflags="-w -s -extldflags -static" But first you have to install zlib from source. |
Thanks for your feedback; I cannot answer every question because time is limited, other features and projects are being developing, and the computer equipment and environment configuration are different. |
hey guys, after some research and a lot of waste of time, finally is running for me. sudo apt-get install gcc-multilib
sudo apt-get install gcc-mingw-w64 Created a file: winbuild.sh with following content: #!/bin/bash
export GOOS=windows
export GOARCH=386
export CC=i686-w64-mingw32-gcc
export CXX=i686-w64-mingw32-g++
export CGO_ENABLED=1
export CGO_CXXFLAGS="-static-libgcc -static-libstdc++ -Wl,-Bstatic -lstdc++ -lpthread -Wl,-Bdynamic"
go build -ldflags "-s -w -X main.version=$2" -o $3 -v -x $1 how to use: Need to attach a zlib1.dll when you make zip or installer. References:
I hope that help someone. |
Description
...
The text was updated successfully, but these errors were encountered: