如何为 Raspberry Pi 交叉构建最新版本的 V8?

How do I cross build the latest version of V8 for Raspberry Pi?

我一直在尝试像这样为 Raspberry Pi 交叉构建 V8:

sudo apt-get install gcc-arm-linux-gnueabihf g++-arm-linux-gnueabihf g++-multilib-arm-linux-gnueabihf
cd ~/
mkdir ~/build/
cd ~/build/
git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
export PATH=~/build/depot_tools:"$PATH"
fetch v8
cd v8
make arm.release snapshot=off arm_version=6 armfpu=vfp

但是由于很多不同的原因,它无法编译。我做错了什么?

在 Ubuntu 16.04 LTS x64 上为 Raspberry Pi 交叉编译 V8。

首先获取交叉编译器和必要的库:

sudo apt-get install gcc-4.9-arm-linux-gnueabihf g++-4.9-arm-linux-gnueabihf g++-4.9-multilib-arm-linux-gnueabihf libc6-armhf-cross

然后获取 depot 工具,它将检索 V8。

cd ~/
mkdir ~/build/
cd ~/build/
git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git

接下来设置 depot tools 的路径并获取最新版本的 V8。

export PATH=~/build/depot_tools:"$PATH"
fetch v8

现在让我们准备构建的交叉构建脚本。

cd v8/tools
nano ./cross_build_gcc.sh

在 CXX、CC、LD 和 LINK 的末尾添加 -4.9。所以它应该看起来像:

export CXX=g++-4.9
export AR=ar
export RANLIB=ranlib
export CC=gcc-4.9
export LD=g++-4.9
export LINK=g++-4.9

保存并退出。

现在我们必须创建一个 link 到 asm-generic 以便在编译时找到头文件。

cd ..
ln -s /usr/include/asm-generic /usr/include/asm

现在我们可以开始编译了。

./tools/cross_build_gcc.sh /usr/bin/arm-linux-gnueabihf- arm.release arm_version=6 armfpu=vfp armfloatabi=hard