I'm trying to create an unattended (and perhaps deterministic) build process for an application written in Go.
The idea is to use create a Dockerfile which installs all the prerequisites so it's easy to share the build process with others and doesn't require a real windows installation.
However I'm stuck trying to build a library that has C bindings.
I get this very non-descriptive error
C:\godev\src\github.com\obscuren\secp256k1-go>go build --work
WORK=C:\users\root\Temp\go-build287695705
# _/C_/godev/src/github.com/obscuren/secp256k1-go
copying $WORK\_\C_\godev\src\github.com\obscuren\secp256k1-go\_obj\_cgo_defun.8 to $WORK\_\C_\godev\src\github.com\obscuren\secp256k1-go.a: write $WORK\_\C_\godev\src\github.com\obscuren\secp256k1-go.a: Access denied.
A full log with -x can be found here.
I can build this library on OS X and a 'real' Windows installation just fine.
Any help would be appreciated.
Edit:
Using the outline by OneofOne also gives me some errors.
# runtime/cgo
pkg/runtime/cgo/cgo.go:26:46: fatal error: sys/types.h: No such file or directory.
compilation terminated.
Initially I got this error when enabling cross-compiling for Go. I overcame that by installing gcc-multilib. The next problem is the following.
# runtime/cgo
gcc: error: unrecognized command line option ‘-mthreads’
Googling for this error results in two hits which are not useful to my user-case. I'm hoping anybody experienced this before.
Edit 2:
Not sure yet what solved it but I did
apt-get install gcc-multilib
apt-get install gcc-mingw-w64
And used
GOOS=windows GOARCH=386 CGO_ENABLED=1 CXX_FOR_TARGET=i686-w64-mingw32-g++ CC_FOR_TARGET=i686-w64-mingw32-gcc ./make.bash
Now I'm a step further. :)