Building 64bit Windows binary
botherder opened this issue · 3 comments
Currently building 64bit Windows binary raises some issues with architecture differences with Go's linker.
$GOPATH/pkg/tool/linux_amd64/link: running x86_64-w64-mingw32-gcc failed: exit status 1
/usr/bin/x86_64-w64-mingw32-ld: i386 architecture of input file `/tmp/go-link-888075984/000000.o' is incompatible with i386:x86-64 output
collect2: error: ld returned 1 exit status
Need to find the appropriate procedure to build 64bit successfully.
The object files that were produced by the Go compiler (e.g. /tmp/go-link-888075984/000000.o
) are for i386 and can't be linked with external objects and libraries that have been built for x86-64. You need to build both YARA and the Go bits for the same architecture: This is done for YARA by selecting the right compiler and passing the right prefix to configure --host=…
. And it is done for the Go code by setting both GOOS
and GOARCH
.
32bit: --host=i686-w64-mingw32
CC=i686-w64-mingw32-gcc
GOOS=windows
GOARCH=386
64bit: --host=x86_64-w64-mingw32
CC=x86_64-w64-mingw32-gcc
GOOS=windows
GOARCH=amd64`
I have some suggestions on how to improve the Makefile (and cut down the necessary build instructions in the process). Are you interested in a PR?