ZM 1.26.4 on Ubuntu Server 12.04.3: 'Make' fails - Solved

Forum for questions and support relating to the 1.26.x releases only.
Locked
codabiz
Posts: 59
Joined: Sun Jan 04, 2009 10:16 am
Location: London, UK

ZM 1.26.4 on Ubuntu Server 12.04.3: 'Make' fails - Solved

Post by codabiz »

When compiling ZM 1.26.4 (with ffmpeg+h264) on Ubuntu Server 12.04.3.(32 bit) configure goes fine but 'Make' fails at the following stage:
--------------------------------------------------------------------------------------------
g++ -D__STDC_CONSTANT_MACROS -g -O2 -L/usr/lib -L/usr/lib/mysql -o zmc zmc.o zm_box.o zm_buffer.o zm_camera.o zm_comms.o zm_config.o zm_coord.o zm.o zm_db.o zm_logger.o zm_event.o zm_exception.o zm_file_camera.o zm_ffmpeg_camera.o zm_image.o zm_jpeg.o zm_local_camera.o zm_monitor.o zm_ffmpeg.o zm_mpeg.o zm_poly.o zm_regexp.o zm_remote_camera.o zm_remote_camera_http.o zm_remote_camera_rtsp.o zm_rtp.o zm_rtp_ctrl.o zm_rtp_data.o zm_rtp_source.o zm_rtsp.o zm_sdp.o zm_signal.o zm_stream.o zm_thread.o zm_time.o zm_timer.o zm_user.o zm_utils.o zm_zone.o -lz -lbz2 -lswscale -lavdevice -lavformat -lavcodec -lavutil -lx264 -lz -lpcre -lgnutls-openssl -lgnutls -lgcrypt -ldl -lpthread -ljpeg -lmysqlclient
zm_mpeg.o: In function `encode_frame':
/usr/lib/ZoneMinder-1.26.4/src/zm_mpeg.cpp:40: undefined reference to `avcodec_encode_video2'
collect2: ld returned 1 exit status
make[2]: *** [zmc] Error 1
make[2]: Leaving directory `/usr/lib/ZoneMinder-1.26.4/src'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/usr/lib/ZoneMinder-1.26.4'
make: *** [all] Error 2
--------------------------------------------------------------------------------------------

Further notes: From script ZoneMinder-1.26.4/src/zm_mpeg.cpp:40

#if LIBAVFORMAT_VERSION_INT >= AV_VERSION_INT(54, 1, 0)
static int encode_frame(AVCodecContext *c, AVFrame *frame)
{
AVPacket pkt = { 0 };
int ret, got_output;

av_init_packet(&pkt);
av_init_packet(&pkt);
ret = avcodec_encode_video2(c, &pkt, frame, &got_output);
if (ret < 0)
return ret;

ret = pkt.size;
av_free_packet(&pkt);
return ret;
}

After some research: 'avcodec_open2 is only in libavcodec version 54 and above' My ffmpeg compile shows libavcodec 55. 35.100 / 55. 35.100

But the latest Ubuntu Server 12.04.03 version is libavcodec version 53?

Is this a mismatch problem? Any suggestions or workaround most welcome.
Last edited by codabiz on Sun Oct 20, 2013 12:04 pm, edited 4 times in total.
o2blom
Posts: 2
Joined: Wed Oct 16, 2013 3:59 am

Re: Installing ZM 1.26.4 on Ubuntu Server 12.04.3: 'Make' fa

Post by o2blom »

I have the same problem. It appears the avcodec_encode_video2 function is defined in the libavcodec.so library because when listing the dynamic symbol table with nm it does list the function.

nm -D /usr/local/lib/libavcodec.so | grep avcodec_decode_video2
000000000051f6a0 T avcodec_decode_video2

For some strange reason the linker is not seeing it, even though "-lavcodec" is present

Anyone has any idea on what could be going on ?

Thanks,

/Otto
codabiz
Posts: 59
Joined: Sun Jan 04, 2009 10:16 am
Location: London, UK

Re: Installing ZM 1.26.4 on Ubuntu Server 12.04.3: 'Make' fa

Post by codabiz »

I tried changing a couple of lines in the script ZoneMinder-1.26.4/src/zm_mpeg.cpp, so that
'ret = avcodec_encode_video2' became 'avcodec_encode_video'. However 'make' failed again error said something like that 'avcodec_encode_video' deprecated in avcodec.h.

Also tried upgrade libavcodec53 to libavcodec54 using deb sources, however the install complains about missing dependencies, which are not available. So brick wall at the moment.

Wonder if anybody has successfully installed zm 1.26.4 on Ubuntu Server 12.04.3 LTS with latest ffmpeg and h264 sources?


*Some further thoughts: Could try building ffmpeg + h264 with older version of ffmpeg 'FFmpeg 0.10.9 "Freedom' as that version has libavcodec 53. 61.100
codabiz
Posts: 59
Joined: Sun Jan 04, 2009 10:16 am
Location: London, UK

Install ZM1.26.4 Ubuntu Server 12.04.3: 'Make' fails- Solved

Post by codabiz »

Solved - this is what I did. Removed zoneminder files. Removed ffmpeg including all ffmpeg directories and files.

sudo apt-get install libav-tools
sudo apt-get install libavcodec-extra-53

avconv -codecs | grep "264"

output

avconv version 0.8.6-4:0.8.6-0ubuntu0.12.04.1, Copyright (c) 2000-2013 the Libav developers
built on Apr 2 2013 17:00:59 with gcc 4.6.3
D V D h264 H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10
D V D h264_vdpau H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 (VDPAU acceleration)
EV libx264 libx264 H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10

Installed zoneminder using same procedure with the following configure statement:

./configure --with-mysql=/usr --with-ffmpeg=/usr \
--with-webdir=/var/www/zoneminder --with-cgidir=/usr/lib/zoneminder/cgi-bin \
--with-webuser=www-data --with-webgroup=www-data --enable-mmap=yes

Zoneminder make and installs OK. To do: camera tests.

For info:

avconv -version
output

avconv version 0.8.6-4:0.8.6-0ubuntu0.12.04.1, Copyright (c) 2000-2013 the Libav developers
built on Apr 2 2013 17:00:59 with gcc 4.6.3
avconv 0.8.6-4:0.8.6-0ubuntu0.12.04.1
libavutil 51. 22. 1 / 51. 22. 1
libavcodec 53. 35. 0 / 53. 35. 0
libavformat 53. 21. 1 / 53. 21. 1
libavdevice 53. 2. 0 / 53. 2. 0
libavfilter 2. 15. 0 / 2. 15. 0
libswscale 2. 1. 0 / 2. 1. 0
libpostproc 52. 0. 0 / 52. 0. 0
o2blom
Posts: 2
Joined: Wed Oct 16, 2013 3:59 am

Re: Installing ZM 1.26.4 on Ubuntu server 12.04.3: 'Make' fa

Post by o2blom »

Thanks a lot for sharing. I'll try it out tonight
Locked