Php 在使用gn build构建V8之后编译v8js扩展(与gyp相反)

Php 在使用gn build构建V8之后编译v8js扩展(与gyp相反),php,v8,Php,V8,谷歌已经决定不推荐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

谷歌已经决定不推荐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
在用gn编译V8之后,需要做什么来编译PHPV8JS扩展


谢谢

经过两天的实验,我成功地针对使用gn构建的V8编译了v8js(而不是现在不推荐的gyp)

遵循最初的结帐说明

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\u build\u config.json
,使用:“v8\u enable\u i18n\u support”:false

编译(大约需要45分钟):

一旦编制完成:

$ 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
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


print:/usr/local/src/v8/out.gn/x64.release/obj/libv8_libplatform.a:在gn还不能工作的平台上,gyp仍然完全受支持。使用gyp。我完全按照你说的做,但仍然缺少libv8_libplatform.a,
[root@osboxesobj]#echo-e“创建/usr/lib/libv8_libplatform.a\naddlib/usr/local/src/v8/out.gn/x64.release/obj/libv8_libplatform.a\nsave\nend”| sudo ar-M ar:/usr/local/src/v8/out.gn/x64.release/obj/libv8_libplatform.a:没有这样的文件或目录
我已经为这个问题工作了4天,没有运气。请编辑您的答案并使用“代码示例”以提高可读性。
phpize
./configure
make && make install