views:

87

answers:

1

I built the demo on my Ubuntu 10.04 using the headers found in this PPA and with the build_all.sh script found in the same directory as camshiftdemo.c. All I got is a Could not initialize capturing... message.

Then I tried to build it with this line (found it after building the demo with CMake in the building directory that CMake creates):

gcc  -Wall -Wno-long-long -pthread -ffunction-sections  -O3 -DNDEBUG  -fomit-frame-pointer -O3 -ffast-math -mmmx -msse -msse2 -msse3 -DNDEBUG camshiftdemo.c -o camshiftdemo -rdynamic -ldl -lm -lpthread -lrt /usr/lib/libcv.so.2.1.0 /usr/lib/libcxcore.so.2.1.0 /usr/lib/libhighgui.so.2.1.0 /usr/lib/libml.so.2.1.0 /usr/lib/libcvaux.so.2.1.0 /usr/lib/libhighgui.so.2.1.0 /usr/lib/libcv.so.2.1.0 /usr/lib/libml.so.2.1.0 /usr/lib/libcxcore.so.2.1.0 /usr/lib/libunicap.so.2.1.8 /usr/lib/libgstbase-0.10.so.0.24.1 /usr/lib/libgstreamer-0.10.so.0.24.1 /usr/lib/libxml2.so.2.7.6 -ldl -lm -lpthread -lrt 3rdparty/lib/libopencv_lapack.a 3rdparty/lib/libzlib.a 3rdparty/lib/libflann.a

You should copy "3rdparty" found in the building directory into the sample directory.

Notice that I included gstreamer, unicap and libxml2 libraries. That's what I found different whe comparing both elf builds (one with CMake) with /lib/ld-linux.so --list

Update: Below are the linking dependencies, both from the canonical CMake build and from my own build

CMake build

