Closed squaredice closed 6 years ago
How are you running the Linux build?
GOOS=linux CGO_ENABLED=1 CC=x86_64-w64-mingw32-gcc CXX=x86_64-w64-mingw32-g++ go build
You are trying to build Linux code with a Windows compiler. Remove the environment variables.
go build:
# github.com/andlabs/ui
/usr/bin/ld: github.com/andlabs/ui/libui_linux_amd64.a(libui-combined.o): relocation R_X86_64_32S against `.rodata' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: final link failed: Nonrepresentable section on output
collect2: error: ld returned 1 exit status
In that case, duplicate of #230.
Keep in mind that each individual gcc executable can only build for a single platform, so x86_64-w32-mingw-gcc
can only build 64-bit Windows binaries (that's what the MinGW part means), whereas just plain gcc
conventionally means it can only build binaries for whatever OS and architecture you are using.
Failed to create execution file on linux in docker container.
Container run with this command:
docker run -ti -v path/to/files:/go/src golang bash
, golang is official image with last golang version.go get -v -u github.com/andlabs/ui
works only like this:GOOS=windows CGO_ENABLED=1 CC=x86_64-w64-mingw32-gcc CXX=x86_64-w64-mingw32-g++ go get -v -u github.com/andlabs/ui
Execution files for windows builds normal by:
GOOS=windows CGO_ENABLED=1 CC=x86_64-w64-mingw32-gcc CXX=x86_64-w64-mingw32-g++ go build -ldflags -H=windowsgui
When try to change GOOS to linux got this:
Installed: libgtk-3-dev, mingw-w64
go env:
uname -a:
Linux 4b0d492ecd42 4.9.87-linuxkit-aufs #1 SMP Wed Mar 14 15:12:16 UTC 2018 x86_64 GNU/Linux