Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fail to cross compile windows packages on linux #1051

Closed
alexbrainman opened this issue Aug 26, 2010 · 6 comments
Closed

fail to cross compile windows packages on linux #1051

alexbrainman opened this issue Aug 26, 2010 · 6 comments

Comments

@alexbrainman
Copy link
Member

What steps will reproduce the problem?
cd $GOROOT/src/pkg 
export GOOS=windows
make clean
./deps.bash
make install

What is the expected output?
all packages built into $GOROOT/pkg/$GOOS_$GOARCH

What do you see instead?
make[1]: Entering directory `/root/hg/go/src/libcgo'
quietgcc -m32 -g -O2 -fPIC -o windows_386.o -c windows_386.c
windows_386.c:6:21: error: windows.h: No such file or directory
windows_386.c:24: warning: implicit declaration of function '_beginthread'
make[1]: *** [windows_386.o] Error 1
make[1]: Leaving directory `/root/hg/go/src/libcgo'
make: *** [../libcgo.install] Error 2

What is your $GOOS?  $GOARCH?
GOOS=linux
GOARCH=386

Which revision are you using?  (hg identify)
c19d95f2753e tip

Please provide any additional information below.
Recent change http://golang.org/cl/1972046/ included libcgo and all go*
commands into pkg build, unfortunately, it is impossible to build libcgo on linux, as
none of mingw libs are present on average linux pc. Also, I don't want go*.exe windows
binaries (godoc.exe and gofmt.exe) built and installed into my $GOBIN on linux.
@rsc
Copy link
Contributor

rsc commented Aug 27, 2010

Comment 1:

The second part is easy: set $GOBIN to something else.

@alexbrainman
Copy link
Member Author

Comment 2:

Do you mean 
GOBIN=/tmp make clean deps install
?
Sure. Or I could just ignore the error message, these targets are last on dependency
list.
It just doesn't look right - I want to build windows specific libraries, why should I
care about libcgo or godoc.exe and gofmt.exe.

@adg
Copy link
Contributor

adg commented Sep 7, 2010

Comment 3:

Status changed to Accepted.

@alberts
Copy link
Contributor

alberts commented Dec 17, 2010

Comment 4:

This more or less works:
GOBIN=/tmp WINEARCH=win32 HOST_AR=i686-pc-mingw32-ar GOHOSTARCH=386
CC=i686-pc-mingw32-gcc GOOS=windows ^CARCH=386 MAKEFLAGS=-j1 ./make.bash
but it should be possible to do it without Wine.
Probably need to make a better plan for pkg/runtime/mkversion.

@alberts
Copy link
Contributor

alberts commented Dec 17, 2010

Comment 5:

Typo.
GOBIN=/tmp WINEARCH=win32 HOST_AR=i686-pc-mingw32-ar GOHOSTARCH=386
CC=i686-pc-mingw32-gcc GOOS=windows GOARCH=386 MAKEFLAGS=-j1 ./make.bash

@alexbrainman
Copy link
Member Author

Comment 6:

This http://code.google.com/p/go-wiki/wiki/WindowsCrossCompiling is as good as it is
going to get.

Status changed to Done.

@golang golang locked and limited conversation to collaborators Jun 24, 2016
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants