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:
What could be the problem? Why linker points to i686 and then go back to i386?
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.