LinuxQuestions.org
Go Job Hunting at the LQ Job Marketplace
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices



Reply
 
Search this Thread
Old 12-22-2012, 07:28 PM   #1
Z038
Member
 
Registered: Jan 2006
Distribution: Slackware
Posts: 805

Rep: Reputation: 158Reputation: 158
Problem building openCV 2.4.0 on 13.37


I'm having a problem building openCV 2.4.0 on 13.37. There are warnings issued for libopenjpeg and libx264.

Code:
cd /mnt/bk/buildtmp/SBo/OpenCV-2.4.0/build/modules/core && /usr/bin/cmake -E cmake_link_script CMakeFiles/opencv_perf_core.dir/link.txt --verbose=1
/usr/bin/c++   -O2 -march=i486 -mtune=i686  -Wall -pthread -march=i686 -fomit-frame-pointer -msse -msse2 -mfpmath=sse -ffunction-sections -O3 -DNDEBUG   -DNDEBUG      CMakeFiles/opencv_perf_core.dir/perf/perf_convertTo.cpp.o CMakeFiles/opencv_perf_core.dir/perf/perf_main.cpp.o CMakeFiles/opencv_perf_core.dir/perf/perf_dft.cpp.o CMakeFiles/opencv_perf_core.dir/perf/perf_precomp.cpp.o CMakeFiles/opencv_perf_core.dir/perf/perf_abs.cpp.o CMakeFiles/opencv_perf_core.dir/perf/perf_dot.cpp.o CMakeFiles/opencv_perf_core.dir/perf/perf_arithm.cpp.o CMakeFiles/opencv_perf_core.dir/perf/perf_split.cpp.o CMakeFiles/opencv_perf_core.dir/perf/perf_bitwise.cpp.o CMakeFiles/opencv_perf_core.dir/perf/perf_minmaxloc.cpp.o CMakeFiles/opencv_perf_core.dir/perf/perf_norm.cpp.o CMakeFiles/opencv_perf_core.dir/perf/perf_math.cpp.o CMakeFiles/opencv_perf_core.dir/perf/perf_merge.cpp.o CMakeFiles/opencv_perf_core.dir/perf/perf_reduce.cpp.o CMakeFiles/opencv_perf_core.dir/perf/perf_stat.cpp.o CMakeFiles/opencv_perf_core.dir/perf/perf_compare.cpp.o  -o ../../bin/opencv_perf_core -rdynamic ../../lib/libopencv_core.so.2.4.0 ../../lib/libopencv_ts.so.2.4.0 ../../lib/libopencv_highgui.so.2.4.0 -ldl -lm -lpthread -lrt ../../lib/libopencv_core.so.2.4.0 -lz -ldl -lm -lpthread -lrt -Wl,-rpath,/mnt/bk/buildtmp/SBo/OpenCV-2.4.0/build/lib -Wl,-rpath-link,/mnt/bk/buildtmp/SBo/OpenCV-2.4.0/build/lib 
/usr/lib/gcc/i486-slackware-linux/4.5.2/../../../../i486-slackware-linux/bin/ld: warning: libopenjpeg.so.1.3, needed by /usr/lib/libavcodec.so.52, not found (try using -rpath or -rpath-link)
/usr/lib/gcc/i486-slackware-linux/4.5.2/../../../../i486-slackware-linux/bin/ld: warning: libx264.so.67, needed by /usr/lib/libavcodec.so.52, not found (try using -rpath or -rpath-link)
/usr/lib/libavcodec.so.52: undefined reference to `x264_encoder_close'
/usr/lib/libavcodec.so.52: undefined reference to `x264_encoder_headers'
/usr/lib/libavcodec.so.52: undefined reference to `opj_setup_decoder'
/usr/lib/libavcodec.so.52: undefined reference to `x264_encoder_encode'
/usr/lib/libavcodec.so.52: undefined reference to `x264_encoder_open'
/usr/lib/libavcodec.so.52: undefined reference to `opj_image_destroy'
/usr/lib/libavcodec.so.52: undefined reference to `opj_cio_open'
/usr/lib/libavcodec.so.52: undefined reference to `opj_decode_with_info'
/usr/lib/libavcodec.so.52: undefined reference to `opj_set_event_mgr'
/usr/lib/libavcodec.so.52: undefined reference to `x264_nal_encode'
/usr/lib/libavcodec.so.52: undefined reference to `x264_param_default'
/usr/lib/libavcodec.so.52: undefined reference to `opj_set_default_decoder_parameters'
/usr/lib/libavcodec.so.52: undefined reference to `opj_destroy_decompress'
/usr/lib/libavcodec.so.52: undefined reference to `opj_cio_close'
/usr/lib/libavcodec.so.52: undefined reference to `opj_create_decompress'
collect2: ld returned 1 exit status
make[2]: *** [bin/opencv_perf_core] Error 1
make[2]: Leaving directory `/mnt/bk/buildtmp/SBo/OpenCV-2.4.0/build'
make[1]: *** [modules/core/CMakeFiles/opencv_perf_core.dir/all] Error 2
make[1]: Leaving directory `/mnt/bk/buildtmp/SBo/OpenCV-2.4.0/build'
make: *** [all] Error 2
It says that libavcodec.so.52 needs libopenjpeg.so.1.3 and libx264.so.67.

What I have installed is the following:

Code:
$ ls -al /usr/lib/libopenjpeg.so
lrwxrwxrwx 1 root root 18 Dec 22 12:45 /usr/lib/libopenjpeg.so -> libopenjpeg.so.1.4*
$
$ ls -al /usr/lib/libx264.so
lrwxrwxrwx 1 root root 14 Dec 22 12:09 /usr/lib/libx264.so -> libx264.so.118*
I'm trying to install opencv so it can be linked with ffmpeg 0.8.7. ffmpeg includes libavcodec. Is the problem that the version of libavcodec I have from my previous install of ffmpeg several years ago is too old to link in with opencv?

Can anyone suggest how might I resolve this?
 
Old 12-22-2012, 07:37 PM   #2
willysr
Senior Member
 
Registered: Jul 2004
Location: Jogja, Indonesia
Distribution: Slackware-Current
Posts: 2,635

Rep: Reputation: 450Reputation: 450Reputation: 450Reputation: 450Reputation: 450
try with newer ffmpeg available on AlienBOB's repository
 
Old 12-23-2012, 12:04 AM   #3
Z038
Member
 
Registered: Jan 2006
Distribution: Slackware
Posts: 805

Original Poster
Rep: Reputation: 158Reputation: 158
I'm planning on installing ffmpeg 0.8.7 from slackbuilds.org, and including opencv in the build, as described on the slackbuilds.org page for ffmpeg. It says:

Code:
You can enable a lot of optional (not-autodetected) features by
passing variables to the script (VAR=yes/no ./ffmpeg.SlackBuild):
CELT=yes|no (default: no), requires celt
DC1394=yes|no (default: no), requires libdc1394
DIRAC=yes|no (default: no), requires dirac
FAAC=yes|no (default: no), requires faac (creates non-redistributable binary)
FREI0R=yes|no (default: no), requires frei0r
GSM=yes|no (default: no), requires gsm
JP2=yes|no (default: no), requires openjpeg
LAME=yes|no (default: yes), requires lame
OPENCV=yes|no (default: no), requires opencv
OPENCORE=yes|no (default: no), requires opencore-amr
RTMP=yes|no (default: no), requires rtmpdump
SCHROEDINGER=yes|no (default: no), requires schroedinger
SPEEX=yes|no (default: no), requires speex
VPX=yes|no (default: no), requires libvpx
X264=yes|no (default: yes), requires x264
XVID=yes|no (default: no), requires xvidcore
So I need to install opencv before I can install ffmpeg with the OPENCV=YES variable. But I need to first install a newer ffmpeg without opencv so that I can subsequently install opencv. It seems like a catch-22.

Last edited by Z038; 12-23-2012 at 12:53 PM.
 
Old 12-23-2012, 01:05 AM   #4
Z038
Member
 
Registered: Jan 2006
Distribution: Slackware
Posts: 805

Original Poster
Rep: Reputation: 158Reputation: 158
I built ffmpeg from the slackbuild with OPENCV=NO, and that worked. Then I built OpenCV from the slackbuild, and it worked too. Then I tried building ffmpeg again, this time with the OPENCV=yes variable passed to the slackbuild script, and it failed.

This is from config.log:

Code:
gcc -D_ISOC99_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 -O2 
-march=i486 -mtune=i686 -I/usr/include/openjpeg-1.4 -std=c99 -fomit-frame-pointer -pthread -I/usr/include/dirac 
-I/usr/include/opencv /usr/lib/libopencv_calib3d.so /usr/lib/libopencv_contrib.so /usr/lib/libopencv_core.so 
/usr/lib/libopencv_features2d.so /usr/lib/libopencv_flann.so /usr/lib/libopencv_gpu.so /usr/lib/libopencv_highgui.so 
/usr/lib/libopencv_imgproc.so /usr/lib/libopencv_legacy.so /usr/lib/libopencv_ml.so /usr/lib/libopencv_nonfree.so 
/usr/lib/libopencv_objdetect.so /usr/lib/libopencv_photo.so /usr/lib/libopencv_stitching.so /usr/lib/libopencv_ts.so 
/usr/lib/libopencv_video.so /usr/lib/libopencv_videostab.so -c -o /tmp/ffconf.XXPh9SQF.o /tmp/ffconf.XXT2JxbG.c
gcc: /usr/lib/libopencv_calib3d.so: linker input file unused because linking not done
gcc: /usr/lib/libopencv_contrib.so: linker input file unused because linking not done
gcc: /usr/lib/libopencv_core.so: linker input file unused because linking not done
gcc: /usr/lib/libopencv_features2d.so: linker input file unused because linking not done
gcc: /usr/lib/libopencv_flann.so: linker input file unused because linking not done
gcc: /usr/lib/libopencv_gpu.so: linker input file unused because linking not done
gcc: /usr/lib/libopencv_highgui.so: linker input file unused because linking not done
gcc: /usr/lib/libopencv_imgproc.so: linker input file unused because linking not done
gcc: /usr/lib/libopencv_legacy.so: linker input file unused because linking not done
gcc: /usr/lib/libopencv_ml.so: linker input file unused because linking not done
gcc: /usr/lib/libopencv_nonfree.so: linker input file unused because linking not done
gcc: /usr/lib/libopencv_objdetect.so: linker input file unused because linking not done
gcc: /usr/lib/libopencv_photo.so: linker input file unused because linking not done
gcc: /usr/lib/libopencv_stitching.so: linker input file unused because linking not done
gcc: /usr/lib/libopencv_ts.so: linker input file unused because linking not done
gcc: /usr/lib/libopencv_video.so: linker input file unused because linking not done
gcc: /usr/lib/libopencv_videostab.so: linker input file unused because linking not done
gcc -Wl,--as-needed -I/usr/include/opencv /usr/lib/libopencv_calib3d.so /usr/lib/libopencv_contrib.so 
/usr/lib/libopencv_core.so /usr/lib/libopencv_features2d.so /usr/lib/libopencv_flann.so /usr/lib/libopencv_gpu.so 
/usr/lib/libopencv_highgui.so /usr/lib/libopencv_imgproc.so /usr/lib/libopencv_legacy.so /usr/lib/libopencv_ml.so 
/usr/lib/libopencv_nonfree.so /usr/lib/libopencv_objdetect.so /usr/lib/libopencv_photo.so /usr/lib/libopencv_stitching.so 
/usr/lib/libopencv_ts.so /usr/lib/libopencv_video.so /usr/lib/libopencv_videostab.so -o /tmp/ffconf.XX7WUBhG 
/tmp/ffconf.XXPh9SQF.o -lopencore-amrwb -lopencore-amrnb -lmp3lame -lfaac -ldirac_encoder -ldirac_decoder -lm -lstdc++ 
-ldc1394 -lcelt0 -lm -pthread -lbz2 -lz
/tmp/ffconf.XXPh9SQF.o: In function `check_cvCreateImageHeader':
ffconf.XXT2JxbG.c:(.text+0x1): undefined reference to `cvCreateImageHeader'
collect2: ld returned 1 exit status
ERROR: opencv not found
The OpenCV package is installed. What is the meaning of the "linker input file unused because linking not done" messages?
 
Old 12-23-2012, 01:41 AM   #5
Z038
Member
 
Registered: Jan 2006
Distribution: Slackware
Posts: 805

Original Poster
Rep: Reputation: 158Reputation: 158
Ok, I found that the "linker input file unused because linking not done" message is because of the -c flag on the gcc command. And I don't think that's necessarily a problem.

The undefined reference to cvCreateImageHeader may be more of an issue. Why the "ERROR: opencv not found"? It's definitely installed.
 
Old 12-23-2012, 12:46 PM   #6
Z038
Member
 
Registered: Jan 2006
Distribution: Slackware
Posts: 805

Original Poster
Rep: Reputation: 158Reputation: 158
Apparently the problem has to do with the way the linker parms are generated with the "-Wl,--as-needed" flag.

I found a thread on the ffmpeg listserv where someone else had this problem. It starts here https://lists.ffmpeg.org/pipermail/f...ne/007527.html, and a later post points here http://thread.gmane.org/gmane.comp.v...45/focus=39448 and here http://code.opencv.org/issues/2110 and finally here in this thread that talks about ToolChain DSOlinking http://wiki.debian.org/ToolChain/DSOLinking.

I gather from the discussions that I need to add a "--no-as-needed" flag somewhere in the ffmpeg configure file to get around this problem, but the discussion is all over my head.

I see this in the ffmpeg configure file that I think is what causes the generation of the commands that fail:

Code:
enabled libopencv  && require_pkg_config opencv opencv/cxcore.h cvCreateImageHeader
I also see this in the configure script, but I'm not sure what it does or what its scope is:

Code:
check_ldflags -Wl,--as-needed
Any ideas where I would add the -Wl,--no-as-needed flag for the link of opencv?
 
Old 12-23-2012, 02:06 PM   #7
irgunII
Member
 
Registered: Jan 2012
Location: Directly above the center of the earth
Distribution: Slackware. There's something else?
Posts: 383

Rep: Reputation: 71
If it's any consolation, opencv doesn't get found in the ffmpeg for 14.0 either. I used all osrts of others' ffmpeg builds including the one on slackbuilds, and even used the 1.0.x ffmpeg, but *that* one said it couldn't find jpeg (or something like that). I was really hoping to have the opencv as in an app or two I've been following a few users have said it's really helping in lowering mpeg file sizes and such or something to that effect.
 
Old 12-23-2012, 02:12 PM   #8
Z038
Member
 
Registered: Jan 2006
Distribution: Slackware
Posts: 805

Original Poster
Rep: Reputation: 158Reputation: 158
I am glad to hear that I'm not the only one having a problem. But a greater consolation would be to find that someone had figured out how to get around it! :-)

I wonder if the ffmpeg slackbuild author or anyone else attempting to use the slackbuild tried building it with opencv, and if so, whether or not they encountered the problem and/or resolved it.
 
Old 12-23-2012, 06:41 PM   #9
willysr
Senior Member
 
Registered: Jul 2004
Location: Jogja, Indonesia
Distribution: Slackware-Current
Posts: 2,635

Rep: Reputation: 450Reputation: 450Reputation: 450Reputation: 450Reputation: 450
Have you tried using AlienBob's ffmpeg package?
 
Old 12-23-2012, 06:52 PM   #10
Z038
Member
 
Registered: Jan 2006
Distribution: Slackware
Posts: 805

Original Poster
Rep: Reputation: 158Reputation: 158
The list of packages included in Alien Bob's build is most of what I want, but it doesn't appear to include opencv. Here is the list: http://www.slackware.com/~alien/slac.../ffmpeg/build/

I can build ffmpeg without a problem from the slackware.org slackbuild so long as I leave out opencv.
 
Old 12-23-2012, 07:05 PM   #11
willysr
Senior Member
 
Registered: Jul 2004
Location: Jogja, Indonesia
Distribution: Slackware-Current
Posts: 2,635

Rep: Reputation: 450Reputation: 450Reputation: 450Reputation: 450Reputation: 450
I used AlienBob's ffmpeg package and then i compile OpenCV from slackbuilds and it worked
 
Old 12-23-2012, 10:32 PM   #12
Z038
Member
 
Registered: Jan 2006
Distribution: Slackware
Posts: 805

Original Poster
Rep: Reputation: 158Reputation: 158
I am able to compile OpenCV from the slackbuild after building ffmpeg from slackbuilds.org also. The failure occurs when trying to rebuild ffmpeg with OPENCV=yes flag.
 
Old 12-23-2012, 11:18 PM   #13
TommyC7
Member
 
Registered: Mar 2012
Distribution: Slackware, CentOS, OpenBSD, FreeBSD
Posts: 439

Rep: Reputation: Disabled
According to the .SlackBuild script, it says OpenCV is broken. Perhaps try a newer version of OpenCV and ffmpeg than the ones on SlackBuilds.org?
 
Old 12-24-2012, 12:07 AM   #14
walecha
LQ Newbie
 
Registered: Jan 2010
Location: Malang
Distribution: slackware
Posts: 11

Rep: Reputation: 0
Well, this not a fix, just workaround. I always build OpenCV without ffmpeg. So if I already have ffmpeg, I uninstalled it first, build opencv and then reinstall ffmpeg. I think it runs fine without ffmpeg.
 
Old 12-24-2012, 11:56 AM   #15
Z038
Member
 
Registered: Jan 2006
Distribution: Slackware
Posts: 805

Original Poster
Rep: Reputation: 158Reputation: 158
I'm marking this solved. I was able to build (via scripts from slackbuilds.org) both 2.4.0 and 2.4.3 (latest stable release) after I installed ffmpeg 0.8.7.

I still have the problem of enabling OpenCV support in ffmpeg, but that was not the focus of this topic. I'll open a new thread if I can't figure it out.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Facing problem while running a Opencv program dibyamohanty02 Linux - Software 3 12-14-2012 05:12 AM
OpenCV - Pixel format of incoming image is unsupported by OpenCV golmschenk Programming 1 04-01-2011 01:32 PM
Problem linking against OpenCV C++ API Germanchu Linux - Software 14 08-22-2010 08:01 AM
OpenCV compilation problem (add directory for including header files) maikki Programming 2 01-07-2009 09:07 AM
OpenCV fistroman Programming 0 07-28-2003 10:43 AM


All times are GMT -5. The time now is 08:55 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration