1

I'm developing an application to capture video from webcam and stream it to Android. I'm using ffmpeg latest release - 2.5.2 "Bohr" on Ubuntu 14.04 32bit and using Eclipse as IDE.

I'm receiving this error when compiling:

g++ -L/usr/local/lib -L/home/idanhahn/ffmpeg/ffmpeg_build/lib -o "camera"  ./src/.metadata/.plugins/org.eclipse.cdt.make.core/specs.o  ./src/CameraSec.o ./src/camera.o  ./.metadata/.plugins/org.eclipse.cdt.make.core/specs.o   -lz -lswscale -lopencv_core -lavcodec -lavutil -lpthread -lboost_thread -lboost_system -lboost_date_time -lopencv_imgproc -lopencv_highgui -lopencv_ml -lopencv_video -lopencv_features2d -lopencv_calib3d -lopencv_objdetect -lopencv_contrib -lopencv_legacy -lopencv_flann -lavformat
/usr/bin/ld: /home/idanhahn/ffmpeg/ffmpeg_build/lib/libavformat.a(http.o): undefined reference to symbol 'inflateInit2_'
/usr/lib/gcc/i686-linux-gnu/4.8/../../../i386-linux-gnu/libz.so: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status

I've linked avformat (and other ffmpeg related libs).

I've tried the following:

  1. Linked libz.
  2. Tried to recompile using instructions from here: http://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu

What could be the problem? Why linker points to i686 and then go back to i386?

trooper
  • 4,444
  • 5
  • 32
  • 32
CodeHahn
  • 279
  • 6
  • 17
  • Try -lz as the last argument. – lonewasp Dec 27 '14 at 07:56
  • Thanks! tried it but not sure if it fixed it, I'm getting a different error now: `/usr/bin/ld: /home/idanhahn/ffmpeg/ffmpeg_build/lib/libavcodec.a(tiff.o): undefined reference to symbol 'lzma_code@@XZ_5.0' //lib/i386-linux-gnu/liblzma.so.5: error adding symbols: DSO missing from command line` – CodeHahn Dec 27 '14 at 08:13

2 Answers2

2

then you need to put -llzma with the compilation line of ffmpeg.

or i have an alternative to do it via simpler method. Try this: http://ubuntuforums.org/showthread.php?t=2219550&p=13101922#post13101922

it will be simple..

RahulAN
  • 97
  • 1
  • 1
  • 7
  • jon-severinsson release is very old and this will not compile latest version of ffmpeg (bohr), I think there's a newer version created by mc3man, But since this is a learning experience I would like to "get it right" with the official release. Thanks! – CodeHahn Dec 27 '14 at 13:34
2

You are really only missing an additional library here. Just add -llzma to the end of your compilation line.

I additionally had to add other missing libraries. Just append in case you are facing the same problem:

-lswresample -lm -lz

It is because libavcodec includes some math and zlib headers, so you must link to the respective libraries as well. This is also the case for lzma.

Ben
  • 2,314
  • 1
  • 19
  • 36