My problems compiling with ffmpeg support on FC10

Forum for questions and support relating to the 1.24.x releases only.
User avatar
Blazer
Posts: 234
Joined: Sun Jun 05, 2005 12:57 pm

Post by Blazer »

I have no problems with the mysql libs, that is solved by the --extra-libs option I am passing.

As for the ffmpeg libs, I looked in config.log and can see it just failing to find the header files for some reason:

Code: Select all

configure:10865: checking libavutil/avutil.h usability
configure:10882: g++ -c -g -O2 -I/usr/include  conftest.cpp >&5
conftest.cpp:131:30: error: libavutil/avutil.h: No such file or directory
configure:10889: $? = 1
User avatar
Blazer
Posts: 234
Joined: Sun Jun 05, 2005 12:57 pm

Post by Blazer »

Well I have the compile running now. I ended up making symlinks to the subdirs of /usr/lib/ffmpeg to /usr/lib. All that should have been required was adding -I/usr/lib/ffmpeg, but for some reason it just wouldnt take.

Heh as I was typing this got a new error:

Code: Select all

In file included from zm_ffmpeg.h:37,
                 from zm_local_camera.h:33,
                 from zm_local_camera.cpp:21:
../libavcodec/avcodec.h:2388: warning: âImgReSampleContextâ is deprecated (declared at ../libavcodec/avcodec.h:2382)
../libavcodec/avcodec.h:2398: warning: âImgReSampleContextâ is deprecated (declared at ../libavcodec/avcodec.h:2382)
zm_local_camera.cpp: In member function âvoid LocalCamera::Initialise()â:
zm_local_camera.cpp:230: error: âPIX_FMT_VDPAU_H264â was not declared in this scope
zm_local_camera.cpp:231: error: âPIX_FMT_VDPAU_MPEG1â was not declared in this scope
zm_local_camera.cpp:232: error: âPIX_FMT_VDPAU_MPEG2â was not declared in this scope
zm_local_camera.cpp:425: error: âPIX_FMT_VDPAU_H264â was not declared in this scope
zm_local_camera.cpp:426: error: âPIX_FMT_VDPAU_MPEG1â was not declared in this scope
zm_local_camera.cpp:427: error: âPIX_FMT_VDPAU_MPEG2â was not declared in this scope
make[2]: *** [zm_local_camera.o] Error 1
make[2]: Leaving directory `/tmp/ZoneMinder-1.24.0/src'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/tmp/ZoneMinder-1.24.0'
make: *** [all] Error 2
Meh I think I will just uninstall ffmpeg and get the latest build and start over.
User avatar
Blazer
Posts: 234
Joined: Sun Jun 05, 2005 12:57 pm

Post by Blazer »

Well I did uninstall the ffmpeg that I had, and installed the one from the rpmfusion repo:

Code: Select all

# rpm -qa |grep ffmpeg
ffmpeg-libs-0.4.9-0.54.20080908.fc10.i386
ffmpeg-devel-0.4.9-0.54.20080908.fc10.i386
ffmpeg-0.4.9-0.54.20080908.fc10.i386
Now configure looks like it is happy, but the compile fails after a bit with the following error:

Code: Select all

g++ -DHAVE_CONFIG_H -I. -I..  -I/usr/lib/mysql/include -Iyes/include -Wall -Wno-sign-compare -fno-inline -Iyes/include  -frepo -g -O2 -MT zm_local_camera.o -MD -MP -MF .deps/zm_local_camera.Tpo -c -o zm_local_camera.o zm_local_camera.cpp
In file included from zm_ffmpeg.h:37,
                 from zm_local_camera.h:33,
                 from zm_local_camera.cpp:21:
../libavcodec/avcodec.h:2388: warning: ‘ImgReSampleContext’ is deprecated (declared at ../libavcodec/avcodec.h:2382)
../libavcodec/avcodec.h:2398: warning: ‘ImgReSampleContext’ is deprecated (declared at ../libavcodec/avcodec.h:2382)
zm_local_camera.cpp: In member function ‘void LocalCamera::Initialise()’:
zm_local_camera.cpp:230: error: ‘PIX_FMT_VDPAU_H264’ was not declared in this scope
zm_local_camera.cpp:231: error: ‘PIX_FMT_VDPAU_MPEG1’ was not declared in this scope
zm_local_camera.cpp:232: error: ‘PIX_FMT_VDPAU_MPEG2’ was not declared in this scope
zm_local_camera.cpp:425: error: ‘PIX_FMT_VDPAU_H264’ was not declared in this scope
zm_local_camera.cpp:426: error: ‘PIX_FMT_VDPAU_MPEG1’ was not declared in this scope
zm_local_camera.cpp:427: error: ‘PIX_FMT_VDPAU_MPEG2’ was not declared in this scope
make[2]: *** [zm_local_camera.o] Error 1
make[2]: Leaving directory `/tmp/ZoneMinder-1.24.0/src'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/tmp/ZoneMinder-1.24.0'
make: *** [all] Error 2
Can you tell me what version of ffmpeg was used in the development/testing of 1.24.0? Perhaps if I install that exact version that will work. I know that ffmpeg can vary quite a bit from build to build.
newvisionantenna
Posts: 381
Joined: Sat Jan 17, 2009 7:49 pm
Location: Germany

