Writing PHP extension - Unable to load dynamic library
Posted
by
Luke
on Stack Overflow
See other posts from Stack Overflow
or by Luke
Published on 2012-04-09T23:23:46Z
Indexed on
2012/04/09
23:30 UTC
Read the original article
Hit count: 469
I'm writing a PHP extension similar to V8JS. The goal, like V8JS, is to embed the V8 engine into PHP so I can execute sandboxed JavaScript code in PHP. (The implementation is different.)
The extension compiles fine, but when I attempt to run it I get:
PHP Warning: PHP Startup: Unable to load dynamic library '/phpdev/lib/php/extensions/debug-zts-20090626/v8php.so' - dlopen(/phpdev/lib/php/extensions/debug-zts-20090626/v8php.so, 9): Symbol not found: __ZN2v88internal8Snapshot13context_size_E
Referenced from: /phpdev/lib/php/extensions/debug-zts-20090626/v8php.so Expected in: flat namespace
PHP is compiled with the prefix /phpdev (with debug and maintainer flags).
v8 is compiled in /v8/ with gyp with the commands make dependencies
and make x64
which produced /v8/out/x64.release
and /v8/out/x64.debug
. I soft-linked the header files from /v8/include
to /phpdev/include
and libv8_base.a
from /v8/out/x64.release/libv8_base.a
to /phpdev/lib/libv8.a
.
This is my config.m4 file:
PHP_ARG_ENABLE(v8php,
[V8PHP],
[--enable-v8php Include V8 JavaScript Engine])
if test $PHP_V8PHP != "no"; then
SEARCH_PATH="$prefix /usr/local /usr"
SEARCH_FOR="/include/v8.h"
if test -r $PHP_V8PHP/$SEARCH_FOR; then
V8_DIR=$PHP_V8PHP
else
AC_MSG_CHECKING([for V8 files in default path])
for i in $SEARCH_PATH ; do
if test -r $i/$SEARCH_FOR; then
V8_DIR=$i
AC_MSG_RESULT(found in $i)
fi
done
fi
if test -z "$V8_DIR"; then
AC_MSG_RESULT([not found])
AC_MSG_ERROR([Unable to locate V8])
fi
PHP_ADD_INCLUDE($V8_DIR/include)
PHP_SUBST(V8PHP_SHARED_LIBADD)
PHP_ADD_LIBRARY_WITH_PATH(v8, $V8_DIR/$PHP_LIBDIR, V8PHP_SHARED_LIBADD)
PHP_REQUIRE_CXX()
PHP_NEW_EXTENSION(v8php, v8php.cc v8_class.cc, $ext_shared)
fi
What am I doing wrong?
© Stack Overflow or respective owner