遇到v8js-0.1.2(beta)的问题 – 我看到其他人在网上取得了成功,但不管我运行的是什么平台/操作系统,我总是遇到同样的问题.
我目前正在尝试直接通过pecl构建模块,并在源代码上使用phpize后构建.它找到V8安装,配置成功,然后输出错误:
/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
如果我在v8js.cc中添加#define PHP_V8_VERSION“0.1.2”,那么我得到:
/usr/bin/ld: cannot find -lv8
collect2: ld returned 1 exit status
make: *** [v8js.la] Error 1
这是抱怨,因为它没有使用提供的v8 lib路径,而是试图在默认的lib路径中找到libv8.so.如果我将它符号链接到位,我得到:
/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
当libv8.a直接来自新编译的V8时.有人有什么想法?
附录:我会标记这个v8和v8js,但我还没有足够的代表.抱歉! 🙁
编辑:
在尝试使用library = shared重建V8(通过scons)之后,我遇到了更多问题:
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.
我应该使用除最新版本之外的V8版本吗?另外,如果我按原样保留它(静态,使用libv8.a),是否可以使用静态PHP模块?无论出于何种原因,在v8js-0.1.2源上运行configure不允许我禁用共享和启用静态;默认情况下它们都已启用,并且传递–disabled-shared或–enable-shared = no(与默认值相反)会使共享启用并禁用静态.
编辑2:
经过3个小时的重复编译后,问题似乎是你在使用library = shared时不能同时启用sample = shell.这似乎不合理,AFAICT可能是一个bug,但是,使用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
当libv8.so驻留在/usr/local/v8/libv8.so时.我已经尝试将该目录附加到$PATH,将libv8.so链接到扩展目录等.任何想法?