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:
otool -L
)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:
install_name_tool -change
and not install_name_tool -id
).@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...
The standard locations for dynamic libraries are ~/lib , /usr/local/lib , and /usr/lib . You may also place the . dylib file at a nonstandard location in your file system, but you must add that location to one of these environment variables: LD_LIBRARY_PATH.
Dynamic libraries are linked during the execution of the final executable. Only the name of the dynamic library is placed in the final executable. The actual linking happens during runtime, when both executable and library are placed in the main memory.
When dynamic linking is needed, the kernel bootstraps the dynamic linker (ELF interpreter), which initializes itself, and then loads the specified shared objects (unless already loaded). It then performs the necessary relocations, including the shared objects that the target shared object uses.
Linux uses the "ldd" command to show the libraries that are linked to an executable or another shared library: ldd prints the path to the library and some address after the =>.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With