The thing is that Essentia uses a lot of audio libraries. Ive tried to design the addon so you dont need to install all the libraries in the system, but Im having some problems with the dylib files.
When trying to run examples in a pc with no libraries install on the system this error shows:
dyld: Library not loaded: /usr/local/Cellar/ffmpeg/2.1.4/lib/libavfilter.3.dylib
Referenced from: /usr/lib/libavdevice.55.5.100.dylib
Reason: image not found
(lldb)
It seems to be searching the libraries in the systems directory.
Does anyone know if its possible to link this libraries from the addon directory without need to install them on the system?
Hi mattfelsen, thanks for the info, I think it solves my problem.
The thing i was wondering is if it is possible to use dynamic libraries (dylib files) in an Easy to Use addon.
The issue is that you need to install de Essentia libraries and dependencies in the system in order to use the addon. (Xcode project is linked to /usr/local/libs)
I wanted library files in the addon directory to avoid Essentia installation, but if its complicated to link them in every new project maybe its better to leave as it is.
Oh, sorry, I thought you were trying to link against a library installed on the user’s system (in /Library/Frameworks for example), but now I see you mean that you want to package the library with the addon so that the user doesn’t have to install anything other than the addon itself.
It is definitely possible to package the pre-compiled libraries. Generally libs for OF addons are compiled as static (.a) rather than dynamic (.dylib, .dll) – I’m not sure if there’s a reason behind that or it’s just become the norm – but I don’t see why you couldn’t package them as dynamic libs as well. There’s info here on the file structure to use to package libs for multiple platforms, and a nice example:
Sorry to re-open this old thread.
I am trying to use a dynamic library (.dylib) on osx and I am not sure how to write a proper addon_config.mk.
Could someone give me an example how to do this? I did not find any documentation dealing with dynamic libraries. Using a static lib is not an option.
dyld: Library not loaded: @rpath/libndi.dylib
Referenced from: /Users/thomasgeissl/projects/dlr/openFrameworks/addons/ofxNDI/example-receiveVideo/bin/example-receiveVideo_debug.app/Contents/MacOS/example-receiveVideo_debug
Reason: image not found
I am using Qt creator, 0.9.8. and/or the makefiles.
I tried adding ADDON_LDFLAGS += -lndi -L/path/to/lib
and ADDON_LIBS += /path/to/lib/libndi.dylib
Thanks @theo, it works fine when generating the project via the project generator and using xcode. But qt creator and the makefiles did not work. i will check the link you have provided.
Now it works when i run the app from xcode, but if i simply double click it in finder, it gives me the same error i get when i compile it with the make files. i try to fix this next week, if anyone has a solution please let me know.
Thanks
Thomas
I’m running into a very similar situation.
I’m trying to put together a very basic addon that uses a .dylib on OSX.
I’ve used ADDON_LDFLAGS to set the addons relative path to the .dylib file,
but when I run otool -L on the executable I can see it’s still linking against the absolute system path (/usr/local/lib) instead of the of addon relative path.
Any tips on setting up addon_config.mk to link against an addon local .dylib instead of a system one ?
This is absolutely one of pain when we make addon for OSX with dylib.
For standalone app package, we need to copy dylib and use install_name_tool.
(following is how oF manage libfmod.dylib in Xcode project ->Run Script phase)
Another option is this simple but super cool tool dylibbundler
dylibbundler automatically resolves shared lib dependency and copy dylib to inside of .app package. I tested and works amazing.
hey @hrs, I am getting crashes (quits unexpectedly in another machine) when open the app too.
If I add my signing i get the error too:
/Users/myUser/Documents/openFrameworks/apps/19/ReceptiveCube/bin/ReceptiveCube.app: code object is not signed at all
In subcomponent: /Users/myUser/Documents/openFrameworks/apps/19/ReceptiveCube/bin/ReceptiveCube.app/Contents/Frameworks/libfmodex.dylib
Command /usr/bin/codesign failed with exit code 1
I installed dylibbundler like you said.
So we need to comment the Xcode project -> (build phases) Run Script phase lines and the to apply the dylibbundler command. That’s right?
Btw I tried with and without commenting too… and then I applied the command. It shows the error, but outside Xcode I can run the script to add the lib. But stills not working in another machine.
If app runs on your machine but does not run in another machine, I think it is because of translocation. Try to search this forum with keyword “translocation”.