-
-
Notifications
You must be signed in to change notification settings - Fork 55.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
OpenCV compilation as static library [Linux]. #5424
Comments
Once you start compiling OpenCV as static library, then you will need every single dependency also as a static library provided with it. That can be a pain in the ass believe me, but in some cases, there is indeed no other way. In this case this means you will need to provide a static build of libjpeg and libpng I guess. |
Yes i realize it after that i have to link all the dependencies. So i try to look up the *.pc file to simply add all links: This doesn't work. I project to compile the OpenCV library from source, do i should have all dependencies installed in this case, or are they contains | downloaded once you launch the make command ? |
There is simplified Makefile sample via Does it work for you? |
Thanks for the link. I must retry because i have a solid solution with the goal to not pollute the target-host system (the -lcv solution) and the linked Makefile is only adding --libs to the linking because the --static option from pkg-config does nothing with my configuration. Simply try the command On my system where i don't have the shared libraries installed and the |
BTW, Sample makefile works fine for me in this scenario:
|
OK thanks, I will try again to compile OpenCV as static library as soon as possible (holydays)... The goal is to get a GTK+3 compatible version of OpenCV because my packages-manager install it with GTK+2 support. And so you cannot compile a program with GTK+3 as GUI. And to distribute the program without pollute the target host with a library which will take prior because the the default order from $PATH is In the case the target host wants to use the package-manager version. |
I've compiled OpenCV as static library by downloading the source from github.
$ cmake WITH_GTK=ON WITH_GTK3=ON CMAKE_BUILD_TYPE=RELEASE BUILD_SHARED_LIBS=OFF .
so I get all the libraries as static and try to compile my program according following Makefile:
But it result in an error traceback: a linking problem (
dlsym linking
(ld) problem) related to the OpenCV dependencies (libjpeg
,libpng
, ...).I find the following solution to but it doesn't take the way of a static linking:
So I compile a C++ program with the python2
shared library
...Is it correct or it risk to fail if I distribute my program on others system as mine ?
I do it like this because I don't want to pollute the LIBPATH either the INCLUDEPATH from the target host.
The text was updated successfully, but these errors were encountered: