Have a look at: https://github.com/shadowmint/go-static-linking
The with-python branch statically links python into the final binary.

Basically, you have to build the library yourself (so you build a static
copy) and then link that using cgo.

The python branch sounds like it'd be especially relevant to your purpose,
as it invokes autotools to build python.

On Monday, June 17, 2013 4:11:09 AM UTC+8, Daniel Harper wrote:

Hi Sebastian,

Thanks for your reply.

I'm not sure how I would go about linking these libraries into my project,
I've never dealt with static linking before.

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
How would I go about statically linking them into my application (i.e.
what is the build command to do this?)
On Sunday, 16 June 2013 10:06:05 UTC+1, Sebastien Binet wrote:


On Sat, Jun 15, 2013 at 11:47 PM, Daniel Harper <djhar...@gmail.com>
I posted this on /r/golang and someone mentioned I might get some more help
from here.

My application depends on the following shared C libraries


As far as I'm aware you cannot statically compile these in with your go
binary (unless this has changed?)

My question is, what is the "best practise" for packaging these up with my
application so that it can run on other users machines? My current solution
is to bung them into a lib/ folder and launch my app with
LD_LIBRARY_PATHpointing to there (via a shell script)

I'm not sure if this is the proper way to go about things though? I'm
guessing the immediate suggestion would be to package the application up in
a .deb file and let the package manager take care of things - the
problem is
the runtime lib libglfw on apt-get is not compatible with the go library
go-gl/glfw as it requires the library to be compiled with a particular
I had the same question a few weeks ago:

note that for simple (?) C libraries, external linking should allow to
statically link your libraries into the go package, so you might not
have to deal with the .so drudgery.

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


Follow ups

Related Discussions

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



site design / logo © 2021 Grokbase