在使用 gn build(相对于 gyp)构建 V8 之后编译 v8js 扩展
Compiling v8js extension after V8 was built with gn build (as opposed to gyp)
Google 已决定弃用 V8 的 gyp 版本。推荐的方法是用gn.
构建
但是,PHP 扩展 v8js 找不到所需的库并退出:
checking for V8 Javascript Engine... yes, shared
checking for g++... g++
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking how to run the C++ preprocessor... g++ -E
checking for C standard version... c++11
checking how to allow c++11 narrowing... -Wno-narrowing
checking for V8 version... NONE
configure: error: could not determine libv8 version
V8用gn编译后,编译PHPv8js扩展需要做什么?
谢谢!
经过两天的实验,我已经成功地针对使用 gn 构建的 V8(与现在已弃用的 gyp)编译了 v8js。
按照初始结帐说明进行操作 https://github.com/v8/v8/wiki/Building%20with%20GN。
在 tools/dev/v8gen.py x64.release
步骤之后执行此操作:
$ nano out.gn/x64.release/args.gn
它应该是这样的:
is_debug = false
target_cpu = "x64"
is_component_build = true
v8_enable_i18n_support = false
此时我不知道如何正确构建 i18n 支持。
不确定这是否真的需要,但我还更新了 out.gn/x64.release/v8_build_config.json
:"v8_enable_i18n_support": false.
编译(大约需要 45 分钟):
$ ninja -C out.gn/x64.release
编译后:
$ cp out.gn/x64.release/lib*.so /usr/lib/ && cp -R include/* /usr/include
$ cp out.gn/x64.release/natives_blob.bin /usr/lib
$ cp out.gn/x64.release/snapshot_blob.bin /usr/lib
$ cd out.gn/x64.release/obj
$ ar rcsDT libv8_libplatform.a v8_libplatform/*.o
$ echo -e "create /usr/lib/libv8_libplatform.a\naddlib /usr/local/src/v8/out.gn/x64.release/obj/libv8_libplatform.a\nsave\nend" | sudo ar -M
之后检查 v8js 并照常编译:
phpize
./configure
make && make install
回声-e "create/usr/lib/libv8_libplatform.a\naddlib /usr/local/src/v8/out.gn/x64.release/obj/libv8_libplatform.a\nsave\nend" | sudo ar -M
print : /usr/local/src/v8/out.gn/x64.release/obj/libv8_libplatform.a: 没有那个文件或目录
Google 已决定弃用 V8 的 gyp 版本。推荐的方法是用gn.
构建但是,PHP 扩展 v8js 找不到所需的库并退出:
checking for V8 Javascript Engine... yes, shared
checking for g++... g++
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking how to run the C++ preprocessor... g++ -E
checking for C standard version... c++11
checking how to allow c++11 narrowing... -Wno-narrowing
checking for V8 version... NONE
configure: error: could not determine libv8 version
V8用gn编译后,编译PHPv8js扩展需要做什么?
谢谢!
经过两天的实验,我已经成功地针对使用 gn 构建的 V8(与现在已弃用的 gyp)编译了 v8js。
按照初始结帐说明进行操作 https://github.com/v8/v8/wiki/Building%20with%20GN。
在 tools/dev/v8gen.py x64.release
步骤之后执行此操作:
$ nano out.gn/x64.release/args.gn
它应该是这样的:
is_debug = false
target_cpu = "x64"
is_component_build = true
v8_enable_i18n_support = false
此时我不知道如何正确构建 i18n 支持。
不确定这是否真的需要,但我还更新了 out.gn/x64.release/v8_build_config.json
:"v8_enable_i18n_support": false.
编译(大约需要 45 分钟):
$ ninja -C out.gn/x64.release
编译后:
$ cp out.gn/x64.release/lib*.so /usr/lib/ && cp -R include/* /usr/include
$ cp out.gn/x64.release/natives_blob.bin /usr/lib
$ cp out.gn/x64.release/snapshot_blob.bin /usr/lib
$ cd out.gn/x64.release/obj
$ ar rcsDT libv8_libplatform.a v8_libplatform/*.o
$ echo -e "create /usr/lib/libv8_libplatform.a\naddlib /usr/local/src/v8/out.gn/x64.release/obj/libv8_libplatform.a\nsave\nend" | sudo ar -M
之后检查 v8js 并照常编译:
phpize
./configure
make && make install
回声-e "create/usr/lib/libv8_libplatform.a\naddlib /usr/local/src/v8/out.gn/x64.release/obj/libv8_libplatform.a\nsave\nend" | sudo ar -M
print : /usr/local/src/v8/out.gn/x64.release/obj/libv8_libplatform.a: 没有那个文件或目录