mwa*_*way 5 linux php centos pecl
遇到 v8js-0.1.2(测试版)的问题 - 我看到其他人在网上取得了成功,但无论我运行的是什么平台/操作系统,我总是遇到同样的问题。
我目前正在尝试直接通过pecl和phpize在源上使用后构建模块。它找到 V8 安装,configure成功,然后make出错:
/usr/local/src/v8js-0.1.2/v8js.cc: In function 'int zm_startup_v8js(int, int)':
/usr/local/src/v8js-0.1.2/v8js.cc:1135: error: 'PHP_V8_VERSION' was not declared in this scope
/usr/local/src/v8js-0.1.2/v8js.cc: In function 'void zm_info_v8js(zend_module_entry*)':
/usr/local/src/v8js-0.1.2/v8js.cc:1231: error: 'PHP_V8_VERSION' was not declared in this scope
make: *** [v8js.lo] Error 1
Run Code Online (Sandbox Code Playgroud)
如果我添加#define PHP_V8_VERSION "0.1.2"v8js.cc,我会得到:
/usr/bin/ld: cannot find -lv8
collect2: ld returned 1 exit status
make: *** [v8js.la] Error 1
Run Code Online (Sandbox Code Playgroud)
这是在make抱怨,因为它没有使用提供的 v8 lib 路径,而是试图libv8.so在默认的 lib 路径中查找。如果我将其符号链接到位,我会得到:
/usr/bin/ld: skipping incompatible /usr/local/lib/libv8.a when searching for -lv8
/usr/bin/ld: cannot find -lv8
collect2: ld returned 1 exit status
make: *** [v8js.la] Error 1
Run Code Online (Sandbox Code Playgroud)
当 libv8.a 直接来自新编译的 V8 时。有人有什么想法吗?
附录:我会标记这个v8,v8js但我还没有足够的代表。对不起!:(
编辑:
在尝试使用 重建 V8(通过 scons)后library=shared,我遇到了更多问题:
obj/sample/shell/release/shell.o: In function `RunMain(int, char**)':
shell.cc:(.text+0xf14): undefined reference to `v8::internal::Thread::Join()'
shell.cc:(.text+0xff4): undefined reference to `v8::internal::Thread::Thread(v8::internal::Isolate*, v8::internal::Thread::Options const&)'
shell.cc:(.text+0x1008): undefined reference to `v8::internal::Thread::Start()'
shell.cc:(.text+0x10a3): undefined reference to `v8::internal::OS::CreateSemaphore(int)'
shell.cc:(.text+0x10b2): undefined reference to `v8::internal::OS::CreateSemaphore(int)'
obj/sample/shell/release/shell.o: In function `SourceGroup::IsolateThread::~IsolateThread()':
shell.cc:(.text._ZN11SourceGroup13IsolateThreadD0Ev[SourceGroup::IsolateThread::~IsolateThread()]+0x14): undefined reference to `v8::internal::Thread::~Thread()'
obj/sample/shell/release/shell.o: In function `SourceGroup::IsolateThread::~IsolateThread()':
shell.cc:(.text._ZN11SourceGroup13IsolateThreadD1Ev[SourceGroup::IsolateThread::~IsolateThread()]+0xe): undefined reference to `v8::internal::Thread::~Thread()'
collect2: ld returned 1 exit status
scons: *** [shell] Error 1
scons: building terminated because of errors.
Run Code Online (Sandbox Code Playgroud)
我应该使用最新版本以外的 V8 版本吗?另外,如果我保持原样(静态,使用 libv8.a),是否可以使用静态 PHP 模块?无论出于何种原因,configure在 v8js-0.1.2 源代码上运行都不允许我禁用共享和启用静态;它们都默认启用,并且传递--disabled-shared或--enable-shared=no(与默认yes值相反)使共享启用并禁用静态。
编辑2:
经过 3 个多小时的反复编译,问题似乎是您sample=shell在使用library=shared. 这似乎不合理,AFAICT 可能是一个错误,但是,使用arch=x64并library=shared为我工作,然后我能够链接libv8.so到正确的位置并编译 v8js PHP 扩展。
现在的问题是 PHP 似乎实际上无法找到共享对象:
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/local/php-5.3.6/lib/php/extensions/no-debug-non-zts-20090626/v8js.so' - libv8.so: cannot open shared object file: No such file or directory in Unknown on line 0
Run Code Online (Sandbox Code Playgroud)
当 libv8.so 驻留在/usr/local/v8/libv8.so. 我试过将该目录附加到$PATH,将 libv8.so 链接到扩展目录等。有什么想法吗?
您需要 libv8.so(共享库,.a 通常不是共享库)位于 ld 可以找到的地方 - /usr/lib/、/usr/local/lib/ 或 /etc/ld 中指定的任何路径。 so.conf(您可以在那里添加任何您想要的目录)