Ask Your Question

Revision history [back]

Problems with static OpenCV 2.4.3 and pkg-config

When i compile OpenCV with shared libraries enabled it works just fine, but when i disable shared libraries pkg-config is filled with the names of libaries, just the name, not the filenames:

pkg-config opencv --cflags --libs

gives:

-I/usr/local/include/opencv -I/usr/local/include  ... <*.a opencv libraries>  ...\\
swscale avutil avformat avcodec v4l1 dc1394 gstvideo-0.10 gstapp-0.10 xml2 gmodule-2.0
gstreamer-0.10 gstbase-0.10 gthread-2.0 glib-2.0 gobject-2.0 fontconfig freetype pango-1.0 
cairo gdk_pixbuf-2.0 pangocairo-1.0 pangoft2-1.0 gio-2.0 atk-1.0 gdk-x11-2.0 gtk-x11-2.0 
/usr/lib/x86_64-linux-gnu/libjasper.so /usr/lib/x86_64-linux-gnu/libtiff.so 
/usr/lib/x86_64-linux-gnu/libpng.so /usr/lib/x86_64-linux-gnu/libjpeg.so rt pthread m dl 
stdc++ /usr/lib/x86_64-linux-gnu/libz.so

As those are not valid -l options i get a gcc error file not found for each "library". I assumed that after the *.a static libraries were generated they wouldn't need their dependencies afterwards.

It seems to be a problem when one has only shared libraries of some dependencies. Do i need static libraries of every name appearing in the list? As i found by websearch static libraries, e.g. libgcc-static, are not entirely recommended anymore. Still, i need to create a standalone executable for linux. Any help is greatly appreciated.