Post by newvisionantenna »

I think a sticky is in place for this error, I will the first one to post the fix for this. Either use the latest ffmpeg or edit the file zm_local_camera.cpp and find the offending lines and place // in front of them.

You'll find the H264 and the rest about half way down and then again about 3/4 the way down. It will then compile just fine.
User avatar
Blazer
Posts: 234
Joined: Sun Jun 05, 2005 12:57 pm

Post by Blazer »

Thanks for the tip. I did as you suggested and the compile did get farther, but it bombed out later on with:

Code: Select all

In file included from zm_ffmpeg.h:37,
                 from zm_rtsp.h:25,
                 from zm_rtsp.cpp:25:
../libavcodec/avcodec.h:2388: warning: ‘ImgReSampleContext’ is deprecated (declared at ../libavcodec/avcodec.h:2382)
../libavcodec/avcodec.h:2398: warning: ‘ImgReSampleContext’ is deprecated (declared at ../libavcodec/avcodec.h:2382)
zm_rtsp.cpp: In constructor ‘RtspThread::RtspThread(int, RtspThread::RtspMethod, const std::string&, const std::string&, const std::string&, const std::string&, const std::string&, const std::string&)’:
zm_rtsp.cpp:183: error: ‘avformat_alloc_context’ was not declared in this scope
make[2]: *** [zm_rtsp.o] Error 1
make[2]: Leaving directory `/tmp/ZoneMinder-1.24.0/src'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/tmp/ZoneMinder-1.24.0'
make: *** [all] Error 2
I dont like having to hack on the source, so I guess the proper thing to do is get the correct version of ffmpeg. I prefer to install rpm versions when I can as it is easier to manage, but in this case I think I will have to svn checkout the proper version and build and install that.
newvisionantenna
Posts: 381
Joined: Sat Jan 17, 2009 7:49 pm
Location: Germany

Post by newvisionantenna »

I guess it's not really a hack, but a newer build should get rid of that error. Even with a newer build you still might run into the next error you got. The fix for that follows, just find zm_rtsp.cpp and change avformat_alloc_context to av_alloc_format_context and you'll be good to go.

Code: Select all

diff -urN ZoneMinder-1.24.0.old//src/zm_rtsp.cpp ZoneMinder-1.24.0//src/zm_rtsp.cpp 
--- ZoneMinder-1.24.0.old//src/zm_rtsp.cpp 2009-02-09 14:43:19.000000000 +0000 
+++ ZoneMinder-1.24.0//src/zm_rtsp.cpp 2009-02-15 19:15:23.629245785 +0000 
@@ -180,7 +180,7 @@ 
else 
mUrl += '/'+mPath; 
} 
- mFormatContext = avformat_alloc_context(); 
+ mFormatContext = av_alloc_format_context(); 

mSsrc = rand();
[/quote]
User avatar
cordel
Posts: 5210
Joined: Fri Mar 05, 2004 4:47 pm
Location: /USA/Washington/Seattle

Post by cordel »

Blazer wrote:Well I did uninstall the ffmpeg that I had, and installed the one from the rpmfusion repo:

Code: Select all

# rpm -qa |grep ffmpeg
ffmpeg-libs-0.4.9-0.54.20080908.fc10.i386
ffmpeg-devel-0.4.9-0.54.20080908.fc10.i386
ffmpeg-0.4.9-0.54.20080908.fc10.i386
This version of ffmpeg is to old. You need to download ffmpeg from svn, any revision since 2/4/09 and compile it with

Code: Select all

./configure --enable-gpl --enable-swscale --enable-shared
Then with pristine source build ZM.
User avatar
Blazer
Posts: 234
Joined: Sun Jun 05, 2005 12:57 pm

Post by Blazer »

Okay here is what I have done now.
* Removed all traces of my current ffmpeg build
* Downloaded latest ffmpeg via svn: svn checkout svn://svn.mplayerhq.hu/ffmpeg/trunk ffmpeg
* Configured ffmpeg: ./configure --enable-gpl --enable-swscale --enable-shared --enable-pthreads
* Installed ffmpeg: make install; make install-libs
* Downloaded zm from svn: svn co http://svn.zoneminder.com/svn/zm/trunk zm
* configured ZM: ./configure --with-webdir=/var/www/html/zm --with-cgidir=/var/www/cgi-bin --with-ffmpeg=/usr/local/bin ZM_DB_HOST=localhost ZM_DB_NAME=zm ZM_DB_USER=zmuser ZM_DB_PASS=zmpass --enable-debug=yes --with-webgroup=apache --with-webuser=apache ZM_SSL_LIB=openssl

I now get the following errors, mostly undefined reference errors in every file:

Code: Select all

m_utils.o: In function `startsWith(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)':
/tmp/zm/src/zm_utils.cpp:56: undefined reference to `__gnu_cxx::__enable_if<std::__is_char<char>::__value, bool>::__type std::operator==<char>(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
zm_utils.o: In function `split(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::basic_string<char, std::char_traits<char>, std::allocator<char> >)':
/tmp/zm/src/zm_utils.cpp:61: undefined reference to `std::vector<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > >::vector()'
/tmp/zm/src/zm_utils.cpp:71: undefined reference to `std::vector<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > >::push_back(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
/tmp/zm/src/zm_utils.cpp:78: undefined reference to `std::vector<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > >::~vector()'
collect2: ld returned 1 exit status
make[2]: *** [zmc] Error 1
make[2]: Leaving directory `/tmp/zm/src'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/tmp/zm'
make: *** [all] Error 2
Should I be using the tarball release of ZM instead of trunk (dunno if trunk is unstable version)?
User avatar
cordel
Posts: 5210
Joined: Fri Mar 05, 2004 4:47 pm
Location: /USA/Washington/Seattle

Post by cordel »

Your path for ffmpeg is incorrect. It should be --with-ffmpeg=/usr/local (the prefix path) and the script will fill in the rest (bin, include, lib) that are under that prefix. You should also be able to run ./configure without adding the ffmpeg switch and configure should pickup ffmpeg and find it on it's own.

It also appears you need to install libstdc packages.
Last edited by cordel on Mon Feb 23, 2009 7:48 pm, edited 1 time in total.
User avatar
Blazer
Posts: 234
Joined: Sun Jun 05, 2005 12:57 pm

Post by Blazer »

Update: from a tip in another thread, I removed the "ccache" package, and then did a "make clean", and then "make" and it compiled all the way this time.

Wow what an ordeal, but I finally got it done, with the help from you folks and the search function of the forums...thank you!! :)
User avatar
Blazer
Posts: 234
Joined: Sun Jun 05, 2005 12:57 pm