linux-vdso.so.1 =>  (0x00007fffdf3ff000)
libdl.so.2 => /lib/libdl.so.2 (0x00007f1ddda8b000)
libpthread.so.0 => /lib/libpthread.so.0 (0x00007f1ddd86e000)
librt.so.1 => /lib/librt.so.1 (0x00007f1ddd665000)
libcv.so.2.0 => /home/hellhound/projects/local/opencv/build/lib/libcv.so.2.0 (0x00007f1ddd1e6000)
libcxcore.so.2.0 => /home/hellhound/projects/local/opencv/build/lib/libcxcore.so.2.0 (0x00007f1ddcd3b000)
libhighgui.so.2.0 => /home/hellhound/projects/local/opencv/build/lib/libhighgui.so.2.0 (0x00007f1ddcafb000)
libml.so.2.0 => /home/hellhound/projects/local/opencv/build/lib/libml.so.2.0 (0x00007f1ddc890000)
libcvaux.so.2.0 => /home/hellhound/projects/local/opencv/build/lib/libcvaux.so.2.0 (0x00007f1ddc57c000)
libm.so.6 => /lib/libm.so.6 (0x00007f1ddc2f8000)
libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x00007f1ddbfe4000)
libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x00007f1ddbdcd000)
libc.so.6 => /lib/libc.so.6 (0x00007f1ddba49000)
/lib64/ld-linux-x86-64.so.2 => /lib/ld-linux-x86-64.so.2 (0x00007f1dddcad000)
libjpeg.so.62 => /usr/lib/libjpeg.so.62 (0x00007f1ddb825000)
libpng12.so.0 => /lib/libpng12.so.0 (0x00007f1ddb5fd000)
libz.so.1 => /lib/libz.so.1 (0x00007f1ddb3e6000)
libtiff.so.4 => /usr/lib/libtiff.so.4 (0x00007f1ddb184000)
libjasper.so.1 => /usr/lib/libjasper.so.1 (0x00007f1ddaf2c000)
libgtk-x11-2.0.so.0 => /usr/lib/libgtk-x11-2.0.so.0 (0x00007f1dda90a000)
libgdk-x11-2.0.so.0 => /usr/lib/libgdk-x11-2.0.so.0 (0x00007f1dda65d000)
libatk-1.0.so.0 => /usr/lib/libatk-1.0.so.0 (0x00007f1dda43b000)
libgio-2.0.so.0 => /usr/lib/libgio-2.0.so.0 (0x00007f1dda188000)
libpangoft2-1.0.so.0 => /usr/lib/libpangoft2-1.0.so.0 (0x00007f1dd9f5e000)
libgdk_pixbuf-2.0.so.0 => /usr/lib/libgdk_pixbuf-2.0.so.0 (0x00007f1dd9d41000)
libpangocairo-1.0.so.0 => /usr/lib/libpangocairo-1.0.so.0 (0x00007f1dd9b34000)
libcairo.so.2 => /usr/lib/libcairo.so.2 (0x00007f1dd9876000)
libpango-1.0.so.0 => /usr/lib/libpango-1.0.so.0 (0x00007f1dd962b000)
libfreetype.so.6 => /usr/lib/libfreetype.so.6 (0x00007f1dd93a5000)
libfontconfig.so.1 => /usr/lib/libfontconfig.so.1 (0x00007f1dd9170000)
libgobject-2.0.so.0 => /usr/lib/libgobject-2.0.so.0 (0x00007f1dd8f27000)
libgmodule-2.0.so.0 => /usr/lib/libgmodule-2.0.so.0 (0x00007f1dd8d23000)
libgthread-2.0.so.0 => /usr/lib/libgthread-2.0.so.0 (0x00007f1dd8b1e000)
libglib-2.0.so.0 => /lib/libglib-2.0.so.0 (0x00007f1dd883f000)
libgstbase-0.10.so.0 => /usr/lib/libgstbase-0.10.so.0 (0x00007f1dd8603000)
libgstreamer-0.10.so.0 => /usr/lib/libgstreamer-0.10.so.0 (0x00007f1dd832d000)
libxml2.so.2 => /usr/lib/libxml2.so.2 (0x00007f1dd7fdc000)
libunicap.so.2 => /usr/lib/libunicap.so.2 (0x00007f1dd7d87000)
libavcodec.so.52 => /usr/lib/libavcodec.so.52 (0x00007f1dd7327000)
libavutil.so.49 => /usr/lib/libavutil.so.49 (0x00007f1dd7117000)
libdc1394.so.22 => /usr/lib/libdc1394.so.22 (0x00007f1dd6ea3000)
libXext.so.6 => /usr/lib/libXext.so.6 (0x00007f1dd6c90000)
libXrender.so.1 => /usr/lib/libXrender.so.1 (0x00007f1dd6a86000)
libXinerama.so.1 => /usr/lib/libXinerama.so.1 (0x00007f1dd6883000)
libXi.so.6 => /usr/lib/libXi.so.6 (0x00007f1dd6672000)
libXrandr.so.2 => /usr/lib/libXrandr.so.2 (0x00007f1dd6469000)
libXcursor.so.1 => /usr/lib/libXcursor.so.1 (0x00007f1dd625f000)
libX11.so.6 => /usr/lib/libX11.so.6 (0x00007f1dd5f25000)
libXcomposite.so.1 => /usr/lib/libXcomposite.so.1 (0x00007f1dd5d22000)
libXdamage.so.1 => /usr/lib/libXdamage.so.1 (0x00007f1dd5b1f000)
libXfixes.so.3 => /usr/lib/libXfixes.so.3 (0x00007f1dd5918000)
libpcre.so.3 => /lib/libpcre.so.3 (0x00007f1dd56ea000)
libresolv.so.2 => /lib/libresolv.so.2 (0x00007f1dd54d0000)
libselinux.so.1 => /lib/libselinux.so.1 (0x00007f1dd52b2000)
libpixman-1.so.0 => /usr/lib/libpixman-1.so.0 (0x00007f1dd5045000)
libxcb-shm.so.0 => /usr/lib/libxcb-shm.so.0 (0x00007f1dd4e42000)
libxcb-render.so.0 => /usr/lib/libxcb-render.so.0 (0x00007f1dd4c39000)
libxcb.so.1 => /usr/lib/libxcb.so.1 (0x00007f1dd4a1b000)
libexpat.so.1 => /lib/libexpat.so.1 (0x00007f1dd47f2000)
libXv.so.1 => /usr/lib/libXv.so.1 (0x00007f1dd45eb000)
libdirac_encoder.so.0 => /usr/lib/libdirac_encoder.so.0 (0x00007f1dd4359000)
libfaac.so.0 => /usr/lib/libfaac.so.0 (0x00007f1dd4147000)
libfaad.so.2 => /usr/lib/libfaad.so.2 (0x00007f1dd3f05000)
libgsm.so.1 => /usr/lib/libgsm.so.1 (0x00007f1dd3cf7000)
libmp3lame.so.0 => /usr/lib/libmp3lame.so.0 (0x00007f1dd3a7f000)
libopencore-amrnb.so.0 => /usr/lib/libopencore-amrnb.so.0 (0x00007f1dd3844000)
libopencore-amrwb.so.0 => /usr/lib/libopencore-amrwb.so.0 (0x00007f1dd3628000)
libopenjpeg.so.2 => /usr/lib/libopenjpeg.so.2 (0x00007f1dd3408000)
libschroedinger-1.0.so.0 => /usr/lib/libschroedinger-1.0.so.0 (0x00007f1dd3188000)
libspeex.so.1 => /usr/lib/libspeex.so.1 (0x00007f1dd2f6e000)
libtheora.so.0 => /usr/lib/libtheora.so.0 (0x00007f1dd2d20000)
libvorbisenc.so.2 => /usr/lib/libvorbisenc.so.2 (0x00007f1dd2944000)
libvorbis.so.0 => /usr/lib/libvorbis.so.0 (0x00007f1dd2717000)
libx264.so.85 => /usr/lib/libx264.so.85 (0x00007f1dd2488000)
libxvidcore.so.4 => /usr/lib/libxvidcore.so.4 (0x00007f1dd2179000)
libraw1394.so.11 => /usr/lib/libraw1394.so.11 (0x00007f1dd1f6b000)
libusb-1.0.so.0 => /lib/libusb-1.0.so.0 (0x00007f1dd1d5c000)
libXau.so.6 => /usr/lib/libXau.so.6 (0x00007f1dd1b58000)
libXdmcp.so.6 => /usr/lib/libXdmcp.so.6 (0x00007f1dd1952000)
liboil-0.3.so.0 => /usr/lib/liboil-0.3.so.0 (0x00007f1dd16c1000)
libogg.so.0 => /usr/lib/libogg.so.0 (0x00007f1dd14ba000)

