tony2001 / ffmpeg-php

PHP extension for video editing, wrapping ffmpeg

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Compilation errors against ffmpeg 1.0.3 and 1.1.1

xl32 opened this issue · comments

Tried to build it against ffmpeg 1.0.3 on CentOS 6.3 x86_64:

/bin/sh /root/ffmpeg-php/libtool --mode=compile cc  -I. -I/root/ffmpeg-php -DPHP_ATOM_INC -I/root/ffmpeg-php/include -I/root/ffmpeg-php/main -I/root/ffmpeg-php -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib -I/usr/local/include/libavcodec/ -I/usr/local/include/libavformat/ -I/usr/local/include/libavutil/ -I/usr/local/include/libswscale/ -I/usr/local/include/libavfilter/ -I/usr/local/include/libavdevice/  -DHAVE_CONFIG_H  -g -O2 -Wall -fno-strict-aliasing   -c /root/ffmpeg-php/ffmpeg-php.c -o ffmpeg-php.lo
libtool: compile:  cc -I. -I/root/ffmpeg-php -DPHP_ATOM_INC -I/root/ffmpeg-php/include -I/root/ffmpeg-php/main -I/root/ffmpeg-php -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib -I/usr/local/include/libavcodec/ -I/usr/local/include/libavformat/ -I/usr/local/include/libavutil/ -I/usr/local/include/libswscale/ -I/usr/local/include/libavfilter/ -I/usr/local/include/libavdevice/ -DHAVE_CONFIG_H -g -O2 -Wall -fno-strict-aliasing -c /root/ffmpeg-php/ffmpeg-php.c  -fPIC -DPIC -o .libs/ffmpeg-php.o
In file included from /usr/include/sys/stat.h:107,
                 from /usr/include/php/main/php_streams.h:28,
                 from /usr/include/php/main/php.h:396,
                 from /root/ffmpeg-php/ffmpeg-php.c:40:
/usr/include/bits/stat.h:91: error: field ‘st_atim’ has incomplete type
/usr/include/bits/stat.h:92: error: field ‘st_mtim’ has incomplete type
/usr/include/bits/stat.h:93: error: field ‘st_ctim’ has incomplete type
/usr/include/bits/stat.h:152: error: field ‘st_atim’ has incomplete type
/usr/include/bits/stat.h:153: error: field ‘st_mtim’ has incomplete type
/usr/include/bits/stat.h:154: error: field ‘st_ctim’ has incomplete type
In file included from /usr/include/php/main/php_streams.h:28,
                 from /usr/include/php/main/php.h:396,
                 from /root/ffmpeg-php/ffmpeg-php.c:40:
/usr/include/sys/stat.h:367: error: array type has incomplete element type
/usr/include/sys/stat.h:374: error: array type has incomplete element type
In file included from /usr/include/php/main/php.h:402,
                 from /root/ffmpeg-php/ffmpeg-php.c:40:
/usr/include/php/TSRM/tsrm_virtual_cwd.h:218: error: expected specifier-qualifier-list before ‘time_t’
/usr/include/php/TSRM/tsrm_virtual_cwd.h:246: error: expected declaration specifiers or ‘...’ before ‘time_t’
make: *** [ffmpeg-php.lo] Error 1

Apparently newer ffmpeg versions contain time.h header, which breaks the build if we add the path to it to the include path.
I don't see an easy way to fix this without breaking the build for older ffmpeg versions, so I guess it just has to be done.
Fixed in git, but the extension won't build with older ffmpeg releases after that.
Thanks for reporting this, btw.

Thank you for fast response!

Please apply a small fix:

config.m4, line 24 ("if" missing):
if test -f $i/include/libavcodec/avcodec.h; then

Oh, indeed, sorry about that.
Pushed the fix.

How to fix this ?