[Docker-maint] Bug#776401: [Pkg-golang-devel] Bug#776401: Bug#776401: src:golang: Set CGO_ENABLED for all platforms

Tianon Gravi tianon at debian.org
Wed Feb 3 07:22:32 UTC 2016


On 7 March 2015 at 09:21, Hilko Bengen <bengen at debian.org> wrote:
> As far as I can see, it does not. The only notable change is that
> cgo.a files are installed for more than one architecture.
>
>> Also, what's the impact on the future Go 1.5, especially the new,
>> simpler cross-compile[1] that no longer requires rebuilding the entire
>> standard library and toolchain up front like we do currently?
>
> I haven't really looked at what will become Go 1.5. Dave Cheney
> specifically writes that CGO-related things are out of scope of that
> article.

Now that 1.5 is actually out and in the archive (with significantly
simpler package layout -- only three binary packages instead of one
per os-arch combo), I've made some time to give this a whirl, and I
managed to get it working with the package as-is.

Here's the Go file I used to test:

package main

// #include <stdio.h>
import "C"

func main() {
C.fopen(C.CString("test.txt"), C.CString("r"))
}

Saved as "main.go", and compiled via "go build main.go" (on "linux/amd64").

The environment variables I set are as follows:

export GOOS="windows"
export GOARCH="386"
export CGO_ENABLED="1"
export CC="i686-w64-mingw32-gcc"
export CXX="i686-w64-mingw32-g++"

I'm not positive whether all were required for this to work, but given
that it _did_ work, I think this is in the realm of possible with the
changes of Go 1.5 and am inclined to close this bug as "fixed" --
thoughts? :)

♥,
- Tianon
  4096R / B42F 6819 007F 00F8 8E36  4FD4 036A 9C25 BF35 7DD4




More information about the Docker-maint mailing list