Post by Blazer »

One last update:

To get Zoneminder to work, I had to fix a problem of the binaries in /usr/local/bin not finding the libraries in /usr/local/lib

To do this I created the file /etc/ld.so.conf.d/zm.conf, and placed into it a single line:
/usr/local/lib

and then ran "ldconfig" and now Zoneminder starts up fine.
User avatar
zoneminder
Site Admin
Posts: 5215
Joined: Wed Jul 09, 2003 2:07 pm
Location: Bristol, UK
Contact:

Post by zoneminder »

Thanks for the update. Unfortunately it is proving very hard to keep up with (a) the rapid changes to the API that ffmpeg is undergoing at the moment and (b) the differences in configuration between distros.

Hopefully this thread will help anyone who hits the same problems.
Phil
nuck
Posts: 148
Joined: Tue Nov 11, 2008 1:43 am
Location: Canada

Post by nuck »

Blazer wrote:One last update:

To get Zoneminder to work, I had to fix a problem of the binaries in /usr/local/bin not finding the libraries in /usr/local/lib

To do this I created the file /etc/ld.so.conf.d/zm.conf, and placed into it a single line:
/usr/local/lib

and then ran "ldconfig" and now Zoneminder starts up fine.
Go figure. The same old /usr/local issue crops up yet again.

Phil, since in the vast majority if not all cases, a ZM install is a dedicated system, why not simply put zoneminder in /usr rather than /usr/local and be done with it? You've got my vote.
User avatar
cordel
Posts: 5210
Joined: Fri Mar 05, 2004 4:47 pm
Location: /USA/Washington/Seattle

Post by cordel »

Blazer wrote:One last update:

To get Zoneminder to work, I had to fix a problem of the binaries in /usr/local/bin not finding the libraries in /usr/local/lib

To do this I created the file /etc/ld.so.conf.d/zm.conf, and placed into it a single line:
/usr/local/lib

and then ran "ldconfig" and now Zoneminder starts up fine.
Should truly be ffmpeg.conf since it's ffmpegs libs that are not being picked up.
Alternatively you could configure either or both with --prefix=/usr in which case the programs would be installed in /usr/[bin,lib,includes].

Using /usr/local as a default prefix is done normally as is the "Linux way" typically for anything that is not required as part of a standard system install.
User avatar
zoneminder
Site Admin
Posts: 5215
Joined: Wed Jul 09, 2003 2:07 pm
Location: Bristol, UK
Contact:

Post by zoneminder »

nuck wrote:Phil, since in the vast majority if not all cases, a ZM install is a dedicated system, why not simply put zoneminder in /usr rather than /usr/local and be done with it? You've got my vote.
I am very loath to hardcode it as the autoconf tools etc all allow a system to decide for itself where the 'default' location for installs is. The standard way of putting things elsewhere is via the --prefix or --exec-prefix options but supplying a /usr default I think is probably a bit of a no-no as I don't ever specify /usr/local now anyway.
Phil
Locked