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

~
Doug.
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.


Thanks!

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>
wrote:
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
program.
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.

Ian
--
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

Previous

Related Discussions

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

People

Translate

site design / logo © 2021 Grokbase