Nodejs node binary core dumped(Ilegal Insatruction) - node.js

I am working on bit-bake environment. I am using nodejs ver 10.15.3
dest cpu == ppc64 linux
My problem is node binary core dumps and I am not able to identify the root cause. I am trying to compile nodejs for dest cpu(ppc64).
I am not sure but I guess there are runtime requirements which are not satisfied on the target machine.
below is my recipe:-
DESCRIPTION = "nodeJS Evented I/O for V8 JavaScript"
HOMEPAGE = "http://nodejs.org"
LICENSE = "MIT & BSD & Artistic-2.0"
LIC_FILES_CHKSUM = "file://LICENSE;md5=9ceeba79eb2ea1067b7b3ed16fff8bab"
DEPENDS = "openssl zlib icu"
DEPENDS_append_class-target = " nodejs-native"
inherit pkgconfig
COMPATIBLE_MACHINE_armv4 = "(!.*armv4).*"
COMPATIBLE_MACHINE_armv5 = "(!.*armv5).*"
COMPATIBLE_MACHINE_mips64 = "(!.*mips64).*"
SRC_URI = "http://nodejs.org/dist/v${PV}/node-v${PV}.tar.xz \
file://0001-Disable-running-gyp-files-for-bundled-deps.patch \
file://0003-Crypto-reduce-memory-usage-of-SignFinal.patch \
file://0004-Make-compatibility-with-gcc-4.8.patch \
file://0005-Link-atomic-library.patch \
file://0006-Use-target-ldflags.patch \
"
SRC_URI_append_class-target = " \
file://0002-Using-native-torque.patch \
"
SRC_URI[md5sum] = "d76210a6ae1ea73d10254947684836fb"
SRC_URI[sha256sum] = "4e22d926f054150002055474e452ed6cbb85860aa7dc5422213a2002ed9791d5"
S = "${WORKDIR}/node-v${PV}"
# v8 errors out if you have set CCACHE
CCACHE = ""
def map_nodejs_arch(a, d):
import re
if re.match('i.86$', a): return 'ia32'
elif re.match('x86_64$', a): return 'x64'
elif re.match('aarch64$', a): return 'arm64'
elif re.match('(powerpc64|ppc64le)$', a): return 'ppc64'
elif re.match('powerpc$', a): return 'ppc'
return a
ARCHFLAGS_arm = "${#bb.utils.contains('TUNE_FEATURES', 'callconvention-hard', '--with-arm-float-abi=hard', '--with-arm-float-abi=softfp', d)} \
${#bb.utils.contains('TUNE_FEATURES', 'neon', '--with-arm-fpu=neon', \
bb.utils.contains('TUNE_FEATURES', 'vfpv3d16', '--with-arm-fpu=vfpv3-d16', \
bb.utils.contains('TUNE_FEATURES', 'vfpv3', '--with-arm-fpu=vfpv3', \
'--with-arm-fpu=vfp', d), d), d)}"
GYP_DEFINES_append_mipsel = " mips_arch_variant='r1' "
ARCHFLAGS ?= ""
# Node is way too cool to use proper autotools, so we install two wrappers to forcefully inject proper arch cflags to workaround gypi
do_configure () {
rm -rf ${S}/deps/openssl
export LD="${CXX}"
GYP_DEFINES="${GYP_DEFINES}" export GYP_DEFINES
# $TARGET_ARCH settings don't match --dest-cpu settings
./configure --prefix=${prefix} --with-intl=system-icu --without-snapshot --shared-openssl --shared-zlib \
--dest-cpu="${#map_nodejs_arch(d.getVar('TARGET_ARCH'), d)}" \
--dest-os=linux \
${ARCHFLAGS}
}
do_compile () {
export LD="${CXX}"
oe_runmake BUILDTYPE=Release
}
do_install () {
oe_runmake install DESTDIR=${D}
}
do_install_append_class-native() {
# use node from PATH instead of absolute path to sysroot
# node-v0.10.25/tools/install.py is using:
# shebang = os.path.join(node_prefix, 'bin/node')
# update_shebang(link_path, shebang)
# and node_prefix can be very long path to bindir in native sysroot and
# when it exceeds 128 character shebang limit it's stripped to incorrect path
# and npm fails to execute like in this case with 133 characters show in log.do_install:
# updating shebang of /home/jenkins/workspace/build-webos-nightly/device/qemux86/label/open-webos-builder/BUILD-qemux86/work/x86_64-linux/nodejs-native/0.10.15-r0/image/home/jenkins/workspace/build-webos-nightly/device/qemux86/label/open-webos-builder/BUILD-qemux86/sysroots/x86_64-linux/usr/bin/npm to /home/jenkins/workspace/build-webos-nightly/device/qemux86/label/open-webos-builder/BUILD-qemux86/sysroots/x86_64-linux/usr/bin/node
# /usr/bin/npm is symlink to /usr/lib/node_modules/npm/bin/npm-cli.js
# use sed on npm-cli.js because otherwise symlink is replaced with normal file and
# npm-cli.js continues to use old shebang
sed "1s^.*^#\!/usr/bin/env node^g" -i ${D}${exec_prefix}/lib/node_modules/npm/bin/npm-cli.js
# Install the native torque to provide it within sysroot for the target compilation
install -d ${D}${bindir}
install -m 0755 ${S}/out/Release/torque ${D}${bindir}/torque
}
do_install_append_class-target() {
sed "1s^.*^#\!${bindir}/env node^g" -i ${D}${exec_prefix}/lib/node_modules/npm/bin/npm-cli.js
}
PACKAGES =+ "${PN}-npm"
FILES_${PN}-npm = "${exec_prefix}/lib/node_modules ${bindir}/npm ${bindir}/npx"
RDEPENDS_${PN}-npm = "bash python-shell python-datetime python-subprocess python-textutils \
python-compiler python-misc python-multiprocessing"
PACKAGES =+ "${PN}-systemtap"
FILES_${PN}-systemtap = "${datadir}/systemtap"
BBCLASSEXTEND = "native"
I am able to apply gdb to node binary below is the snapshot. It core dumps at this point.
Thread 1 "node" hit Breakpoint 10, v8::internal::Runtime_PromiseHookInit (args_length=2, args_object=0x3fffffffd188, isolate=0x11284ab0)
at /usr/src/debug/nodejs/8.17.0-r0/node-v8.17.0/deps/v8/src/runtime/runtime-promise.cc:132
132 /usr/src/debug/nodejs/8.17.0-r0/node-v8.17.0/deps/v8/src/runtime/runtime-promise.cc: No such file or directory.
(gdb) bt
#0 v8::internal::Runtime_PromiseHookInit (args_length=2, args_object=0x3fffffffd188, isolate=0x11284ab0) at /usr/src/debug/nodejs/8.17.0-r0/node-v8.17.0/deps/v8/src/runtime/runtime-promise.cc:132
#1 0x000003c7b3f04134 in ?? ()
(gdb) c
Continuing.

