Motion - Bug Report 2010x 11x 28x 210835
You are here: Foswiki>Motion Web>BugReports>BugReport2010x11x28x210835 (29 Oct 2011, AngelCarpintero)Edit Attach

BUG: motion will not compile with ffmpeg

I am running Slackware Linux, version 12.2 with kernel 2.6.27.7-smp

I am trying to compile the "motion" program to include ffmpeg support.

ffmpeg needs: BZ2_bzDecompressInit BZ2_bzDecompress BZ2_bzDecompressEnd

I downloaded the 1.0.6 tarball of bzip2.

I see the entries of the utilites above in bzlib.c

I compile and install bzip2.
I compile and install ffmpeg, then motion.

At the end of the motion compilation, I get:

/usr/local/src/ffmpeg/libavformat/matroskadec.c:927: undefined reference to `BZ2_bzDecompressInit'
/usr/local/src/ffmpeg/libavformat/matroskadec.c:936: undefined reference to `BZ2_bzDecompress'
/usr/local/src/ffmpeg/libavformat/matroskadec.c:939: undefined reference to `BZ2_bzDecompressEnd'
/usr/local/src/ffmpeg/libavformat/matroskadec.c:939: undefined reference to `BZ2_bzDecompressEnd'

The above errors occur when I compile "motion" !! Not when I compile ffmpeg!

The sources to bzip2-1.0.6.tar.gz and ffmpeg-0.6.1.tar.gz are too large to e-mail, so I am just giving you the URLs.

http://www.linux.com/archive/feature/114118

http://ffmpeg.org/

http://bzip.org/downloads.html


What is wrong? Other folks on the internet get the same error messages for programs other than "motion". But nobody has a solution, so far as I can tell.

If I configure "motion" --without-ffmpeg, then motion compiles and works, but with no mpeg output.

Thanks, Ed Kribbs

OK, I subsequently worked around the problem.

One item is that there is a separate makefile in bzip2-1.0.6 called Makefile-libbz2_so. This is the file that needs to be run under "make" to create /lib/libbz2.so.... that you have to have to satisfy the "undefined reference"s above.

Next, under motion-3.2.12, the Makefile that is created from "configure" has a bug. The line describing the libraries is:

LIBS = -lm -lpthread -ljpeg -L/usr/local/lib -lavformat -lavcodec -lavutil -lm -lz -L/usr/lib -lmysqlclient -lz

Notice there are two "-lz"s, and consequently libbz2 never gets referenced.

Change that line in Makefile to have the last "-lz" changed to -lbz2 as below so that libbz2.so gets recognized.

LIBS = -lm -lpthread -ljpeg -L/usr/local/lib -lavformat -lavcodec -lavutil -lm -lz -L/usr/lib -lmysqlclient -lbz2

Lastly, there is conflict between the ffmpeg-0.6.1 and motion-3.2.12.

In ffmpeg-0.6.1, in the libavformat directory, there is file.c which has a structure called "file_protocol". This conflicts with the file ffmpeg.c in motion-3.2.12 which has the same structure name, "file_protocol", but with slightly different content.

They did not seem to be shared, so in ffmpeg.c in motion-3.2.12, I changed "file_protocol" to "file_protocol2" in the structure definition, and in the four places where is it referenced in that file.

Then everything compiled and all that I tried to run, worked.

So folks, you need to fix the configure so that it creates Makefile correctly with the -lbz2, and fix ffmpeg.c so that it does not conflict "file_protocol" with ffmpeg-0.6.1/libavformat/file.c

/usr/local/src/ffmpeg/libavformat/matroskadec.c:927: undefined reference to `BZ2_bzDecompressInit'
/usr/local/src/ffmpeg/libavformat/matroskadec.c:936: undefined reference to `BZ2_bzDecompress'
/usr/local/src/ffmpeg/libavformat/matroskadec.c:939: undefined reference to `BZ2_bzDecompressEnd'
/usr/local/src/ffmpeg/libavformat/matroskadec.c:939: undefined reference to `BZ2_bzDecompressEnd'

The above errors occur when I compile "motion" !!  Not when I compile ffmpeg!

Environment

Motion version: 3.2.12
ffmpeg version:  
Shared libraries: ffmpeg, libbz2
Server OS: slackware linux 12.2, kernel 2.6.27.7-smp
-- EdwinKribbs - 28 Nov 2010

Follow up

Sorry i can reproduce your issue.

It looks that is related to some weird issue you have with ffmpeg and their dependencies , not with motion.

Anyway you can try to run this with SVN or GIT version of motion.

Cheers,

-- AngelCarpintero - 29 Oct 2011

Fix record

Topic revision: r3 - 29 Oct 2011, AngelCarpintero
Copyright © 1999-2024 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Please do not email Kenneth for support questions (read why). Use the Support Requests page or join the Mailing List.
This website only use harmless session cookies. See Cookie Policy for details. By using this website you accept the use of these cookies.