For what it's worth, OSX plays perfectly well, as does windows.
You just have to build static instances of the libraries yourself.

On Wednesday, June 19, 2013 5:54:12 AM UTC+8, Daniel Harper wrote:

Hi Ian,

Your solution worked for Linux hosts, I now prefix the build command with

CGO_LDFLAGS="-Wl,-Bstatic -lGLEW -lglfw -Wl,-Bdynamic" go build -a ...

and both libraries get statically linked into the binary. Which is awesome!

This solution doesn't appear to work on OSX though, however I've read that OSX doesn't play nice with this sort of stuff anyway, so going down the shell script + dylib route will have to suffice.


On Sunday, 16 June 2013 23:39:31 UTC+1, Ian Lance Taylor wrote:

On Sun, Jun 16, 2013 at 1:11 PM, Daniel Harper <djhar...@gmail.com>
I'm not sure how I would go about linking these libraries into my project,
I've never dealt with static linking before.
Static linking is just like shared linking. You need a .a file rather
than a .so file. If you don't have a .a file, then you can't use
static linking.
Basically my current "solution" is to have a lib folder next to my
executable with the .so files in them (libglfw.so, libGLEW.so) and run a
shell script to set LD_LIBRARY_PATH to this lib dir when running the
Sounds about right.
How would I go about statically linking them into my application (i.e. what
is the build command to do this?)
I'm assuming you currently have something like CGO_LDFLAGS = -lglfw
-lglew. Change that to -Wl,-Bstatic -lglfw -lglew -Wl,-Bdynamic .
Again, this will only work if you have the .a files.

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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Search Discussions

Discussion Posts


Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 7 of 7 | next ›
Discussion Overview
groupgolang-nuts @
postedJun 15, '13 at 9:47p
activeJun 19, '13 at 6:44a



site design / logo © 2021 Grokbase