简体   繁体   English

为树莓派交叉编译Google v8库

[英]Cross compile google v8 library for raspberry pi

I am having a problem with cross compiling google v8 libraries for raspberry pi, and constantly getting "Illegal instruction" error when compiling official sample from site. 我在交叉编译树莓派的Google v8库时遇到问题,并且在从站点编译官方样本时不断收到“非法说明”错误。 These are the steps i followed: 这些是我遵循的步骤:

  1. Downloaded cross compile https://github.com/raspberrypi/tools/ 下载交叉编译https://github.com/raspberrypi/tools/
  2. Cloned v8 git https://chromium.googlesource.com/v8/v8.git 克隆的v8 git https://chromium.googlesource.com/v8/v8.git
  3. Exported CXX LINK point to arm-linux-gnueabihf-g++ from cross compile tools. 从交叉编译工具导出的CXX LINK指向arm-linux-gnueabihf-g++
  4. run make arm.release armv7=false hardfp=on snapshot=off armfpu=vfp armfloatabi=hard -j5 运行make arm.release armv7=false hardfp=on snapshot=off armfpu=vfp armfloatabi=hard -j5
  5. Copied generated executable shell and d8 from out/arm.release directory to pi (Raspbian kernel version 3.6.11) and it WORKS. 从out / arm.release目录将生成的可执行shelld8复制到pi(Raspbian内核版本3.6.11),然后运行。 These steps prove that cross compilation toolchain is functional. 这些步骤证明了交叉编译工具链是有效的。

Problem occurs when trying to run other cross-compiled software that is linked to v8 libraries. 尝试运行链接到v8库的其他交叉编译软件时,会出现问题。 For example sample code from https://developers.google.com/v8/get_started#intro . 例如来自https://developers.google.com/v8/get_started#intro的示例代码。 Code is cross-compiled with this command (same as example, just changed compiler) 使用此命令对代码进行交叉编译(与示例相同,只是更改了编译器)

arm-linux-gnueabihf-g++ -I. hello_world.cc -o hello_world -Wl,--start-group out/x64.release/obj.target/{tools/gyp/libv8_{base,libbase,snapshot,libplatform},third_party/icu/libicu{uc,i18n,data}}.a -Wl,--end-group -lrt -pthread

When i copy that code to pi and run it i get SIGILL (Illegal instruction). 当我将该代码复制到pi并运行它时,我得到SIGILL(非法指令)。

Note: cross compiled software that doesn't use v8 libraries works fine. 注意:不使用v8库的交叉编译软件可以正常工作。 Also x64 v8 libraries on host computer work fine. 主机上的x64 v8库也可以正常工作。

On newer kernel versions shell and d8 were also throwing SIGILL but than i switched to older version 3.6.11 (problems with newer kernel https://groups.google.com/forum/#!topic/v8-users/IPT9EeYK9bg ) and they started working, but compiled sample code is still showed same issues. 在较新的内核版本上, shelld8也抛出了SIGILL,但是我切换到了较旧的版本3.6.11(较新的内核https://groups.google.com/forum/#!topic/v8-users/IPT9EeYK9bg的问题),它们开始工作,但编译后的示例代码仍然显示相同的问题。

Did anyone have similar experience? 有没有类似的经历? Any suggestion on how to overcome this problem? 关于如何克服这个问题有什么建议吗?

I found a solution thanks to post on v8 google group. 我找到了一个解决方案,这要感谢v8谷歌论坛上的帖子。 https://groups.google.com/forum/#!topic/v8-users/LTppUbqNrzI https://groups.google.com/forum/#!topic/v8-users/LTppUbqNrzI

Problem was in make arguments it should be. 问题在于应该争论。

make arm arm_version=6 armfpu=vfp armfloatabi=hard

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM