Ask Your Question

Problems with static OpenCV 2.4.3 and pkg-config

asked 2012-12-21 05:34:32 -0600

Tr8 gravatar image

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


-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/ /usr/lib/x86_64-linux-gnu/ 
/usr/lib/x86_64-linux-gnu/ /usr/lib/x86_64-linux-gnu/ rt pthread m dl 
stdc++ /usr/lib/x86_64-linux-gnu/

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.

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2012-12-24 06:25:10 -0600

Using pkg-config is not recommended way for using OpenCV library. Use cmake instead.

edit flag offensive delete link more


can you elaborate on this please? Why pkg-config is not recommended for using OpenCV?

andrey_dung gravatar imageandrey_dung ( 2013-10-04 14:32:03 -0600 )edit

Question Tools


Asked: 2012-12-21 05:34:32 -0600

Seen: 830 times

Last updated: Dec 24 '12