I use the docker golang:1.22 for building my Go project for Windows x32/x64 and Linux x32/x64.
I have installed:
It has next versions:
Now I can build windows x32/x64 and linux x64, but I have a problem with linux i386.
Windows x32 (it works)
GOOS=windows GOARCH=386 CGO_ENABLED=1 CXX=i686-w64-mingw32-g++ CC=i686-w64-mingw32-gcc go build -o core_joint_x32.exe cmd/core/main.go
Windows x64 (it works)
GOOS=windows GOARCH=amd64 CGO_ENABLED=1 CXX=x86_64-w64-mingw32-g++ CC=x86_64-w64-mingw32-gcc go build -o core_joint_x64.exe cmd/core/main.go
Linux x64 (it works)
GOARCH=amd64 go build -o core_joint_x64 cmd/core/main.go
But I don't know, what compiler I should using, what flags for Linux i386 ...
Thank you for your answers!
I've found, this works:
GOARCH=386 CGO_ENABLED=1 CXX='g++ -m32' CC='gcc -m32' go build -o core_joint_i386 cmd/core/main.go