My build

linux-vdso.so.1 =>  (0x00007fff7c95a000)
libdl.so.2 => /lib/libdl.so.2 (0x00007f34aad74000)
libm.so.6 => /lib/libm.so.6 (0x00007f34aaaf1000)
libpthread.so.0 => /lib/libpthread.so.0 (0x00007f34aa8d3000)
librt.so.1 => /lib/librt.so.1 (0x00007f34aa6cb000)
libcv.so.2.1 => /usr/lib/libcv.so.2.1 (0x00007f34aa1c0000)
libcxcore.so.2.1 => /usr/lib/libcxcore.so.2.1 (0x00007f34a9d11000)
libhighgui.so.2.1 => /usr/lib/libhighgui.so.2.1 (0x00007f34a9ad5000)
libml.so.2.1 => /usr/lib/libml.so.2.1 (0x00007f34a986a000)
libcvaux.so.2.1 => /usr/lib/libcvaux.so.2.1 (0x00007f34a953c000)
libunicap.so.2 => /usr/lib/libunicap.so.2 (0x00007f34a92e7000)
libgstbase-0.10.so.0 => /usr/lib/libgstbase-0.10.so.0 (0x00007f34a90ab000)
libgstreamer-0.10.so.0 => /usr/lib/libgstreamer-0.10.so.0 (0x00007f34a8dd4000)
libxml2.so.2 => /usr/lib/libxml2.so.2 (0x00007f34a8a84000)
libc.so.6 => /lib/libc.so.6 (0x00007f34a8701000)
/lib64/ld-linux-x86-64.so.2 => /lib/ld-linux-x86-64.so.2 (0x00007f34aaf96000)
libtbb.so.2 => /usr/lib/libtbb.so.2 (0x00007f34a84da000)
libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x00007f34a81c6000)
libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x00007f34a7faf000)
libjpeg.so.62 => /usr/lib/libjpeg.so.62 (0x00007f34a7d8a000)
libpng12.so.0 => /lib/libpng12.so.0 (0x00007f34a7b63000)
libz.so.1 => /lib/libz.so.1 (0x00007f34a794c000)
libtiff.so.4 => /usr/lib/libtiff.so.4 (0x00007f34a76e9000)
libjasper.so.1 => /usr/lib/libjasper.so.1 (0x00007f34a7492000)
libgtk-x11-2.0.so.0 => /usr/lib/libgtk-x11-2.0.so.0 (0x00007f34a6e70000)
libgdk-x11-2.0.so.0 => /usr/lib/libgdk-x11-2.0.so.0 (0x00007f34a6bc2000)
libatk-1.0.so.0 => /usr/lib/libatk-1.0.so.0 (0x00007f34a69a1000)
libgio-2.0.so.0 => /usr/lib/libgio-2.0.so.0 (0x00007f34a66ee000)
libpangoft2-1.0.so.0 => /usr/lib/libpangoft2-1.0.so.0 (0x00007f34a64c3000)
libgdk_pixbuf-2.0.so.0 => /usr/lib/libgdk_pixbuf-2.0.so.0 (0x00007f34a62a7000)
libpangocairo-1.0.so.0 => /usr/lib/libpangocairo-1.0.so.0 (0x00007f34a609a000)
libcairo.so.2 => /usr/lib/libcairo.so.2 (0x00007f34a5ddb000)
libpango-1.0.so.0 => /usr/lib/libpango-1.0.so.0 (0x00007f34a5b91000)
libfreetype.so.6 => /usr/lib/libfreetype.so.6 (0x00007f34a590b000)
libfontconfig.so.1 => /usr/lib/libfontconfig.so.1 (0x00007f34a56d5000)
libgobject-2.0.so.0 => /usr/lib/libgobject-2.0.so.0 (0x00007f34a548d000)
libgmodule-2.0.so.0 => /usr/lib/libgmodule-2.0.so.0 (0x00007f34a5289000)
libgthread-2.0.so.0 => /usr/lib/libgthread-2.0.so.0 (0x00007f34a5083000)
libglib-2.0.so.0 => /lib/libglib-2.0.so.0 (0x00007f34a4da5000)
libavcodec.so.52 => /usr/lib/libavcodec.so.52 (0x00007f34a4345000)
libavformat.so.52 => /usr/lib/libavformat.so.52 (0x00007f34a404e000)
libavutil.so.49 => /usr/lib/libavutil.so.49 (0x00007f34a3e3f000)
libswscale.so.0 => /usr/lib/libswscale.so.0 (0x00007f34a3be2000)
libdc1394.so.22 => /usr/lib/libdc1394.so.22 (0x00007f34a396d000)
libbz2.so.1.0 => /lib/libbz2.so.1.0 (0x00007f34a375c000)
libXv.so.1 => /usr/lib/libXv.so.1 (0x00007f34a3555000)
libX11.so.6 => /usr/lib/libX11.so.6 (0x00007f34a321c000)
libXext.so.6 => /usr/lib/libXext.so.6 (0x00007f34a3009000)
libXrender.so.1 => /usr/lib/libXrender.so.1 (0x00007f34a2dff000)
libXinerama.so.1 => /usr/lib/libXinerama.so.1 (0x00007f34a2bfc000)
libXi.so.6 => /usr/lib/libXi.so.6 (0x00007f34a29eb000)
libXrandr.so.2 => /usr/lib/libXrandr.so.2 (0x00007f34a27e2000)
libXcursor.so.1 => /usr/lib/libXcursor.so.1 (0x00007f34a25d8000)
libXcomposite.so.1 => /usr/lib/libXcomposite.so.1 (0x00007f34a23d4000)
libXdamage.so.1 => /usr/lib/libXdamage.so.1 (0x00007f34a21d1000)
libXfixes.so.3 => /usr/lib/libXfixes.so.3 (0x00007f34a1fcb000)
libpcre.so.3 => /lib/libpcre.so.3 (0x00007f34a1d9c000)
libresolv.so.2 => /lib/libresolv.so.2 (0x00007f34a1b83000)
libselinux.so.1 => /lib/libselinux.so.1 (0x00007f34a1964000)
libpixman-1.so.0 => /usr/lib/libpixman-1.so.0 (0x00007f34a16f8000)
libxcb-shm.so.0 => /usr/lib/libxcb-shm.so.0 (0x00007f34a14f4000)
libxcb-render.so.0 => /usr/lib/libxcb-render.so.0 (0x00007f34a12eb000)
libxcb.so.1 => /usr/lib/libxcb.so.1 (0x00007f34a10ce000)
libexpat.so.1 => /lib/libexpat.so.1 (0x00007f34a0ea4000)
libdirac_encoder.so.0 => /usr/lib/libdirac_encoder.so.0 (0x00007f34a0c12000)
libfaac.so.0 => /usr/lib/libfaac.so.0 (0x00007f34a09ff000)
libfaad.so.2 => /usr/lib/libfaad.so.2 (0x00007f34a07be000)
libgsm.so.1 => /usr/lib/libgsm.so.1 (0x00007f34a05b0000)
libmp3lame.so.0 => /usr/lib/libmp3lame.so.0 (0x00007f34a0337000)
libopencore-amrnb.so.0 => /usr/lib/libopencore-amrnb.so.0 (0x00007f34a00fd000)
libopencore-amrwb.so.0 => /usr/lib/libopencore-amrwb.so.0 (0x00007f349fee1000)
libopenjpeg.so.2 => /usr/lib/libopenjpeg.so.2 (0x00007f349fcc0000)
libschroedinger-1.0.so.0 => /usr/lib/libschroedinger-1.0.so.0 (0x00007f349fa41000)
libspeex.so.1 => /usr/lib/libspeex.so.1 (0x00007f349f827000)
libtheora.so.0 => /usr/lib/libtheora.so.0 (0x00007f349f5d8000)
libvorbisenc.so.2 => /usr/lib/libvorbisenc.so.2 (0x00007f349f1fd000)
libvorbis.so.0 => /usr/lib/libvorbis.so.0 (0x00007f349efd0000)
libx264.so.85 => /usr/lib/libx264.so.85 (0x00007f349ed40000)
libxvidcore.so.4 => /usr/lib/libxvidcore.so.4 (0x00007f349ea32000)
libraw1394.so.11 => /usr/lib/libraw1394.so.11 (0x00007f349e823000)
libusb-1.0.so.0 => /lib/libusb-1.0.so.0 (0x00007f349e615000)
libXau.so.6 => /usr/lib/libXau.so.6 (0x00007f349e410000)
libXdmcp.so.6 => /usr/lib/libXdmcp.so.6 (0x00007f349e20a000)
liboil-0.3.so.0 => /usr/lib/liboil-0.3.so.0 (0x00007f349df79000)
libogg.so.0 => /usr/lib/libogg.so.0 (0x00007f349dd72000)
A: 

Well, I think I got it. The first thing I was doing wrong was using libraries of different versions (OpenCV 2.0 was the real target, not 2.1). Then, I forgot to include this -Wl,-rpath,/path/to/opencv/libs when compiling.

Now it is working as expected.

Jean-Pierre Chauvel
@Jean-Pierre Good for you.
karlphillip