我的yocto设置具有nodejs配方。哪个工作正常。我正在尝试通过添加新配方来交叉编译node-sqlite3软件包。 node-sqlite3取决于node-gyp脚本。脚本使用命令node(machine-image)。
尝试使用主机路径而不是计算机映像路径的构建设置。
node-sqlite3.bb
SUMMARY = "Asynchronous, non-blocking SQLite3 bindings for Node.js"
SECTION = "nodejs/module"
LICENSE = "MIT"
SRC_URI = "https://github.com/mapbox/node-sqlite3/archive/v${PV}.tar.gz"
LIC_FILES_CHKSUM = "file://LICENSE;md5=79558839a9db3e807e4ae6f8cd100c1c"
SRC_URI[md5sum] = "c17036d0db2d147d9af8d7b7057c8c8c"
SRC_URI[sha256sum] = "80d58f84073e524f7d4a39e2ec7b77908862a5629b9a4d882127c807cc093597"
S = "${WORKDIR}/node-sqlite3-${PV}"
DEPENDS = "nodejs node-gyp sqlite3"
inherit nodejs-arch
EXTRA_OECONF = "--with-node=${STAGING_BINDIR_CROSS}/node"
do_configure() {
export LD="${CXX}"
export GYP_DEFINES="sysroot=${STAGING_DIR_HOST}"
node-gyp --arch ${TARGET_ARCH} configure
}
do_compile() {
export LD="${CXX}"
export GYP_DEFINES="sysroot=${STAGING_DIR_HOST}"
node-gyp --arch ${TARGET_ARCH} build
}
do_install() {
install -d ${D}${libdir}/nodejs/sqlite3
install ${S}/build/Release/node_sqlite3.node ${D}${libdir}/nodejs/
install ${S}/lib/sqlite3.js ${D}${libdir}/nodejs/sqlite3/
install ${S}/lib/index.js ${D}${libdir}/nodejs/sqlite3/
install ${S}/lib/trace.js ${D}${libdir}/nodejs/sqlite3/
}
FILES_${PN} += "${libdir}/nodejs ${bindir}node-gyp"
cat node-gyp
#!/usr/bin/env sh
if [ "x$npm_config_node_gyp" = "x" ]; then
node "`dirname "$0"`/../../node_modules/node-gyp/bin/node-gyp.js" "$@"
else
"$npm_config_node_gyp" "$@"
fi
配置,编译时应考虑以下二进制路径。
/poky/build/tmp-glibc/hosttools/node-gyp
/poky/build/tmp-glibc/work/target-sdk/machine-image/1.0-r0/rootfs/usr/lib/node_modules/npm/bin/node-gyp-bin/node-gyp
build/tmp-glibc/work/target-sdk/machine-image/1.0-r0/rootfs/usr/bin/node
但是我遇到了以下错误。
| build/tmp-glibc/work/armv7ahf-neon-oe-linux-gnueabi/node-sqlite3/4.0.8-r0/recipe-sysroot
| /usr/bin/env: ‘node’: No such file or directory
如何解决上述问题?需要更正或包括在node-sqlite3.bb配方中的哪些步骤?