Copy link to clipboard
Copied
Hi all !
Trying to experiment with opencv. it's working fine but I can't succeed to compile it with the static libraries, it's still requiring the dylib files, which is not very useful for distribution. Can't find the answer on the interwebs
(I'm on Mac BTW. Haven't tried on Windows yet)
So I'm wondering if anyone here knows how to either:
A- Compile a plugin with opencv embeded in it (no need for the opencv dynamic libs)
or
B- How do you properly distribute a plugin that needs external libs ?
Thanks !
Gab
Hi Gab,
yes, it should be possible to compile and link the static OpenCV libraries, but it is quite a bit of work. You need to set several build switches (I think one of them was "NO_SHARED_LIBS", have all the needed internal helper libraries (png, tiff, etc.) also as static libs, etc.), but you should be able to make OpenCV libs that can be statically linked. Last time I tried it, it took me about a day to set all things up properly though, and I doubt things have changed much.
Apple discourages
...Copy link to clipboard
Copied
errr... that's a mommy question... Toby (reduxFX)
Copy link to clipboard
Copied
meaning ?
Copy link to clipboard
Copied
toby is knows WAY more about these issues than me.
Copy link to clipboard
Copied
Hi Gab,
yes, it should be possible to compile and link the static OpenCV libraries, but it is quite a bit of work. You need to set several build switches (I think one of them was "NO_SHARED_LIBS", have all the needed internal helper libraries (png, tiff, etc.) also as static libs, etc.), but you should be able to make OpenCV libs that can be statically linked. Last time I tried it, it took me about a day to set all things up properly though, and I doubt things have changed much.
Apple discourages the usage of statically linked libraries, but if you want to go the route with external/dynamic libs, it won't get that much easier, as you probably found out. The libs need to be placed in the correct lib folders so that the plugin/program can see them, but problems might arise if there are other versions of these libs are present on the user's system. Placing the files next to the actual plugin in the AE folder also did not work, if I remember correctly.
So, unfortunately no clear recommendation from my side, as for both approaches you will need time and nerves ![]()
Copy link to clipboard
Copied
Haha ok !
Thanks for your answer... so it confirms what i've been through in the last days/weeks.
already tried eveything I could with building opencv (SHARED_LIBS off and etc) .
In parallel, i've also started to code my plugin in native C/C++ instead of relying on opencv ... might actually be faster ![]()
Copy link to clipboard
Copied
For the record, it is actually possible. I managed to build static libs on MacOS for OpenCV 3.4.4 and also the brand-new OpenCV 4.0.0. Compilation is a bit tricky, as you have to find the right makefile parameters, especially since by default it comes with most of them set to active which might lead to problem since that requires for example the various neuronal network libraries to be already installed. Reducing it down to a basic feature set and then building it works.
Linking these static libraries in an Xcode project should be an easy task, but of course, it is not. Depending on your OS and compiler versions as well as a whole lot of dependencies, you might get a long list of weird error messages on compilation. Expect to spend a full afternoon with a sledgehammer to finally convince Xcode to cooperate, and then you are set.
If anyone has questions regarding this or needs help adapting OpenCV to a custom configuration, just drop me a line.
Cheers,
Toby / reduxFX
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more