Nodejs is not supported on PPC64 LE architecture. There is only support for the Big Endian platform on PPC architecture till 7.9 Version.

Related

Yocto add Shared Library

I am trying to compile this GitHub project I found and add the resulting shared library to my SDK.
The project uses CMake. My recipe can download, and build this project. The resulting binary files work as expected, the given .so files contain what I need. When trying to add the .so files to my image I get the errors
ERROR: dbcppp-1.0+gitrAUTOINC+917c925638-r0 do_package_qa: QA Issue: -dev package dbcppp-dev contains non-symlink .so '/usr/lib/libdbcppp.so'
-dev package dbcppp-dev contains non-symlink .so '/usr/lib/libxmlmm.so' [dev-elf]
ERROR: dbcppp-1.0+gitrAUTOINC+917c925638-r0 do_package_qa: QA Issue: dbcppp rdepends on dbcppp-dev [dev-deps]
ERROR: dbcppp-1.0+gitrAUTOINC+917c925638-r0 do_package_qa: QA run found fatal errors. Please consider fixing them.
ERROR: Logfile of failure stored in: /home/michael/Documents/MAIN_Application/build-fb/tmp/work/cortexa7t2hf-neon-poky-linux-gnueabi/dbcppp/1.0+gitrAUTOINC+917c925638-r0/temp/log.do_package_qa.10943
ERROR: Task (/home/michael/Documents/MAIN_Application/MAIN_layers/meta-MAINapplication/recipes-core/dbcppp/dbcppp_0.0.bb:do_package_qa) failed with exit code '1'
My recipe is as follows:
LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"
SRC_URI = "gitsm://github.com/xR3b0rn/dbcppp.git;protocol=https;branch=master"
PV = "1.0+gitr${SRCPV}"
SRCREV = "${AUTOREV}"
S = "${WORKDIR}/git"
inherit pkgconfig cmake
INSANE_SKIP:${PN} = "ldflags"
INHIBIT_PACKAGE_STRIP = "1"
INHIBIT_SYSROOT_STRIP = "1"
SOLIBS = ".so"
FILES_SOLIBSDEV = ""
do_install() {
install -d ${D}${bindir}
install -m 0755 ${B}/bin/dbcppp ${D}${bindir}
install -d ${D}${libdir}
install -m 0755 ${B}/src/libdbcppp/libdbcppp.so ${D}${libdir}
install -m 0755 ${B}/libxmlmm.so ${D}${libdir}
install -m 0755 ${B}/third-party/libxml2/libxml2.so.2.9.10 ${D}${libdir}
}
FILES_${PN} += "${libdir}/*"
FILES_${PN}-dev = "${libdir}/* ${includedir}"
I have been searching for a while but I cannot find a solution. What do I need to do for this to work?
Edit 1: I updated my bb file to the following. This works but it does not place the necessary header files into my SDK.
LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"
SRC_URI = "gitsm://github.com/xR3b0rn/dbcppp.git;protocol=https;branch=master"
PV = "1.0+gitr${SRCPV}"
SRCREV = "${AUTOREV}"
S = "${WORKDIR}/git"
inherit cmake
INSANE_SKIP:${PN} = "ldflags"
INHIBIT_PACKAGE_STRIP = "1"
INHIBIT_SYSROOT_STRIP = "1"
SOLIBS = ".so"
FILES_SOLIBSDEV = ""
do_install() {
install -d ${D}${bindir}
install -m 0755 ${B}/bin/dbcppp ${D}${bindir}
install -d ${D}${libdir}
install -m 0755 ${B}/src/libdbcppp/libdbcppp.so ${D}${libdir}
install -m 0755 ${B}/libxmlmm.so ${D}${libdir}
install -m 0755 ${B}/third-party/libxml2/libxml2.so ${D}${libdir}
}
FILES_${PN} += "${libdir}/*.so"
FILES_${PN}-dev = "${includedir}"
The dbcppp Cmake file already has an install target that installs everything automatically, so you do not need do_install.
Try the following recipe:
LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"
SRC_URI = "gitsm://github.com/xR3b0rn/dbcppp.git;protocol=https;branch=master"
PV = "1.0+gitr${SRCPV}"
SRCREV = "${AUTOREV}"
S = "${WORKDIR}/git"
inherit cmake
FILES_${PN} += "/usr/lib/xml2Conf.sh /usr/lib/lib*.so.*"
SOLIBS = ".so"
FILES_SOLIBSDEV = ""
INSANE_SKIP_${PN} += "dev-so"
The non-versioned shared libraries .so topic is difficult in Yocto, that's why skipping the QA shared library issue is the way to go here if you have no control on the source project's files/libraries.
The above recipe splits into multiple packages:
dbcppp (If you want just the dbcppp binary (.so files are shipped for the binary to run)
dbcppp-dev (If you want the header files and the shared libraries)
dbcppp-doc (If you want the man and html pages)

Yocto build could not invoke dnf . command && no Match for the argument : recipe-name

I tried to build my custom recipe for the project which contains programs for sensors. All the task and library making is taken care of by CMakeLists.txt it also has python dependencies. I added all the required dependencies within my recipe and tried to build it using the "bitbake soofierecp" command execution got successful. Whereas while attempting to install it with the local.conf using "IMAGE_INSTALL += soofierecp" it is giving an error as listed below:
Error is:
ERROR: soofie-img-1.0-r0 do_rootfs: Could not invoke dnf. Command '/home/anvation/nitish/source/build/tmp/work/qemux86_64-poky-linux/soofie-img/1.0-r0/recipe-sysroot-native/usr/bin/dnf -v --rpmverbosity=info -y -c /home/anvation/nitish/source/build/tmp/work/qemux86_64-poky-linux/soofie-img/1.0-r0/rootfs/etc/dnf/dnf.conf --setopt=reposdir=/home/anvation/nitish/source/build/tmp/work/qemux86_64-poky-linux/soofie-img/1.0-r0/rootfs/etc/yum.repos.d --installroot=/home/anvation/nitish/source/build/tmp/work/qemux86_64-poky-linux/soofie-img/1.0-r0/rootfs --setopt=logdir=/home/anvation/nitish/source/build/tmp/work/qemux86_64-poky-linux/soofie-img/1.0-r0/temp --repofrompath=oe-repo,/home/anvation/nitish/source/build/tmp/work/qemux86_64-poky-linux/soofie-img/1.0-r0/oe-rootfs-repo --nogpgcheck install i2c-tools packagegroup-base-extended packagegroup-core-boot packagegroup-core-ssh-dropbear psplash python3 python3-dev python3-pip python3-requests run-postinsts soofierecp usbutils locale-base-en-us locale-base-en-gb' returned 1:
DNF version: 4.12.0
cachedir: /home/anvation/nitish/source/build/tmp/work/qemux86_64-poky-linux/soofie-img/1.0-r0/rootfs/var/cache/dnf
Added oe-repo repo from /home/anvation/nitish/source/build/tmp/work/qemux86_64-poky-linux/soofie-img/1.0-r0/oe-rootfs-repo
User-Agent: falling back to 'libdnf': could not detect OS or basearch
repo: using cache for: oe-repo
oe-repo: using metadata from Thu 26 May 2022 05:31:19 AM UTC.
Last metadata expiration check: 0:00:01 ago on Thu 26 May 2022 05:31:20 AM UTC.
No match for argument: soofierecp
Error: Unable to find a match: soofierecp
ERROR: Logfile of failure stored in: /home/anvation/nitish/source/build/tmp/work/qemux86_64-poky-linux/soofie-img/1.0-r0/temp/log.do_rootfs.1379711
ERROR: Task (/home/anvation/nitish/workspace/meta-soofie/recipes-example/images/soofie-img.bb:do_rootfs) failed with exit code '1'
NOTE: Tasks Summary: Attempted 4873 tasks of which 4872 didn't need to be rerun and 1 failed. "added the meta-layer in bblayer.conf file"
Recipe is:
LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"
S = "${WORKDIR}"
PR = "r0"
DEPENDS = "openssl python3-six-native python3-pytest-runner-native"
SRC_URI = "\
file://src/ \
file://third_party/pybind11/ \
file://third_party/CLI11/ \
file://third_party/c-periphery/ \
file://CMakeLists.txt \
"
do_configure() {
cmake ../
}
RDEPENDS_${PN} = "python-requests python-six"
inherit pkgconfig cmake python3native
EXTRA_OEMAKE = ""
ALLOW_EMPTY_${PN}="1"
FILES_${PN} = "${bindir}/*"
DEPENDS += "udev"
Please help me to reach for the solution
I really appreciate any help you can provide.
I got the above code working with the suggestion and help
Thank you so much
The updated recipe is:
'
LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"
S = "${WORKDIR}"
PR = "r0"
SRC_URI = "\
file://src/ \
file://third_party/pybind11/ \
file://third_party/CLI11/ \
file://third_party/c-periphery/ \
file://CMakeLists.txt \
"
inherit cmake pkgconfig python3native
DEPENDS += "openssl python3-six-native python3-pytest-runner-native"
EXTRA_OECMAKE = ""
do_install() {
install -d ${D}${bindir}
install -m 0755 ${WORKDIR}/build/datagen ${D}${bindir}
}
DEPENDS += "udev"
FILES_${PN} += "${D}${bindir}/"
ALLOW_EMPTY_${PN} = "1"
'

Yocto do_package: Didn't find service unit specified in SYSTEMD_SERVICE_

Description
I want to install a service into my image, but it is failing with following errors
ERROR: mypackage-git-r0 do_package: Didn't find service unit 'mypackage.service', specified in SYSTEMD_SERVICE_mypackage.
ERROR: Logfile of failure stored in: <build-location>/poky/build/tmp/work/cortexa53-poky-linux/mypackage/git-r0/temp/log.do_package.7924
ERROR: Task (<layer-location>/meta-mypackage-oe/recipes-mypackage/mypackage/mypackage_git.bb:do_package) failed with exit code '1'
Recipe
Python sources are cloned from git, now I want to create a service to run at boot. Here is the recipe
SUMMARY = " "
DESCRIPTION = " "
HOMEPAGE = " todo "
LICENSE = "CLOSED"
SRC_URI += "<URL>"
SRC_URI += "file://mypackage.service"
SRCREV = "<srcrev>"
S = "${WORKDIR}/git"
inherit setuptools3 systemd
RDEPENDS_${PN} = " \
${PYTHON_PN}-pyserial \
${PYTHON_PN}-pyusb \
${PYTHON_PN}-terminal \
"
SYSTEMD_PACKAGES = "${PN}"
do_install_append () {
install -d ${D}${system_unitdir}
install -m 0755 ${WORKDIR}/mypackage.service ${D}{system_unitdir}
}
SYSTEMD_SERVICE_${PN} = "mypackage.service"
FILES_${PN} += "${system_unitdir}/mypackage.service"
Recipe structure
recipes-mypackage/mypackage/
├── mypackage
│   └── mypackage.service
└── mypackage_git.bb
1 directory, 2 files
Service file
NOTE: mypackage has feature to run as daemon using -d option
[Unit]
Description=mypackage service
[Service]
Type=simple
ExecStart=/usr/bin/mypackage -d
[Install]
WantedBy=multi-user.target
Build configurations
Image recipe inherits core-image-base and contains
IMAGE_FEATURES += "package-management"
PACKAGE_CLASSES ?= "rpm deb package_deb"
DISTRO_FEATURES_append = " systemd"
VIRTUAL-RUNTIME_init_manager += "systemd"
inherit extrausers
local.conf contents
MACHINE = "raspberrypi3-64"
ENABLE_UART = "1"
RPI_USE_U_BOOT = "1"
GPU_FREQ = "250"
I might have messed up a lot of things in the recipe, so need some pointer to clean up the recipe as well as resolve the issue.
Thanks.
Replace system_unitdir by systemd_system_unitdir.
SYSTEMD_PACKAGES already contains ${PN} so you can ignore it, same for FILES_${PN} += "${systemd_system_unitdir}/mypackage.service" as if systemd.bbclass finds your unit, it'll be added to the appropriate FILES_ automatically.
c.f. https://git.yoctoproject.org/cgit/cgit.cgi/poky/tree/meta/classes/systemd.bbclass#n4
https://git.yoctoproject.org/cgit/cgit.cgi/poky/tree/meta/classes/systemd.bbclass#n109
https://git.yoctoproject.org/cgit/cgit.cgi/poky/tree/meta/classes/systemd.bbclass#n148
And for completeness, thanks to #Jussi Kukkonen for the comment, missing $ sign before {systemd_system_unitdir}.

Yocto:Execute shell script inside my source repository environment (inside downloads folder ?)

in Yocto I need to execute a bash script that depends on the source repository environment. My current approach is to execute the script directly in the downloads folder.
Pseudocode (hope you know what I mean):
do_patch_append () {
os.system(' \
pushd ${DL_DIR}/svn/*/svn/myapp/Src; \
dos2unix ./VersionBuild/MakeVersionList.sh; \
./VersionBuild/MakeVersionList.sh ${S}/Src/VersionList.h; \
popd \
')
}
Before I start fiddling with the details: Is this a valid approach ? And is do_patch the right place ?
Reason: The script MakeVersionList.sh generates a header file containing revision info from subversion. It executes "svn info" on several folders and parses its output into the header file VersionList.h, which will later be accessed in ${S} during compilation.
Thanks a lot.
Thanks for giving helpful advice. Here's how I finally did it. To minimize dependencies to server infrastructure (SVN server) I put the version generation into do_fetch. I had to do a manual do_unpack as well, because adding the generated file to SRC_URI (like ${DL_DIR}/svn/...) made the fetcher try to fetch it.
#
# Build bitstone application
#
SUMMARY = "Bitstone mega wallet"
SECTION = "Rockefeller"
LICENSE = "GPLv2"
LIC_FILES_CHKSUM = "file://COPYING;md5=bbea815ee2795b2f4230826c0c6b8814"
#Register for root file system aggregation
APP_NAME = "bst-wallet"
FILES_${PN} += "${bindir}/${APP_NAME}"
PV = "${SRCPV}"
SRCREV = "${AUTOREV}"
SVN_SRV = "flints-svn"
SRC_URI = "svn://${SVN_SRV}/svn/${APP_NAME};module=Src;protocol=http;user=fred;pswd=pebbles "
S = "${WORKDIR}/Src"
GEN_FILE = "VersionList.h"
do_fetch_append () {
os.system(' \
cd ./svn/{0}/svn/{1}/Src; \
TZ=Pacific/Yap ./scripts/MakeVersionList.sh {2}; \
'.format(d.getVar("SVN_SRV"), d.getVar("APP_NAME"), d.getVar("GEN_FILE"))
)
}
do_unpack_append () {
os.system(' \
cp {3}/svn/{0}/svn/{1}/Src/{2} {4} \
'.format(d.getVar("SVN_SRV"), d.getVar("APP_NAME"), d.getVar("GEN_FILE"), \
d.getVar("DL_DIR"), d.getVar("S")) \
)
}
do_install_append () {
install -d ${D}${bindir}
install -m 0755 ${APP_NAME} ${D}${bindir}/
}

How do I write a yocto/bitbake recipe to replace the default vsftpd.conf file with my own file?

I want to replace the default vsftpd.conf file with my own file!
My bitbake file looks following:
bbexample_1.0.bb
DESCRIPTION = "Configuration and extra files for TX28"
LICENSE = "CLOSED"
LIC_FILES_CHKSUM = ""
S = "${WORKDIR}"
SRC_URI += " \
file://ld.so.conf \
file://nginx/nginx.conf \
file://init.d/myscript.sh"
inherit allarch
do_install () {
install -d ${D}${sysconfdir}
install -d ${D}${sysconfdir}/nginx
install -d ${D}${sysconfdir}/init.d
rm -f ${D}${sysconfdir}/ld.so.conf
install -m 0755 ${WORKDIR}/ld.so.conf ${D}${sysconfdir}
install -m 0755 ${WORKDIR}/nginx/nginx.conf ${D}${sysconfdir}/nginx/
install -m 0755 ${WORKDIR}/init.d/myscript.sh ${D}${sysconfdir}/init.d/
}
bbexample_1.0.bbappend
FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}-${PV}:"
SRC_URI += " \
file://vsftpd.conf"
do_install_append () {
install -m 0755 ${WORKDIR}/vsftpd.conf ${D}${sysconfdir}
}
But, the file could not be replaced!
What is wrong?
What you need to do is to use a bbappend in your own layer,
vsftpd recipe is located in meta-openembedded/meta-networking/recipes-daemons
Thus you need to create a file called vstfpd_%.bbappend (% makes it valid for every version)
This file must be located in <your-layer>/meta-networking/recipes-daemons. You also need to put your custom vsftpd.conf in <your-layer>/meta-networking/recipes-daemons/vsftpd folder
Its content should be:
FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
do_install_append(){
install -m 644 ${WORKDIR}/vsftpd.conf ${D}${sysconfdir}
}
Example from meta-openembedded here
you should add to your recipe:
FILES_${PN} += " file you installed"

Resources