andreas1234567 has asked for the wisdom of the Perl Monks concerning the following question:
I would like to use Devel::CheckLib to check that a number of PHP header files (e.g. php_main.h) are present:
The problem is that the compilation of the header file above apparently need some compiler flags or other options set in order to be successful. To say that the PHP build process is difficult is an understatement. Any light into how, if at all possible, to use Devel::CheckLib in this context is highly appreciated.use strict; use warnings; use Devel::CheckLib; our $debug ||= 0; my @headers = qw ( php_main.h ); my @incpath = qw( /usr/local/include /usr/local/include/php /usr/local/include/php/main /usr/local/include/php/TSRM /usr/local/include/php/Zend /usr/local/include/php/ext /usr/local/include/php/ext/date/lib ); check_lib_or_exit( header => \@headers, incpath => \@incpath, debug => $debug, ); __END__ $ perl -s check.pl -debug 1 | head -20 # /usr/bin/cc assertlibFY1Ue6D2.c -I/usr/local/include -I/usr/local/in +clude/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM + -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/lo +cal/include/php/ext/date/lib -o assertlibZUeAsG6l In file included from /usr/local/include/php/Zend/zend_globals.h:28, from /usr/local/include/php/main/php_main.h:25, from assertlibFY1Ue6D2.c:1: /usr/local/include/php/Zend/zend_globals_macros.h: In function ‘BEGIN_ +EXTERN_C’: /usr/local/include/php/Zend/zend_globals_macros.h:37: error: expected +‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘struct’ /usr/local/include/php/Zend/zend_globals_macros.h:47: error: expected +‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘zend_executor_globals +’ /usr/local/include/php/Zend/zend_globals_macros.h:56: error: expected +‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘zend_scanner_globals’ /usr/local/include/php/Zend/zend_globals_macros.h:66: error: expected +‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘zend_scanner_globals’ /usr/local/include/php/Zend/zend_globals_macros.h:69: error: expected +declaration specifiers before ‘END_EXTERN_C’
Update: As suggested by Anonymous Monk my problem boils down to how to make the following compile:
Devel::CheckLib adds platform independence, but making it compile on at least one platform would be a good start. ENV:$ cat foo.c #include <php_main.h> int main(void) { return 0; } $ /usr/bin/gcc foo.c -I/usr/local/include -I/usr/local/include/php -I/ +usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local +/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/p +hp/ext/date/lib -o foo
gcc version 4.2.4 (Ubuntu 4.2.4-1ubuntu3) Linux 2.6.24-22-generic #1 SMP Mon Nov 24 18:32:42 UTC 2008 i686 GNU/L +inux This is perl, v5.8.8 built for i486-linux-gnu-thread-multi PHP 5.2.6 (cli) Zend Engine v2.2.0
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Use Devel::CheckLib to check for PHP dependencies
by Anonymous Monk on Jan 01, 2009 at 14:31 UTC |