Re: [go-nuts] cross-compilation for go-gl applications

2017-01-23 Thread Aram Hăvărneanu
Those packages use cgo, so you will need a gcc-based toolchain for
your target platform. Either you will have to build it yourself
(doing that on Windows is probably challenging), or perhaps you can
find a prebuilt gcc (good luck with that). Make sure to install the
relevant OpenGL headers and libraries for your target and that your
cross-compiler can find them.

Then you can just do something like (substitute for your target):

CGO_ENABLED=1 CC=sparcv9-solaris2.12-gcc GOOS=solaris GOARCH=sparc64 go
build foo

Depending on a few other factors you might or might not need to
explicitely set internal or external linking.

CGO_ENABLED=1 CC=sparcv9-solaris2.12-gcc GOOS=solaris GOARCH=sparc64 go
build -ldflags='-linkmode=external' foo

If I were you, I would rather find a way to build natively.

-- 
Aram Hăvărneanu

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[go-nuts] cross-compilation for go-gl applications

2017-01-22 Thread Mads Horndrup
Hi guys, I hope I'm posting this in the appropiate forum. It's difficult to 
find this kind of go-gl documentation.

I'm new to golang, but I'm experienced with OpenGL, usually through java 
wrappers. I'm using go-gl to access OpenGL through Go. I'm on a windows 10, 
64-bit

For go-gl applications, how would cross-compilation work?

I read here 

 that 
cross-compilation got better in go 1.5, and that now we can do this

env GOOS=darwin GOARCH=386 go build hello.go


^Sidequestion: What do I have to do to make this work in the windows cmd?

To get go-gl installed I just ran *go get* on these (while having a 64-bit 
windows gcc in path):
"github.com/go-gl/gl/v4.1-core/gl"
"github.com/go-gl/glfw/v3.2/glfw"
"github.com/go-gl/mathgl/mgl32"
The gcc requirement makes me think the compiled go-gl application will 
somehow be tied to my system and arch. 

Is it possible to build for other platforms than the one I have compiled it 
on? How does the gcc affect how my application can be cross-platform?

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.