How to deploy application that depends on dynamic libraries?
Asked Answered
Z

2

9

I am developing an application that uses the GStreamer library. In order to ease deployment I would like to collect all the GStreamer libraries in a local bundle. For this I wrote a little script that does the following:

  • recursively traverse dependencies (using otool -L)
  • copy all dependencies to a local directory
  • make all the dependency paths relative to @executable_path (using install_name_tool)

(If you're interested you can have a look at the Ruby script.)

However, I'm now seeing runtime errors on the gst_init call:

(process:22843): GLib-GObject-CRITICAL **: gtype.c:2458: initialization assertion failed, use g_type_init() prior to this function

(process:22843): GLib-CRITICAL **: g_once_init_leave: assertion `initialization_value != 0' failed

These errors only occur if I use the localized libraries.


Are there certain 'common pitfalls' when it comes to using install_name_tool? Does anyone have an idea what I could be doing wrong? If you need to know certain details then feel free to ask.

Update
I changed a few things:

  • For the dependent libraries I now only change the dylib paths and not the id (only use install_name_tool -change and not install_name_tool -id).
  • For the main library I set the id value relative to the executable path (@executable_name/components/Video.dylib).

These two changes make it work. However it is not yet clear to me why it works. I have some trouble understanding the meaning of the "id" property. It seems to be identifier in the form of a pathname. Why did changing it for the dependent libraries cause runtime errors? I'll try to find answers to those questions with some further experimentation...

Zebe answered 22/1, 2010 at 17:14 Comment(3)
Could it be that you influence the load order for the respective dependencies by accident?Barbed
@gf: I don't think so, but I'll keep it in mind. I've made some progress, check the edit if you're interested.Zebe
Aren't you building an .app bundle?Wortman
V
1

maybe you should consider a static compilation of your code. this will attach your dependencies to your program much better

if you're using gcc just add -static

Vitkun answered 22/6, 2010 at 11:46 Comment(0)
G
0

GStreamer is a complex system, with a lot of dependencies. Using tools will find out shared libraries directly required by GStreamer, but they'll surely miss libraries loaded dynamically, configuration files, and also translation data.

This site probably contains some usefull info on creating a stand-alone GStreamer package, which could simplify the bundling prpcess.

Gene answered 27/6, 2010 at 22:31 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.