-
Notifications
You must be signed in to change notification settings - Fork 652
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
env GOOS=windows GOARCH=amd64 go build uidemo.go #155
Comments
You also need to set three additional environment variables when building package ui:
For instance, on an Ubuntu system with the MinGW-w64 packages in universe it would be
The problem is that Go doesn't know how to cross compile cgo packages on its own; you have to tell it what compilers to use (and that you have those compilers in the first place). |
On 08/09/2016 03:25 AM, ringrid wrote:
To see all that information and the context in which you're getting the From there you can go into the temporary directory where it's trying to
|
@omac777 It's userful for me, and I had solved my question,It need other two packages: mingw64-gtk3 mingw64-winpthreads-static |
You should not need mingw64-gtk3. The Windows code does not use GTK+ at all. |
@andlabs yes, thank you. I removed mingw64-gtk3 and compiled succeed. awesome project! |
@andlabs
thanks. |
You need to set |
Thanks for your reply.
|
Same error here. Crosscompiling from Linux to Windows: $ export GOOS=windows vendor/github.com/andlabs/ui/libui_windows_amd64.a(stddialogs.cpp.obj): In function 'msgbox': |
You will need to upgrade to MinGW-w64 5.0. |
After upgraded MinGW-w64 to 6.3.0, The error |
How are you installing MinGW-w64? |
Oops, sorry, I double checked the README again, the |
Ah, all right. I do still hope that there aren't still versions of MinGW-w64 5.0 or newer without the patch... |
Merged with #279. |
@andlabs I've already set my GOOS variable to linux, and compiling for Windows from Windows does work correctly. You had previously mentioned these 3 steps for Linux -> Windows:
What would be the equivalent for Windows -> Linux? |
CGO_ENABLED is the same. CC and CXX are the names of the executables of the cross-compiler toolchain, whatever that is. Yes, that means you will need a separate cross-compiler toolchain. You will also need to have a pkg-config set up for it, and GTK+ available to link to it, and no, the Windows GTK+ will not work, it must be a Linux GTK+ prepared for use with the cross-compiler. I don't know how to do any of that; sorry. |
Thanks for the prompt reply, I appreciate the info. It seems it will probably be easier for me to just install these packages on my linux build and build the executable from there :). Thanks! |
Before I start, here is my go version 1.7beta2 environment:
go version
go version devel +fca9fc5 Thu Jun 16 19:45:33 2016 +0000 linux/amd64
go env
GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/loongson/Code"
GORACE=""
GOROOT="/home/loongson/go1.7beta2"
GOTOOLDIR="/home/loongson/go1.7beta2/pkg/tool/linux_amd64"
CC="gcc"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build780373348=/tmp/go-build -gno-record-gcc-switches"
CXX="g++"
CGO_ENABLED="1"
NOTE THE BUILDING NATIVELY WITH JUST go build works and with the following:
env GOOS=linux GOARCH=amd64 go build uidemo.go
GOOD.
CROSS-COMPILING TO WINDOWS 64-BIT HOWEVER FAILS.
It seems I have to be on windows in order for this to compile successfully.
env GOOS=windows GOARCH=amd64 go build uidemo.go
command-line-arguments
./uidemo.go:8: undefined: ui.Main
./uidemo.go:9: undefined: ui.NewEntry
./uidemo.go:10: undefined: ui.NewButton
./uidemo.go:11: undefined: ui.NewLabel
./uidemo.go:12: undefined: ui.NewVerticalBox
./uidemo.go:13: undefined: ui.NewLabel
./uidemo.go:17: undefined: ui.NewWindow
./uidemo.go:19: undefined: ui.Button
./uidemo.go:22: undefined: ui.Window
./uidemo.go:23: undefined: ui.Quit
./uidemo.go:23: too many errors
The text was updated successfully, but these errors were encountered: