On 9 Aug 2009, at 22:52, Farley Knight wrote:

On Mon, Jul 13, 2009 at 7:17 PM, Paul Biggar<paul.big...@gmail.com> wrote:
Hi Thomas,

On Mon, Jul 13, 2009 at 9:15 PM, Thomas Koch<tho...@koch.ro> wrote:
gcc  -c -I/usr/local/include/php/ -I/usr/local/include/php/main -
I/usr/local/include/php/Zend -I/usr/local/include/php/TSRM -Wall - g -o
worker.o worker.c
gcc  -L/usr/local/lib -lphp5 -o worker worker.o
worker.o: In function `main':
/var/checkouts/gearman-php-worker/worker.c:5: undefined reference to
`php_embed_init'
/var/checkouts/gearman-php-worker/worker.c:6: undefined reference to
`php_embed_shutdown'
collect2: ld returned 1 exit status
make: *** [all] Error 1

This worked for me, with your commands and program. Since its a linker error, it seems likely that you haven't installed libphp5.so properly. You didn't indicate that you ran make install, did you? If so, you may
want to verify that there is a libphp5.so in /usr/local/lib, and that
it is a shared library.



I don't think Thomas is completely off here.. For most of the morning
I've been trying to compile 5.3.0:

make clean; ./configure --enable-embed=shared; make && sudo make install

But when I went to build

#include <sapi/embed/php_embed.h>

int main(int argc, char *argv[]) {
 PHP_EMBED_START_BLOCK(argc, argv);
 PHP_EMBED_END_BLOCK();

 return 0;
}

using

gcc -o embed_test embed_test.c -I/usr/local/include/php/
-I/usr/local/include/php/main -I/usr/local/include/php/Zend
-I/usr/local/include/php/TSRM -L/usr/local/lib -lphp5

I kept getting

/tmp/cc9OgNuw.o: In function `main':
embed_test.c:(.text+0x21): undefined reference to `php_embed_init'
embed_test.c:(.text+0x65): undefined reference to `php_embed_shutdown'

However, when I run config and make for 5.2.10, the test file compiles
just fine. Something must have changed between the two versions... Not
sure what, though.. Probably will dig deeper into this..



This fixed in SVN already, the visibility for the two functions stopped them being exposed in the library.

Scott


--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to