Skip to content

cmd/link: statically compiling windows/amd64 binary on linux fails on 1.5 #13070

Closed
@jessfraz

Description

@jessfraz

Previously on go 1.4.3 this used to work:

export CC=x86_64-w64-mingw32-gcc
export CGO_ENABLED=1
export GOOS=windows
export GOARCH=amd64

go build -o bundles/1.9.0-dev/cross/windows/amd64/docker-1.9.0-dev.exe -a -tags 'netgo static_build sqlite_omit_load_extension apparmor selinux daemon journald btrfs_noversion libdm_no_deferred_remove' -installsuffix netgo -ldflags '-w -extldflags "-static" -extld=x86_64-w64-mingw32-gcc' ./docker

Now when trying to run the same thing I get:

# github.com/docker/docker/docker
/usr/local/go/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-623415307/000000.o' is incompatible with i386:x86-64 output
collect2: error: ld returned 1 exit status

That's a super gross command I know, but I can make a small go program and try to compile statically for windows on linux and see the same thing.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions