control: retitle -1 Enable CGO for MinGW platforms After tinkering a bit, I realize that enabling CGO for all supported architectures is not quite as easy as I initially thought. Sorry for the noise.
What is possible today, though, is enabling CGO for GOOS=windows, using the gcc-mingw-w64 compilers. With the patch below, the build system attempts to build CGO support for every architecture. It fails gracefully for architectures that cannot be built. ,---- | golang-1.3.3 $ find -name cgo.a | ./debian/golang-go/usr/lib/go/pkg/windows_386/runtime/cgo.a | ./debian/golang-go/usr/lib/go/pkg/windows_amd64/runtime/cgo.a | ./debian/golang-go/usr/lib/go/pkg/linux_386/runtime/cgo.a | ./debian/golang-go/usr/lib/go/pkg/netbsd_386/runtime/cgo.a | ./debian/golang-go/usr/lib/go/pkg/darwin_386/runtime/cgo.a | ./debian/golang-go/usr/lib/go/pkg/linux_amd64/runtime/cgo.a | ./debian/golang-go/usr/lib/go/pkg/netbsd_amd64/runtime/cgo.a | ./debian/golang-go/usr/lib/go/pkg/darwin_amd64/runtime/cgo.a | ./debian/golang-go/usr/lib/go/pkg/linux_amd64_race/runtime/cgo.a `---- The errors are: ,---- | *.arm: gcc: error: unrecognized command line option '-marm' | freebsd-amd64: pkg/runtime/cgo/gcc_freebsd_amd64.c:6:27: fatal error: sys/signalvar.h: No such file or directory | freebsd-i386: pkg/runtime/cgo/gcc_freebsd_386.c:6:27: fatal error: sys/signalvar.h: No such file or directory `---- To be honest, I am a bit surprised that cgo.a files could be built for netbsd and darwin. I did not bother to test whether the cgo support works at all on those architectures -- CGO_ENABLED should not be set for those as long as we don't have cross compiler support (which I doubt will happen any time soon...) However, I successfully built and tested Win32 and Win64 executables that were linked against C library code built using the same gcc-mingw-w64 compilers. Cheers, -Hilko diff --git a/debian/control.base b/debian/control.base index 99edc3b..c25ddba 100644 --- a/debian/control.base +++ b/debian/control.base @@ -7,7 +7,8 @@ Uploaders: Michael Stapelberg <[email protected]>, Tianon Gravi <[email protected]> Vcs-Browser: http://anonscm.debian.org/gitweb/?p=pkg-golang/golang.git Vcs-Git: git://anonscm.debian.org/pkg-golang/golang.git -Build-Depends: debhelper (>= 7.4.10), bison, ed, mawk | awk, perl, netbase +Build-Depends: debhelper (>= 7.4.10), bison, ed, mawk | awk, perl, netbase, + gcc-mingw-w64, Build-Depends-Indep: po-debconf Standards-Version: 3.9.3 Homepage: http://golang.org/ diff --git a/debian/rules b/debian/rules index d73e90f..4a6b19a 100755 --- a/debian/rules +++ b/debian/rules @@ -116,6 +116,12 @@ debian/build.stamp: -${FOR_GO_ARCH} \ export GOARCH=$$arch; \ export GOOS=$$os; \ + export CGO_ENABLED=1; \ + case "$$os-$$arch" in \ + windows-386) export CC_FOR_TARGET=i686-w64-mingw32-gcc ;; \ + windows-amd64) export CC_FOR_TARGET=x86_64-w64-mingw32-gcc ;; \ + *) unset CC_FOR_TARGET ;; \ + esac; \ cd src && bash ./make.bash --no-clean; \ [ "$$arch" = "amd64" ] && [ "$$os" = "linux" ] && $(GOBIN)/go install -race std; \ cd ..; \ -- To UNSUBSCRIBE, email to [email protected] with a subject of "unsubscribe". Trouble? Contact [email protected]

