FAQ
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.

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

Daniel,

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

http://www.reddit.com/r/golang/comments/1getcx/how_to_package_my_application/
My application depends on the following shared C libraries

libglfw
libglew

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
target.
I had the same question a few weeks ago:
https://groups.google.com/d/msg/golang-nuts/k3EXZ7nsrps/vo5wJMDGcawJ

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.

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

Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 5 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