[MAC] Problems compiling PECL extension "ffmpeg"

General discussion forum for the Zend Server
Post Reply
dastatzend
Posts: 4
Joined: Tue Aug 11, 2009 12:33 pm

[MAC] Problems compiling PECL extension "ffmpeg"

Post by dastatzend » Mon Oct 05, 2009 1:00 pm

hi,

after a long compiling weekend i'm frustrated.

All my try's compiling ffmpeg-php brings this error on PHP startup:

Code: Select all

PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/zend/lib/php_extensions/ffmpeg.so' - (null) in Unknown on line 0

my history:

Code: Select all

  503  mkdir ffmpeg-php
  504  cd ffmpeg-php/
  508  mkdir lame
  510  cd lame/
  513  cvs -z3   -d:pserver:anonymous@lame.cvs.sourceforge.net:/cvsroot/lame   co -P lame
  514  cd lame/
  515  ./configure
  516  make
  517  sudo make install
  518  cd ..
  
  522  mkdir faad
  523  cd faad/
  524  wget http://downloads.sourceforge.net/faac/faad2-2.7.tar.gz
  525  tar xpzf ./faad2-2.7.tar.gz 
  526  cd faad2-2.7
  530  ./configure
  531  make
  532  sudo make install
  534  cd ../..
  
  561  svn checkout svn://svn.ffmpeg.org/ffmpeg/trunk ffmpeg
  562  cd ffmpeg
  583  make clean
  584  ./configure --prefix=/usr/local/zend/ && make
  585  sudo make install
  557  cd ..
  
  505  svn co https://ffmpeg-php.svn.sourceforge.net/svnroot/ffmpeg-php ffmpeg-php
  537  cd ffmpeg-php/trunk/ffmpeg-php/
  471  make clean
  472  phpize
  473  ./configure --prefix=/usr/local/zend/ --with-php-config=/usr/local/zend/bin/php-config
  474  make
  475  make test

my source dir named ffmpeg-php/ has this dirs:

Code: Select all

ffmpeg-php/:
drwxr-xr-x  4 dast  staff  136  4 Okt 20:12 faad
drwxr-xr-x  3 dast  staff  102  4 Okt 20:07 lame
drwxr-xr-x  6 dast  staff  204  4 Okt 20:05 ffmpeg
drwxr-xr-x  6 dast  staff  204  4 Okt 20:05 ffmpeg-php

on "make test" i get:

Code: Select all

PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/zend/lib/php_extensions/ffmpeg.so' - (null) in Unknown on line 0
=> all Tests fail ;(


same error in oho.log on integrating the lib in the php.ini

Code: Select all

> otool -L /usr/local/zend/lib/php_extensions/ffmpeg.so

produces this output:

/usr/local/zend/lib/php_extensions/ffmpeg.so:
	/usr/local/lib/libswscale.dylib (compatibility version 0.0.0, current version 0.7.1)
	/usr/local/lib/libavformat.dylib (compatibility version 52.0.0, current version 52.39.0)
	/usr/local/lib/libavcodec.dylib (compatibility version 52.0.0, current version 52.36.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 124.1.1)

any ideas how i can find the problem ?

best regards,
Daniel.

jess04
Posts: 628
Joined: Thu Jan 15, 2009 3:37 pm

Re: [MAC] Problems compiling PECL extension "ffmpeg"

Post by jess04 » Mon Oct 05, 2009 4:45 pm

Hello,

I believe you have the same issue as here:
viewtopic.php?f=44&t=2186&hilit=xdebug&start=10#p8640

Basically, ZS, up till now, was built in 32bit mode and 10.6 is 64bit only by default, so you have to explicitly export CFLAGS="-arch i386" before compiling.

Let me know if you require further assistance,

P.S
This will be fixed in the next release.
May the source be with you,

Jess Portnoy

dastatzend
Posts: 4
Joined: Tue Aug 11, 2009 12:33 pm

Re: [MAC] Problems compiling PECL extension "ffmpeg"

Post by dastatzend » Tue Oct 06, 2009 3:08 pm

Hi Jess,

thanks for this Tip.


-----edit:

i switch from ffmpeg-php extensipon to this PHP Lib:

http://sourceforge.net/projects/phpvideotoolkit/

phpVideoToolkit uses a ffmpeg binary and parse the output.

now i only create ffmpeg binarys with static libs inside for win+mac+linux and have no compiling work.

Thanks and best regards..

-----:edit

But now i run in new problems:

Code: Select all

dyld: lazy symbol binding failed: Symbol not found: _avcodec_init
  Referenced from: /usr/local/zend/lib/php_extensions/ffmpeg.so
  Expected in: flat namespace

dyld: Symbol not found: _avcodec_init
  Referenced from: /usr/local/zend/lib/php_extensions/ffmpeg.so
  Expected in: flat namespace

/bin/sh: line 1: 21420 Trace/BPT trap          TEST_PHP_EXECUTABLE=/usr/local/zend/bin/php TEST_PHP_SRCDIR=/Users/dast/Desktop/data/php/installer/ffmpeg-php CC="cc" /usr/local/zend/bin/php -d 'open_basedir=' -d 'output_buffering=0' -d 'memory_limit=-1' /Users/dast/Desktop/data/php/installer/ffmpeg-php/run-tests.php -d extension_dir=modules/ ` if test "x/Users/dast/Desktop/data/php/installer/ffmpeg-php/modules/ffmpeg.la" != "x"; then for i in /Users/dast/Desktop/data/php/installer/ffmpeg-php/modules/ffmpeg.la""; do . $i; /Users/dast/Desktop/data/php/installer/ffmpeg-php/build/shtool echo -n -- " -d extension=$dlname"; done; fi; if test "x" != "x"; then for i in ""; do . $i; /Users/dast/Desktop/data/php/installer/ffmpeg-php/build/shtool echo -n -- " -d zend_extension=/Users/dast/Desktop/data/php/installer/ffmpeg-php/modules/$dlname"; done; fi` tests/
make: [test] Error 133 (ignored)
I wait for the next ZendServer release and try again.


my used install steps/script:

Code: Select all

#!/bin/bash

# ffmpeg-php installer for zend server 4.0.5 mac snow leopard 

pwd
echo
echo "press Enter for download+compile+install lame codec lib"
read
mkdir lame
cvs -z3 -d:pserver:anonymous@lame.cvs.sourceforge.net:/cvsroot/lame co -P lame
cd lame/
export CFLAGS='-arch i386'
./configure --prefix=/usr/local/zend/
#./configure --prefix=/usr/local
make
echo
pwd
echo "------------------------------------------"
echo "enter password for installing 'lame'"
echo "$USER@../lame> sudo make install"
sudo make install
echo
echo
cd ..


pwd
echo
echo "press Enter for download+compile+install faad codec lib"
read
wget http://downloads.sourceforge.net/faac/faad2-2.7.tar.gz
tar xpzf ./faad2-2.7.tar.gz
cd faad2-2.7
export CFLAGS='-arch i386'
./configure --prefix=/usr/local/zend/
#./configure --prefix=/usr/local
make
echo
pwd
echo "------------------------------------------"
echo "enter password for installing 'faad'"
echo "$USER@../faad2-2.7> sudo make install"
sudo make install
echo
echo
cd ..


pwd
echo
echo "press Enter for download+compile+install ffmpeg"
read
svn checkout svn://svn.ffmpeg.org/ffmpeg/trunk ffmpeg
cd ffmpeg

#myConfigure="./configure --prefix=/usr/local/zend/ --enable-libmp3lame --enable-shared --disable-mmx --arch=i386 --libdir=/usr/local/zend/ --incdir=/usr/local/zend/include --shlibdir=/usr/local/zend/lib --extra-ldflags=-L/usr/local/zend/lib --extra-cflags=-I/usr/local/zend//include"
myConfigure="./configure --prefix=/usr/local/zend/ --enable-libmp3lame --enable-shared --disable-mmx --arch=i386 --libdir=/usr/local/zend/"
#myConfigure="./configure --prefix=/usr/local --enable-libmp3lame --enable-shared --disable-mmx --arch=i386 --libdir=/usr/local/"

echo "------------------------------------------"
echo "$(pwd)> $myConfigure"
echo
export CFLAGS=''
$myConfigure
echo "------------------------------------------"
echo "$(pwd)> make"
echo
make
echo
echo
pwd
echo "------------------------------------------"
echo "enter password for installing 'ffmpeg'"
echo "$USER@../ffmpeg> sudo make install"
sudo make install
echo
echo
cd ..



pwd
echo
echo "press Enter for download+compile+install ffmpeg-php"
read
svn co https://ffmpeg-php.svn.sourceforge.net/svnroot/ffmpeg-php/trunk/ffmpeg-php ffmpeg-php
cd ffmpeg-php
export CFLAGS='-arch i386'
/usr/local/zend/bin/phpize
./configure --prefix=/usr/local/zend/ --with-php-config=/usr/local/zend/bin/php-config --libdir=/usr/local/zend/ --includedir=/usr/local/zend/ --with-ffmpeg=/usr/local/zend/
make
echo
echo "----------------begin tests:------------------------------"
echo
make test
echo
pwd
echo "------------------------------------------"
echo "enter password for installing 'ffmpeg-php'"
echo "$USER@../ffmpeg-php> sudo make install"
sudo make install
echo
echo
cd ..

echo "all done"

best regards,
Daniel.

Post Reply