使用Buildroot工具链交叉编译V8



有人能提供使用Buildroot工具链交叉编译V8的建议吗?

我需要将V8单体库嵌入到当前使用CMake的C++应用程序中。在Buildroot下,cmake包自动提供了一个toolchain.cmake文件,以确保使用正确的编译器、sysroot和C++库等。

我可以使用gn args设置sysroot,并了解有一个custom_toolchain参数我可以设置为某种描述的工具链定义文件的路径?

文档似乎有点欠缺。有人有为基于buildroot的项目编译V8的经验吗;自定义工具链">

我能够如下交叉编译V8。

在tools/toolchain/BUILD.gn中,我添加了:

gcc_toolchain("arm64-buildroot") {
toolprefix = "/path/to/buildroot/output/host/bin/aarch64-linux-"
cc = "${toolprefix}gcc"
cxx = "${toolprefix}g++"
readelf = "${toolprefix}readelf"
nm = "${toolprefix}nm"
ar = "${toolprefix}ar"
ld = cxx
toolchain_args = {
current_cpu = "arm64"
current_os = "linux"
is_clang = false
}
}

运行gn gen out/arm64并使用gn args out/arm64:设置构建参数

custom_toolchain = "//tools/toolchain:arm64-buildroot"
target_cpu = "arm64"
target_os = "linux"
target_sysroot = "/path/to/buildroot/output/host/aarch64-buildroot-linux-gnu/sysroot"
is_clang = false
use_gold = false
is_component_build = false
v8_monolithic = true
v8_use_external_startup_data = false

然后构建库:

ninja -C out/arm64 v8_monolith

有关更多信息,请参阅:https://gn.googlesource.com/gn/+/master/docs/reference.md#定义工具链的示例

最新更新