LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (http://www.linuxquestions.org/questions/linux-software-2/)
-   -   ffmpeg won't build properly (http://www.linuxquestions.org/questions/linux-software-2/ffmpeg-wont-build-properly-412377/)

mrchaos 02-06-2006 06:21 PM

ffmpeg won't build properly
 
I have kernel 2.6.11.8, and when I try to build ffmpeg, I get:
Code:

bash-3.00# make
make -C libavutil all
make[1]: Entering directory `/home/zax/main/ffmpeg/libavutil'
make[1]: Nothing to be done for `all'.
make[1]: Leaving directory `/home/zax/main/ffmpeg/libavutil'
make -C libavcodec all
make[1]: Entering directory `/home/zax/main/ffmpeg/libavcodec'
make[1]: Nothing to be done for `all'.
make[1]: Leaving directory `/home/zax/main/ffmpeg/libavcodec'
make -C libavformat all
make[1]: Entering directory `/home/zax/main/ffmpeg/libavformat'
gcc -O3 -g -Wall -Wno-switch  -Wdeclaration-after-statement -I.. -I'/home/zax/main/ffmpeg' -I'/home/zax/main/ffmpeg'/libavutil -I'/home/zax/main/ffmpeg'/libavcodec -DHAVE_AV_CONFIG_H -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_GNU_SOURCE  -c -o v4l2.o v4l2.c
v4l2.c:68: error: `V4L2_PIX_FMT_YUV420' undeclared here (not in a function)
v4l2.c:68: error: initializer element is not constant
v4l2.c:68: error: (near initialization for `fmt_conversion_table[0].v4l2_fmt')
v4l2.c:69: error: initializer element is not constant
v4l2.c:69: error: (near initialization for `fmt_conversion_table[0]')
v4l2.c:72: error: `V4L2_PIX_FMT_YUV422P' undeclared here (not in a function)
v4l2.c:72: error: initializer element is not constant
v4l2.c:72: error: (near initialization for `fmt_conversion_table[1].v4l2_fmt')
v4l2.c:73: error: initializer element is not constant
v4l2.c:73: error: (near initialization for `fmt_conversion_table[1]')
v4l2.c:76: error: `V4L2_PIX_FMT_YUYV' undeclared here (not in a function)
v4l2.c:76: error: initializer element is not constant
v4l2.c:76: error: (near initialization for `fmt_conversion_table[2].v4l2_fmt')
v4l2.c:77: error: initializer element is not constant
v4l2.c:77: error: (near initialization for `fmt_conversion_table[2]')
v4l2.c:80: error: `V4L2_PIX_FMT_UYVY' undeclared here (not in a function)
v4l2.c:80: error: initializer element is not constant
v4l2.c:80: error: (near initialization for `fmt_conversion_table[3].v4l2_fmt')
v4l2.c:81: error: initializer element is not constant
v4l2.c:81: error: (near initialization for `fmt_conversion_table[3]')
v4l2.c:84: error: `V4L2_PIX_FMT_YUV411P' undeclared here (not in a function)
v4l2.c:84: error: initializer element is not constant
v4l2.c:84: error: (near initialization for `fmt_conversion_table[4].v4l2_fmt')
v4l2.c:85: error: initializer element is not constant
v4l2.c:85: error: (near initialization for `fmt_conversion_table[4]')
v4l2.c:88: error: `V4L2_PIX_FMT_YUV410' undeclared here (not in a function)
v4l2.c:88: error: initializer element is not constant
v4l2.c:88: error: (near initialization for `fmt_conversion_table[5].v4l2_fmt')
v4l2.c:89: error: initializer element is not constant
v4l2.c:89: error: (near initialization for `fmt_conversion_table[5]')
v4l2.c:92: error: `V4L2_PIX_FMT_BGR24' undeclared here (not in a function)
v4l2.c:92: error: initializer element is not constant
v4l2.c:92: error: (near initialization for `fmt_conversion_table[6].v4l2_fmt')
v4l2.c:93: error: initializer element is not constant
v4l2.c:93: error: (near initialization for `fmt_conversion_table[6]')
v4l2.c:96: error: `V4L2_PIX_FMT_RGB24' undeclared here (not in a function)
v4l2.c:96: error: initializer element is not constant
v4l2.c:96: error: (near initialization for `fmt_conversion_table[7].v4l2_fmt')
v4l2.c:97: error: initializer element is not constant
v4l2.c:97: error: (near initialization for `fmt_conversion_table[7]')
v4l2.c:106: error: `V4L2_PIX_FMT_GREY' undeclared here (not in a function)
v4l2.c:106: error: initializer element is not constant
v4l2.c:106: error: (near initialization for `fmt_conversion_table[8].v4l2_fmt')
v4l2.c:107: error: initializer element is not constant
v4l2.c:107: error: (near initialization for `fmt_conversion_table[8]')
v4l2.c: In function `device_open':
v4l2.c:112: error: storage size of 'cap' isn't known
v4l2.c:124: error: `VIDIOC_QUERYCAP' undeclared (first use in this function)
v4l2.c:124: error: (Each undeclared identifier is reported only once
v4l2.c:124: error: for each function it appears in.)
v4l2.c:131: error: `V4L2_CAP_VIDEO_CAPTURE' undeclared (first use in this function)
v4l2.c:112: warning: unused variable `cap'
v4l2.c: In function `device_init':
v4l2.c:143: error: storage size of 'fmt' isn't known
v4l2.c:145: error: invalid application of `sizeof' to incomplete type `v4l2_format'
v4l2.c:146: error: `V4L2_BUF_TYPE_VIDEO_CAPTURE' undeclared (first use in this function)
v4l2.c:150: error: `V4L2_FIELD_INTERLACED' undeclared (first use in this function)
v4l2.c:151: error: `VIDIOC_S_FMT' undeclared (first use in this function)
v4l2.c:143: warning: unused variable `fmt'
v4l2.c: In function `first_field':
v4l2.c:157: error: `v4l2_std_id' undeclared (first use in this function)
v4l2.c:157: error: syntax error before "std"
v4l2.c:159: error: `VIDIOC_G_STD' undeclared (first use in this function)
v4l2.c:159: error: `std' undeclared (first use in this function)
v4l2.c:163: error: `V4L2_STD_NTSC' undeclared (first use in this function)
v4l2.c: In function `mmap_init':
v4l2.c:198: error: storage size of 'req' isn't known
v4l2.c:201: error: invalid application of `sizeof' to incomplete type `v4l2_requestbuffers'
v4l2.c:203: error: `V4L2_BUF_TYPE_VIDEO_CAPTURE' undeclared (first use in this function)
v4l2.c:204: error: `V4L2_MEMORY_MMAP' undeclared (first use in this function)
v4l2.c:205: error: `VIDIOC_REQBUFS' undeclared (first use in this function)
v4l2.c:237: error: storage size of 'buf' isn't known
v4l2.c:239: error: invalid application of `sizeof' to incomplete type `v4l2_buffer'
v4l2.c:243: error: `VIDIOC_QUERYBUF' undeclared (first use in this function)
v4l2.c:237: warning: unused variable `buf'
v4l2.c:198: warning: unused variable `req'
v4l2.c: In function `mmap_read_frame':
v4l2.c:275: error: storage size of 'buf' isn't known
v4l2.c:278: error: invalid application of `sizeof' to incomplete type `v4l2_buffer'
v4l2.c:279: error: `V4L2_BUF_TYPE_VIDEO_CAPTURE' undeclared (first use in this function)
v4l2.c:280: error: `V4L2_MEMORY_MMAP' undeclared (first use in this function)
v4l2.c:283: error: `VIDIOC_DQBUF' undeclared (first use in this function)
v4l2.c:296: error: `VIDIOC_QBUF' undeclared (first use in this function)
v4l2.c:275: warning: unused variable `buf'
v4l2.c: In function `mmap_start':
v4l2.c:313: error: storage size of 'type' isn't known
v4l2.c:317: error: storage size of 'buf' isn't known
v4l2.c:319: error: invalid application of `sizeof' to incomplete type `v4l2_buffer'
v4l2.c:320: error: `V4L2_BUF_TYPE_VIDEO_CAPTURE' undeclared (first use in this function)
v4l2.c:321: error: `V4L2_MEMORY_MMAP' undeclared (first use in this function)
v4l2.c:324: error: `VIDIOC_QBUF' undeclared (first use in this function)
v4l2.c:317: warning: unused variable `buf'
v4l2.c:333: error: `VIDIOC_STREAMON' undeclared (first use in this function)
v4l2.c:313: warning: unused variable `type'
v4l2.c: In function `mmap_close':
v4l2.c:345: error: storage size of 'type' isn't known
v4l2.c:348: error: `V4L2_BUF_TYPE_VIDEO_CAPTURE' undeclared (first use in this function)
v4l2.c:352: error: `VIDIOC_STREAMOFF' undeclared (first use in this function)
v4l2.c:345: warning: unused variable `type'
v4l2.c: In function `v4l2_read_header':
v4l2.c:439: error: `V4L2_CAP_STREAMING' undeclared (first use in this function)
make[1]: *** [v4l2.o] Error 1
make[1]: Leaving directory `/home/zax/main/ffmpeg/libavformat'
make: *** [lib] Error 2

my kernel has been compiled with support for v4l support, and yet I'm still getting these errors... even by "cheating" past the errors by:
Code:

make -i
I still can't build a working ffmpeg program (this carries over, disallowing me from building mplayer due to the libav libraries)

Anyone know what's going on?

**Also, if I use the configure option --disable-v4l, I still get this error message:
Code:

make[1]: Nothing to be done for `all'.
make[1]: Leaving directory `/home/zax/main/ffmpeg/libavformat'
gcc -Wl,--warn-common -rdynamic -g -o ffmpeg_g ffmpeg.o cmdutils.o -L./libavformat -lavformat -L./libavcodec -lavcodec -L./libavutil -lavutil -lm -lmp3lame -logg -lvorbis -lvorbisenc -lfaad -lfaac -lxvidcore -lx264 -ldts -ldts -lz -ldl -lpthread
./libavcodec/libavcodec.so: undefined reference to `XSync'
./libavcodec/libavcodec.so: undefined reference to `XDrawPoint'
./libavcodec/libavcodec.so: undefined reference to `XMapWindow'
./libavcodec/libavcodec.so: undefined reference to `XCreateImage'
./libavcodec/libavcodec.so: undefined reference to `XSetForeground'
./libavcodec/libavcodec.so: undefined reference to `XAllocNamedColor'
./libavcodec/libavcodec.so: undefined reference to `XResizeWindow'
./libavcodec/libavcodec.so: undefined reference to `XAllocSizeHints'
./libavformat/libavformat.so: undefined reference to `v4l2_init'
./libavcodec/libavcodec.so: undefined reference to `XFree'
./libavcodec/libavcodec.so: undefined reference to `XCreateColormap'
./libavcodec/libavcodec.so: undefined reference to `XDrawLine'
./libavcodec/libavcodec.so: undefined reference to `XCreateWindow'
./libavcodec/libavcodec.so: undefined reference to `XNextEvent'
./libavcodec/libavcodec.so: undefined reference to `XDrawRectangle'
./libavcodec/libavcodec.so: undefined reference to `XSelectInput'
./libavcodec/libavcodec.so: undefined reference to `XSetStandardProperties'
./libavcodec/libavcodec.so: undefined reference to `XPutImage'
./libavcodec/libavcodec.so: undefined reference to `XOpenDisplay'
collect2: ld returned 1 exit status
make: *** [ffmpeg_g] Error 1


foo_bar_foo 02-06-2006 11:16 PM

we need gcc version and ffmpeg version

mrchaos 02-07-2006 09:33 AM

my apologies. I guess I didn't post the versions:

ffmpeg is being built via daily CVS repository, so it is the version from 2/7/2006

gcc is version 3.4.5, which I just built yesterday (includes java gcc and g++)

mijanek 02-16-2006 06:23 PM

errer in Include files...?
 
Hi I got the same problem,

my Kernel is 2.6.8 and i am using gcc (GCC) 3.4.1 (Mandrakelinux 10.1 3.4.1-4mdk)


I found out that in the include file linux\videodev2.h are some exlusions only to compile for kernel
(
#ifdef __KERNEL__
struct v4l2_buffer
{
etc..
)

so I commented out some of these #ifdef __KERNEL__ (and #endif) and it compiles now fine.

:D

mrchaos 02-17-2006 02:13 PM

actually, the ifdef_KERNEL lines are already commented out for my kernel...

I think it's a problem with GCC if anything... as of late I've had a hard time compiling certain programs (especially if they rely heavily on GTK+), but I'm still working on it.


There is definitely something wrong with my compiler that I am unaware of... I tried updating my glibc, but got an "undefined resource" error as I always do.

joslar 02-18-2006 03:29 PM

Code:

gcc -Wl,--warn-common -rdynamic -g -o ffmpeg_g ffmpeg.o cmdutils.o -L./libavformat -lavformat -L./libavcodec -lavcodec -L./libavutil -lavutil -lm -lvorbis -lvorbisenc -lmp3lame -logg -lx264 -lz -llzo -ldl -lpthread
./libavcodec/libavcodec.so: undefined reference to `XSync'
./libavcodec/libavcodec.so: undefined reference to `XDrawPoint'
./libavcodec/libavcodec.so: undefined reference to `XMapWindow'
./libavcodec/libavcodec.so: undefined reference to `XCreateImage'
./libavcodec/libavcodec.so: undefined reference to `XSetForeground'
./libavcodec/libavcodec.so: undefined reference to `XAllocNamedColor'
./libavcodec/libavcodec.so: undefined reference to `XResizeWindow'
./libavcodec/libavcodec.so: undefined reference to `XAllocSizeHints'
./libavcodec/libavcodec.so: undefined reference to `XFree'
./libavcodec/libavcodec.so: undefined reference to `XCreateColormap'
./libavcodec/libavcodec.so: undefined reference to `XDrawLine'
./libavcodec/libavcodec.so: undefined reference to `XCreateWindow'
./libavcodec/libavcodec.so: undefined reference to `XNextEvent'
./libavcodec/libavcodec.so: undefined reference to `XDrawRectangle'
./libavcodec/libavcodec.so: undefined reference to `XSelectInput'
./libavcodec/libavcodec.so: undefined reference to `XSetStandardProperties'
./libavcodec/libavcodec.so: undefined reference to `XPutImage'
./libavcodec/libavcodec.so: undefined reference to `XOpenDisplay'
collect2: ld devolvió el estado de salida 1
make: *** [ffmpeg_g] Error 1

It is a problem of ffmpeg and Xorg, my Xorg's version is 7.0 and ffmpeg-CVS-18-2-2006
At the moment it seems that there is no solution to the problem :confused:

foo_bar_foo 02-18-2006 10:55 PM

OK this last thing and i realize also posted by OP is a linking error
nothing more than a bad Makefile or you could look at it as a bad gcc command
if you go to the directory the compiler was in when the link failed you can fix just copy past the gcc command back on the command line and add in xlib
something like this (not tested and you will have to play with it)
position is important so t might have to go further to the right -- i just put it to the right of the av stuff since that was the failure.
or you can go to the Makefile and alter it and add this stuff into a variable
try something like somewhere after the av stuff is added in.
EXTRALIBS+=-L/usr/X11R6/lib -lX11
Code:

gcc -Wl,--warn-common -rdynamic -g -o ffmpeg_g ffmpeg.o cmdutils.o -L./libavformat -lavformat -L./libavcodec -lavcodec -L./libavutil -lavutil -L/usr/X11R6/lib -lX11 -lm -lvorbis -lvorbisenc -lmp3lame -logg -lx264 -lz -llzo -ldl -lpthread
you can find missing objects like this
Code:

(10:51pm:02/18/06)
(gary) /usr/X11R6/lib  $ objdump -t libX11.so | grep XSync   
00031c90 l    F .text  0000002b              _XSyncFunction
00031b90 g    F .text  000000fc              XSync
00031cc0 g    F .text  0000009f              XSynchronize
(10:51pm:02/18/06)
(gary) /usr/X11R6/lib  $ objdump -t libX11.so | grep XDrawPoint
00017a00 g    F .text  00000180              XDrawPoint
00017b80 g    F .text  000003cb              XDrawPoints

might be more x libs we need ? but you get the picture

joslar 02-19-2006 12:48 PM

THANK YOU!, though I have done it otherwise, editing the config.mak and adding the following thing in LDFLAGS =
Code:

LDFLAGS=-Wl,--warn-common
Code:

LDFLAGS=-Wl,--warn-common -L/usr/X11R6/lib -lX11

mrchaos 02-20-2006 02:28 PM

:)


(that's all I really have to say... THANK YOU SO MUCH!)

Musikolo 09-30-2006 08:38 AM

Thanks so much too! I had the same issue too. However I've fixed it in cleaner way. Just add this when you issue the 'configure' command:


--extra-ldflags='-L/usr/X11R6/lib -lX11'


I hope this helps someone else! :D


All times are GMT -5. The time now is 07:42 AM.