Yocto How to stop cmake to look in a native sysroot path for linking? - python-3.x

I'm trying to add dlib python module into my image so far this is the recipe i'm working on...
# python3-dlib_19.21.1.bb
SUMMARY = "A toolkit for making real world machine learning and data analysis applications"
HOMEPAGE = "https://pypi.python.org/pypi/dlib"
PYPI_PACKAGE = "dlib"
LICENSE = "Boost-Software"
SRC_URI[md5sum] = "1e7e357d7d54e86267ef60f606cb40e1"
LIC_FILES_CHKSUM = "file://dlib/LICENSE.txt;md5=2c7a3fa82e66676005cd4ee2608fd7d2 \
file://dlib/external/libpng/LICENSE;md5=243135ddedf702158f9170807cbcfb66 \
file://dlib/external/pybind11/LICENSE;md5=beb87117af69fd10fbf9fb14c22a2e62 \
file://python_examples/LICENSE_FOR_EXAMPLE_PROGRAMS.txt;md5=064f53ab40ea2b6a4bba1324149e4fde \
"
DEPENDS = "cmake-native"
inherit pypi setuptools3
but when do_compile() ran i got the following error message:
| [100%] Building CXX object CMakeFiles/_dlib_pybind11.dir/src/line.cpp.o
| [100%] Linking CXX shared module build_dunfell/tmp/work/aarch64-poky-linux/python3-dlib/19.21.1-r0/build/lib.linux-x86_64-3.8/_dlib_pybind11.cpython-38-aarch64-linux-gnu.so
| build_dunfell/tmp/work/aarch64-poky-linux/python3-dlib/19.21.1-r0/recipe-sysroot-native/usr/bin/aarch64-poky-linux/../../libexec/aarch64-poky-linux/gcc/aarch64-poky-linux/8.3.0/ld: build_dunfell/tmp/work/aarch64-poky-linux/python3-dlib/19.21.1-r0/recipe-sysroot-native/usr/lib/libsqlite3.so: error adding symbols: file in wrong format
| collect2: error: ld returned 1 exit status
| CMakeFiles/_dlib_pybind11.dir/build.make:445: recipe for target 'build_dunfell/tmp/work/aarch64-poky-linux/python3-dlib/19.21.1-r0/build/lib.linux-x86_64-3.8/_dlib_pybind11.cpython-38-aarch64-linux-gnu.so' failed
| make[2]: *** [build_dunfell/tmp/work/aarch64-poky-linux/python3-dlib/19.21.1-r0/build/lib.linux-x86_64-3.8/_dlib_pybind11.cpython-38-aarch64-linux-gnu.so] Error 1
| CMakeFiles/Makefile2:116: recipe for target 'CMakeFiles/_dlib_pybind11.dir/all' failed
| make[1]: *** [CMakeFiles/_dlib_pybind11.dir/all] Error 2
| Makefile:83: recipe for target 'all' failed
| make: *** [all] Error 2
| Traceback (most recent call last):
| File "build_dunfell/tmp/work/aarch64-poky-linux/python3-dlib/19.21.1-r0/dlib-19.21.1/setup.py", line 223, in <module>
| setup(
| File "build_dunfell/tmp/work/aarch64-poky-linux/python3-dlib/19.21.1-r0/recipe-sysroot-native/usr/lib/python3.8/site-packages/setuptools/__init__.py", line 144, in setup
| return distutils.core.setup(**attrs)
| File "build_dunfell/tmp/work/aarch64-poky-linux/python3-dlib/19.21.1-r0/recipe-sysroot-native/usr/lib/python3.8/distutils/core.py", line 148, in setup
| dist.run_commands()
| File "build_dunfell/tmp/work/aarch64-poky-linux/python3-dlib/19.21.1-r0/recipe-sysroot-native/usr/lib/python3.8/distutils/dist.py", line 966, in run_commands
| self.run_command(cmd)
| File "build_dunfell/tmp/work/aarch64-poky-linux/python3-dlib/19.21.1-r0/recipe-sysroot-native/usr/lib/python3.8/distutils/dist.py", line 985, in run_command
| cmd_obj.run()
| File "build_dunfell/tmp/work/aarch64-poky-linux/python3-dlib/19.21.1-r0/recipe-sysroot-native/usr/lib/python3.8/distutils/command/build.py", line 135, in run
| self.run_command(cmd_name)
| File "build_dunfell/tmp/work/aarch64-poky-linux/python3-dlib/19.21.1-r0/recipe-sysroot-native/usr/lib/python3.8/distutils/cmd.py", line 313, in run_command
| self.distribution.run_command(command)
| File "build_dunfell/tmp/work/aarch64-poky-linux/python3-dlib/19.21.1-r0/recipe-sysroot-native/usr/lib/python3.8/distutils/dist.py", line 985, in run_command
| cmd_obj.run()
| File "build_dunfell/tmp/work/aarch64-poky-linux/python3-dlib/19.21.1-r0/dlib-19.21.1/setup.py", line 135, in run
| self.build_extension(ext)
| File "build_dunfell/tmp/work/aarch64-poky-linux/python3-dlib/19.21.1-r0/dlib-19.21.1/setup.py", line 175, in build_extension
| subprocess.check_call(cmake_build, cwd=build_folder)
| File "build_dunfell/tmp/work/aarch64-poky-linux/python3-dlib/19.21.1-r0/recipe-sysroot-native/usr/lib/python3.8/subprocess.py", line 364, in check_call
| raise CalledProcessError(retcode, cmd)
| subprocess.CalledProcessError: Command '['cmake', '--build', '.', '--config', 'Release', '--', '-j8']' returned non-zero exit status 2.
| WARNING: exit code 1 from a shell command.
|
it looks like the problem occurs when cmake is trying to link the shared object _dlib_pybind11.cpython-38-aarch64-linux-gnu.so. Linker complains with the following error
adding symbols: file in wrong format
i think the linker is mixing target objects with native ones, but i'm not used to cmake so i don't know how to stop it to use the path of recipe-sysroot-native and use my target sysroot, if i remove cmake-native and use only DEPENDS="cmake", setup.py fails because it can not find cmake at all...
hope you can help me or give me any idea that i can try.
BR,
Update 1
just as #Nayfe pointed out dlib/setup.py has an --set option to pass CMAKE config variables, below is a recipe that already worked for me, i can import dlib without problems.
SUMMARY = "A toolkit for making real world machine learning and data analysis applications"
HOMEPAGE = "https://pypi.python.org/pypi/dlib"
PYPI_PACKAGE = "dlib"
LICENSE = "Boost-Software"
SRC_URI[md5sum] = "1e7e357d7d54e86267ef60f606cb40e1"
LIC_FILES_CHKSUM = "file://dlib/LICENSE.txt;md5=2c7a3fa82e66676005cd4ee2608fd7d2 \
file://dlib/external/libpng/LICENSE;md5=243135ddedf702158f9170807cbcfb66 \
file://dlib/external/pybind11/LICENSE;md5=beb87117af69fd10fbf9fb14c22a2e62 \
file://python_examples/LICENSE_FOR_EXAMPLE_PROGRAMS.txt;md5=064f53ab40ea2b6a4bba1324149e4fde \
"
DEPENDS = "sqlite3 "
inherit pypi cmake setuptools3
INSANE_SKIP_${PN} = "already-stripped"
DISTUTILS_BUILD_ARGS_append = " \
--set CMAKE_TOOLCHAIN_FILE=${WORKDIR}/toolchain.cmake \
"

Maybe recipe can be optimized but the following works
python3-dlib_19.21.bb
SUMMARY = "A toolkit for making real world machine learning and data analysis applications"
HOMEPAGE = "http://dlib.net/"
SECTION = "devel/python"
LICENSE = "BSL-1.0"
LIC_FILES_CHKSUM = "file://dlib/LICENSE.txt;md5=2c7a3fa82e66676005cd4ee2608fd7d2"
DEPENDS = "sqlite3"
SRC_URI = "git://github.com/davisking/dlib"
SRCREV = "9117bd784328d9ac40ffa1f9cf487633a8a715d7"
S = "${WORKDIR}/git"
DISTUTILS_BUILD_ARGS_append = " \
--set CMAKE_INSTALL_PREFIX:PATH=${prefix} \
--set CMAKE_INSTALL_BINDIR:PATH=${#os.path.relpath(d.getVar('bindir'), d.getVar('prefix') + '/')} \
--set CMAKE_INSTALL_SBINDIR:PATH=${#os.path.relpath(d.getVar('sbindir'), d.getVar('prefix') + '/')} \
--set CMAKE_INSTALL_LIBEXECDIR:PATH=${#os.path.relpath(d.getVar('libexecdir'), d.getVar('prefix') + '/')} \
--set CMAKE_INSTALL_SYSCONFDIR:PATH=${sysconfdir} \
--set CMAKE_INSTALL_SHAREDSTATEDIR:PATH=${#os.path.relpath(d.getVar('sharedstatedir'), d. getVar('prefix') + '/')} \
--set CMAKE_INSTALL_LOCALSTATEDIR:PATH=${localstatedir} \
--set CMAKE_INSTALL_LIBDIR:PATH=${#os.path.relpath(d.getVar('libdir'), d.getVar('prefix') + '/')} \
--set CMAKE_INSTALL_INCLUDEDIR:PATH=${#os.path.relpath(d.getVar('includedir'), d.getVar('prefix') + '/')} \
--set CMAKE_INSTALL_DATAROOTDIR:PATH=${#os.path.relpath(d.getVar('datadir'), d.getVar('prefix') + '/')} \
--set PYTHON_EXECUTABLE:PATH=${PYTHON} \
--set Python_EXECUTABLE:PATH=${PYTHON} \
--set Python3_EXECUTABLE:PATH=${PYTHON} \
--set LIB_SUFFIX=${#d.getVar('baselib').replace('lib', '')} \
--set CMAKE_INSTALL_SO_NO_EXE=0 \
--set CMAKE_TOOLCHAIN_FILE=${WORKDIR}/toolchain.cmake \
--set CMAKE_NO_SYSTEM_FROM_IMPORTED=1 \
--set CMAKE_LIBRARY_OUTPUT_DIRECTORY=${B} \
"
do_configure() {
distutils3_do_configure
}
do_compile() {
distutils3_do_compile
}
do_install() {
distutils3_do_install
}
inherit cmake setuptools3 python3native
INSANE_SKIP_${PN} = "already-stripped"
RDEPENDS_${PN} += "python3-core"

Related

How to cross-compile a rust application for ARM which uses Rocket web-server and requires nightly toolchain using Yocto?

I want to compile myRustApp which uses Rocket webserver in my meta layer. The issu I'm having is that openembedded does not support nightly release of Rust, which is required to run Rocket web-server.
The alternative was to use meta-rust, but it got me no where, because if I understand correctly the meta layer only supports native builds.
So I ended up using meta-rust-bin layer with pre-built nightly toolchain.
I was able to build nightly by executing ./build-new-version.sh nightly under meta-rust-bin.
After all this my recipe build by bitbake returns an Error:
WARNING: /home/jonas/project/sources/openembedded-core/meta/recipes-devtools/rust/rust-cross_1.59.0.bb: Exception during build_dependencies for TARGET_LLVM_FEATURES
WARNING: /home/jonas/project/sources/openembedded-core/meta/recipes-devtools/rust/rust-cross_1.59.0.bb: Error during finalise of /home/jonas/project/sources/openembedded-core/meta/recipes-devtools/rust/rust-cross_1.59.0.bb
ERROR: ExpansionError during parsing /home/jonas/project/sources/openembedded-core/meta/recipes-devtools/rust/rust-cross_1.59.0.bb
Traceback (most recent call last):
File "Var <TARGET_LLVM_FEATURES>", line 1, in <module>
File "/home/jonas/project/sources/openembedded-core/meta/recipes-devtools/rust/rust-common.inc", line 117, in llvm_features(d=<bb.data_smart.DataSmart object at 0x7fe03b341f60>):
return ','.join(llvm_features_from_tune(d) +
> llvm_features_from_cc_arch(d) +
llvm_features_from_target_fpu(d))
File "/home/jonas/project/sources/openembedded-core/meta/recipes-devtools/rust/rust-common.inc", line 36, in llvm_features_from_tune(d=<bb.data_smart.DataSmart object at 0x7fe03b341f60>):
> if target_is_armv7(d):
f.append('+v7')
bb.data_smart.ExpansionError: Failure expanding variable TARGET_LLVM_FEATURES, expression was ${#llvm_features(d)} which triggered exception NameError: name 'target_is_armv7' is not defined
The variable dependency chain for the failure is: TARGET_LLVM_FEATURES
ERROR: Parsing halted due to errors, see error messages above
WARNING: /home/jonas/project/sources/openembedded-core/meta/recipes-devtools/rust/rust-cross-canadian_1.59.0.bb: Exception during build_dependencies for TARGET_LLVM_FEATURES
WARNING: /home/jonas/project/sources/openembedded-core/meta/recipes-devtools/rust/rust-cross-canadian_1.59.0.bb: Error during finalise of /home/jonas/project/sources/openembedded-core/meta/recipes-devtools/rust/rust-cross-canadian_1.59.0.bb
My question is:
What causes this error I'm getting? How can I fix it?
Did someone already tried to cross-compile Rust nightly apps? Are there any examples anywhere?
My Cargo.toml:
[package]
name = "MyRustApp"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
rocket = "0.4.10"
rocket_cors = "0.5.1"
serde = "1.0"
serde_json = "1.0"
serde_derive = "1.0"
[dependencies.rocket_contrib]
version = "0.4.10"
default-features = false
features = ["json"]
[profile.release]
strip = true
opt-level = "z"
lto = true
My recipe generated by cargo bitbake:
# Auto-Generated by cargo-bitbake 0.3.16
#
inherit cargo
# If this is git based prefer versioned ones if they exist
# DEFAULT_PREFERENCE = "-1"
# how to get strain-webserver could be as easy as but default to a git checkout:
# SRC_URI += "crate://crates.io/MyRustApp/0.1.0"
SRC_URI += "git://git#bitbucket.org/work/MyRustApp.git;protocol=ssh;nobranch=1;branch=main"
SRCREV = "xxx"
S = "${WORKDIR}/git"
CARGO_SRC_DIR = ""
PV:append = ".AUTOINC+d2562d3c92"
# please note if you have entries that do not begin with crate://
# you must change them to how that package can be fetched
SRC_URI += " \
crate://crates.io/aead/0.3.2 \
crate://crates.io/aes-gcm/0.8.0 \
crate://crates.io/aes-soft/0.6.4 \
crate://crates.io/aes/0.6.0 \
crate://crates.io/aesni/0.10.0 \
crate://crates.io/aho-corasick/0.7.20 \
crate://crates.io/atty/0.2.14 \
crate://crates.io/autocfg/1.1.0 \
crate://crates.io/base64/0.13.1 \
crate://crates.io/base64/0.9.3 \
crate://crates.io/bitflags/1.3.2 \
crate://crates.io/block-buffer/0.9.0 \
crate://crates.io/byteorder/1.4.3 \
crate://crates.io/cfg-if/0.1.10 \
crate://crates.io/cfg-if/1.0.0 \
crate://crates.io/cipher/0.2.5 \
crate://crates.io/cookie/0.11.5 \
crate://crates.io/cpufeatures/0.2.5 \
crate://crates.io/cpuid-bool/0.2.0 \
crate://crates.io/crypto-mac/0.10.1 \
crate://crates.io/ctr/0.6.0 \
crate://crates.io/devise/0.2.1 \
crate://crates.io/devise_codegen/0.2.1 \
crate://crates.io/devise_core/0.2.1 \
crate://crates.io/digest/0.9.0 \
crate://crates.io/filetime/0.2.18 \
crate://crates.io/form_urlencoded/1.1.0 \
crate://crates.io/fsevent-sys/2.0.1 \
crate://crates.io/fsevent/0.4.0 \
crate://crates.io/fuchsia-zircon-sys/0.3.3 \
crate://crates.io/fuchsia-zircon/0.3.3 \
crate://crates.io/generic-array/0.14.6 \
crate://crates.io/getrandom/0.2.8 \
crate://crates.io/ghash/0.3.1 \
crate://crates.io/glob/0.3.0 \
crate://crates.io/hashbrown/0.12.3 \
crate://crates.io/hermit-abi/0.1.19 \
crate://crates.io/hkdf/0.10.0 \
crate://crates.io/hmac/0.10.1 \
crate://crates.io/httparse/1.8.0 \
crate://crates.io/hyper/0.10.16 \
crate://crates.io/idna/0.1.5 \
crate://crates.io/idna/0.3.0 \
crate://crates.io/indexmap/1.9.2 \
crate://crates.io/inotify-sys/0.1.5 \
crate://crates.io/inotify/0.7.1 \
crate://crates.io/iovec/0.1.4 \
crate://crates.io/itoa/1.0.4 \
crate://crates.io/kernel32-sys/0.2.2 \
crate://crates.io/language-tags/0.2.2 \
crate://crates.io/lazycell/1.3.0 \
crate://crates.io/libc/0.2.137 \
crate://crates.io/log/0.3.9 \
crate://crates.io/log/0.4.17 \
crate://crates.io/matches/0.1.9 \
crate://crates.io/memchr/2.5.0 \
crate://crates.io/mime/0.2.6 \
crate://crates.io/mio-extras/2.0.6 \
crate://crates.io/mio/0.6.23 \
crate://crates.io/miow/0.2.2 \
crate://crates.io/net2/0.2.38 \
crate://crates.io/notify/4.0.17 \
crate://crates.io/num_cpus/1.14.0 \
crate://crates.io/opaque-debug/0.3.0 \
crate://crates.io/pear/0.1.5 \
crate://crates.io/pear_codegen/0.1.5 \
crate://crates.io/percent-encoding/1.0.1 \
crate://crates.io/percent-encoding/2.2.0 \
crate://crates.io/polyval/0.4.5 \
crate://crates.io/ppv-lite86/0.2.17 \
crate://crates.io/proc-macro2/0.4.30 \
crate://crates.io/proc-macro2/1.0.47 \
crate://crates.io/quote/0.6.13 \
crate://crates.io/quote/1.0.21 \
crate://crates.io/rand/0.8.5 \
crate://crates.io/rand_chacha/0.3.1 \
crate://crates.io/rand_core/0.6.4 \
crate://crates.io/redox_syscall/0.2.16 \
crate://crates.io/regex-syntax/0.6.28 \
crate://crates.io/regex/1.7.0 \
crate://crates.io/rocket/0.4.11 \
crate://crates.io/rocket_codegen/0.4.11 \
crate://crates.io/rocket_contrib/0.4.11 \
crate://crates.io/rocket_cors/0.5.2 \
crate://crates.io/rocket_http/0.4.11 \
crate://crates.io/ryu/1.0.11 \
crate://crates.io/safemem/0.3.3 \
crate://crates.io/same-file/1.0.6 \
crate://crates.io/serde/1.0.147 \
crate://crates.io/serde_derive/1.0.147 \
crate://crates.io/serde_json/1.0.89 \
crate://crates.io/sha2/0.9.9 \
crate://crates.io/slab/0.4.7 \
crate://crates.io/smallvec/1.10.0 \
crate://crates.io/state/0.4.2 \
crate://crates.io/subtle/2.4.1 \
crate://crates.io/syn/0.15.44 \
crate://crates.io/syn/1.0.103 \
crate://crates.io/time/0.1.44 \
crate://crates.io/tinyvec/1.6.0 \
crate://crates.io/tinyvec_macros/0.1.0 \
crate://crates.io/toml/0.4.10 \
crate://crates.io/traitobject/0.1.0 \
crate://crates.io/typeable/0.1.2 \
crate://crates.io/typenum/1.15.0 \
crate://crates.io/unicase/1.4.2 \
crate://crates.io/unicase/2.6.0 \
crate://crates.io/unicase_serde/0.1.0 \
crate://crates.io/unicode-bidi/0.3.8 \
crate://crates.io/unicode-ident/1.0.5 \
crate://crates.io/unicode-normalization/0.1.22 \
crate://crates.io/unicode-xid/0.1.0 \
crate://crates.io/universal-hash/0.4.1 \
crate://crates.io/url/1.7.2 \
crate://crates.io/url/2.3.1 \
crate://crates.io/version_check/0.1.5 \
crate://crates.io/version_check/0.9.4 \
crate://crates.io/walkdir/2.3.2 \
crate://crates.io/wasi/0.10.0+wasi-snapshot-preview1 \
crate://crates.io/wasi/0.11.0+wasi-snapshot-preview1 \
crate://crates.io/winapi-build/0.1.1 \
crate://crates.io/winapi-i686-pc-windows-gnu/0.4.0 \
crate://crates.io/winapi-util/0.1.5 \
crate://crates.io/winapi-x86_64-pc-windows-gnu/0.4.0 \
crate://crates.io/winapi/0.2.8 \
crate://crates.io/winapi/0.3.9 \
crate://crates.io/windows-sys/0.42.0 \
crate://crates.io/windows_aarch64_gnullvm/0.42.0 \
crate://crates.io/windows_aarch64_msvc/0.42.0 \
crate://crates.io/windows_i686_gnu/0.42.0 \
crate://crates.io/windows_i686_msvc/0.42.0 \
crate://crates.io/windows_x86_64_gnu/0.42.0 \
crate://crates.io/windows_x86_64_gnullvm/0.42.0 \
crate://crates.io/windows_x86_64_msvc/0.42.0 \
crate://crates.io/ws2_32-sys/0.2.1 \
crate://crates.io/yansi/0.5.1 \
"
# FIXME: update generateme with the real MD5 of the license file
LIC_FILES_CHKSUM = " \
"
SUMMARY = "Webserver with Rust"t"
LICENSE = "CLOSED"
# includes this file if it exists but does not fail
# this is useful for anything you may want to override from
# what cargo-bitbake generates.
include MyRustApp-${PV}.inc
include MyRustApp.inc

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"
'

adding osmosdr for gnuradio in recipe Yocto Raspberry pi 4

I'm trying to create a yocto recipe to add osmosdr on my raspberrypi 4 but I get the following error when I generate my image:
/home/norian/Yocto/build-rpi/tmp/work/cortexa72-poky-linux/uhd/3.15.LTS-r0/git/host/lib/rfnoc/dma_fifo_block_ctrl_impl.cpp:61:21: error: '_1' was not declared in this scope
Here is my recipe:
SUMMARY = "A small image just capable of allowing a device to boot."
IMAGE_LINGUAS = " "
LICENSE = "MIT"
inherit core-image
CORE_IMAGE_EXTRA_INSTALL = "\
packagegroup-sdr-base-extended \
packagegroup-sdr-base-debug \
packagegroup-sdr-base-devel \
packagegroup-sdr-base-python \
packagegroup-sdr-python-extended \
packagegroup-sdr-gnuradio-base \
packagegroup-core-eclipse-debug \
"
RPI_EXTRA_CONFIG = "\
force_turbo=0 \n \
arm_freq=700 \n \
arm_freq_min=100 \
"
IMAGE_INSTALL += "nano"
IMAGE_INSTALL += "gr-osmosdr"
CONF_VERSION = "1"
ENABLE_UART="1"
DISABLE_SPLASH = "1"
DISABLE_RPI_BOOT_LOGO = "1"
I am using Ubuntu 20.04.
My version of poky is :
DISTRO_VERSION = "3.3.4"
DISTRO_CODENAME = "hardknott"
Do you know how to resolve this?

Yocto: create recipe for SciKit-learn

I'm attempting to create a recipe for SciKit-Learn from pypi. But it seems that python3 setup.py build is unable to find NumPy, even though i know i have it on the build host (both with pip3 install numpy and bitbake python3-numpy-native).
Right now i have the following in my recipe:
DESCRIPTION = "python3-scikit-learn"
SECTION = "devel/python"
LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://PKG-INFO;md5=4a2bb4f4ec2b68ec46d5d1be3371b2c7"
PR = "r0"
SRCNAME = "scikit-learn"
SRC_URI="https://files.pythonhosted.org/packages/1e/ce/9d8c88e68af0a5b5c5d78d8d2b7bcadfd45e1d6afc863ccb9aee30765b06/scikit-learn-0.21.3.tar.gz"
SRC_URI[md5sum] = "d7bb030fea8d503d897a0dc8c50b9241"
SRC_URI[sha256sum] = "eb9b8ebf59eddd8b96366428238ab27d05a19e89c5516ce294abc35cea75d003"
S = "${WORKDIR}/${SRCNAME}-${PV}"
inherit setuptools3
This kind of recipe works for other python packages that aren't in openembedded yet, like joblib which i did get to install with this exact method.
I can see when i run bitbake python3-scikit-learn -c devshell and running python3 there, i am unable to import numpy as it is missing from the path that the devshell python3 is looking (which is in /home/yoctouser/build/tmp/work/aarch64-poky-linux/python3-scikit-learn/0.21.3-r0/recipe-sysroot-native/usr/lib/python3.7/)
I've tried copy-paste the build host numpy package folder manually to this directory but then this error occours:
Log data follows:
| DEBUG: Executing shell function do_compile
| C compiler: aarch64-poky-linux-gcc -march=armv8-a+crc -fstack-protector-strong -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security -Werror=format-security --sysroot=/home/yoctouser/build/tmp/work/aarch64-poky-linux/python3-scikit-learn/0.21.3-r0/recipe-sysroot -Wno-unused-result -Wsign-compare -DNDEBUG -g -O3 -Wall -O2 -pipe -g -feliminate-unused-debug-types -O2 -pipe -g -feliminate-unused-debug-types -O2 -pipe -g -feliminate-unused-debug-types -fPIC
|
| compile options: '-c'
| extra options: '-fopenmp'
| aarch64-poky-linux-gcc: test_openmp.c
| aarch64-poky-linux-gcc -march=armv8-a+crc -fstack-protector-strong -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security -Werror=format-security --sysroot=/home/yoctouser/build/tmp/work/aarch64-poky-linux/python3-scikit-learn/0.21.3-r0/recipe-sysroot -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed -fstack-protector-strong -Wl,-z,relro,-z,now objects/test_openmp.o -o test_openmp -fopenmp
| Partial import of sklearn during the build process.
| /home/yoctouser/build/tmp/work/aarch64-poky-linux/python3-scikit-learn/0.21.3-r0/recipe-sysroot-native/usr/lib/python3.7/distutils/dist.py:274: UserWarning: Unknown distribution option: 'project_urls'
| warnings.warn(msg)
| /home/yoctouser/build/tmp/work/aarch64-poky-linux/python3-scikit-learn/0.21.3-r0/recipe-sysroot-native/usr/lib/python3.7/distutils/dist.py:274: UserWarning: Unknown distribution option: 'python_requires'
| warnings.warn(msg)
| /home/yoctouser/build/tmp/work/aarch64-poky-linux/python3-scikit-learn/0.21.3-r0/recipe-sysroot-native/usr/lib/python3.7/distutils/dist.py:274: UserWarning: Unknown distribution option: 'install_requires'
| warnings.warn(msg)
| Traceback (most recent call last):
| File "setup.py", line 291, in <module>
| setup_package()
| File "setup.py", line 287, in setup_package
| setup(**metadata)
| File "/home/yoctouser/build/tmp/work/aarch64-poky-linux/python3-scikit-learn/0.21.3-r0/recipe-sysroot-native/usr/lib/python3.7/numpy/distutils/core.py", line 137, in setup
| config = configuration()
| File "setup.py", line 174, in configuration
| config.add_subpackage('sklearn')
| File "/home/yoctouser/build/tmp/work/aarch64-poky-linux/python3-scikit-learn/0.21.3-r0/recipe-sysroot-native/usr/lib/python3.7/numpy/distutils/misc_util.py", line 1035, in add_subpackage
| caller_level = 2)
| File "/home/yoctouser/build/tmp/work/aarch64-poky-linux/python3-scikit-learn/0.21.3-r0/recipe-sysroot-native/usr/lib/python3.7/numpy/distutils/misc_util.py", line 1004, in get_subpackage
| caller_level = caller_level + 1)
| File "/home/yoctouser/build/tmp/work/aarch64-poky-linux/python3-scikit-learn/0.21.3-r0/recipe-sysroot-native/usr/lib/python3.7/numpy/distutils/misc_util.py", line 941, in _get_configuration_from_setup_py
| config = setup_module.configuration(*args)
| File "sklearn/setup.py", line 76, in configuration
| maybe_cythonize_extensions(top_path, config)
| File "/home/yoctouser/build/tmp/work/aarch64-poky-linux/python3-scikit-learn/0.21.3-r0/scikit-learn-0.21.3/sklearn/_build_utils/__init__.py", line 42, in maybe_cythonize_extensions
| with_openmp = check_openmp_support()
| File "/home/yoctouser/build/tmp/work/aarch64-poky-linux/python3-scikit-learn/0.21.3-r0/scikit-learn-0.21.3/sklearn/_build_utils/openmp_helpers.py", line 100, in check_openmp_support
| output = subprocess.check_output('./test_openmp')
| File "/home/yoctouser/build/tmp/work/aarch64-poky-linux/python3-scikit-learn/0.21.3-r0/recipe-sysroot-native/usr/lib/python3.7/subprocess.py", line 395, in check_output
| **kwargs).stdout
| File "/home/yoctouser/build/tmp/work/aarch64-poky-linux/python3-scikit-learn/0.21.3-r0/recipe-sysroot-native/usr/lib/python3.7/subprocess.py", line 472, in run
| with Popen(*popenargs, **kwargs) as process:
| File "/home/yoctouser/build/tmp/work/aarch64-poky-linux/python3-scikit-learn/0.21.3-r0/recipe-sysroot-native/usr/lib/python3.7/subprocess.py", line 775, in __init__
| restore_signals, start_new_session)
| File "/home/yoctouser/build/tmp/work/aarch64-poky-linux/python3-scikit-learn/0.21.3-r0/recipe-sysroot-native/usr/lib/python3.7/subprocess.py", line 1522, in _execute_child
| raise child_exception_type(errno_num, err_msg, err_filename)
| OSError: [Errno 8] Exec format error: './test_openmp'
| ERROR: 'python3 setup.py build ' execution failed.
| WARNING: exit code 1 from a shell command.
| ERROR: Function failed: do_compile (log file is located at /home/yoctouser/build/tmp/work/aarch64-poky-linux/python3-scikit-learn/0.21.3-r0/temp/log.do_compile.605)
Anyone have an idea on how to fix this?

Yocto fails to boot after adding package

I'm about to build a Linux-Yocto filesystem for Xilinx Zynq platform.
Everything runs fine until I added one more package to the rootfs.
It doesn't matter what kind of package I'm adding it always fails with:
INIT: version 2.88 booting
/etc/init.d/rcS: line 17: mount: command not found
/etc/init.d/rc: line 66: stty: command not found
/etc/rcS.d/S02banner.sh: line 11: /bin/mknod: No such file or directory
/etc/rcS.d/S02sysfs.sh: line 14: mount: command not found
/etc/rcS.d/S02sysfs.sh: line 17: grep: command not found
/etc/rcS.d/S06checkroot.sh: line 142: mount: command not found
/etc/rcS.d/S06checkroot.sh: line 145: ln: command not found
Starting Bootlog daemon: bootlogd: cannot find console device 249:0 under /dev
bootlogd.
/etc/rcS.d/S37populate-volatile.sh: line 12: dirname: command not found
/etc/rcS.d/S37populate-volatile.sh: line 13: sed: command not found
/etc/rcS.d/S37populate-volatile.sh: line 193: /proc/cmdline: No such file or directory
/etc/rcS.d/S38devpts.sh: line 13: grep: command not found
/etc/rcS.d/S38dmesg.sh: line 17: dmesg: command not found
/etc/rcS.d/S39hostname.sh: line 10: /bin/hostname: No such file or directory
/etc/rcS.d/S39hostname.sh: line 19: hostname: command not found
/etc/rcS.d/S55bootmisc.sh: line 64: date: command not found
/etc/rcS.d/S55bootmisc.sh: l
INIT: Entering runlevel: 5
/etc/init.d/rc: line 66: stty: command not found
Starting ntpd: /etc/rc5.d/S20ntpd: line 42: start-stop-daemon: command not found
done
Stopping Bootlog daemon: /etc/rc5.d/S99stop-bootlogd: line 62: start-stop-daemon: command not found
bootlogd.
And:
INIT: cannot execute "/sbin/getty"cannot execute "/sbin/getty"
INIT: Id "1" respawning too fast: disabled for 5 minutes
INIT: cannot execute "/sbin/getty"
INIT: Id "PS0" respawning too fast: disabled for 5 minutes
My local.conf:
MACHINE ?= "zedboard-zynq7"
DISTRO ?= "poky"
EXTRA_IMAGE_FEATURES = "debug-tweaks"
USER_CLASSES ?= "buildstats image-mklibs image-prelink"
PATCHRESOLVE = "noop"
BB_DISKMON_DIRS = "\
STOPTASKS,${TMPDIR},1G,100K \
STOPTASKS,${DL_DIR},1G,100K \
STOPTASKS,${SSTATE_DIR},1G,100K \
ABORT,${TMPDIR},100M,1K \
ABORT,${DL_DIR},100M,1K \
ABORT,${SSTATE_DIR},100M,1K"
PACKAGECONFIG_pn-qemu-native = "sdl"
PACKAGECONFIG_pn-nativesdk-qemu = "sdl"
ASSUME_PROVIDED += "libsdl-native"
CONF_VERSION = "1"
#AT-ubifs config
MKUBIFS_ARGS = "-m 2048 -e 126976 -c 1884"
#added by hob
PACKAGE_CLASSES = "package_rpm "
#added by hob
DL_DIR = "/home/jonas/Zynq_AT_Debug/Yocto/poky/build/downloads"
#added by hob
SSTATE_DIR = "/home/jonas/Zynq_AT_Debug/Yocto/poky/build/sstate-cache"
#added by hob
SSTATE_MIRRORS = ""
#added by hob
PARALLEL_MAKE = "-j 8"
#added by hob
BB_NUMBER_THREADS = "8"
#added by hob
INCOMPATIBLE_LICENSE = ""
#added by hob
SDKMACHINE = "x86_64"
#added by hob
http_proxy = ""
#added by hob
https_proxy = ""
#added by hob
ftp_proxy = ""
#added by hob
all_proxy = ""
#added by hob
CVS_PROXY_HOST = ""
#added by hob
CVS_PROXY_PORT = ""
#added by hob
IMAGE_EXTRA_SPACE = "0"
#added by hob
TOOLCHAIN_BUILD = "False"
#added by hob
IMAGE_FSTYPES = "ubifs cpio"
#added by hob
LINGUAS_INSTALL = ""
My Image recipe:
require /home/jonas/Zynq_AT_Debug/Yocto/poky/meta/recipes-core/images/core-image-minimal.bb
IMAGE_INSTALL = "sysvinit-pidof \
update-alternatives-opkg shadow-securetty init-ifupdown \
initscripts-functions base-files update-rc.d \
run-postinsts openssh udev-cache zlib libcrypto \
util-linux-libblkid openssh-scp openssh-keygen \
mtd-utils-ubifs initscripts openssh-ssh \
udev-utils modutils-initscripts eglibc \
shadow netbase openssh-sshd udev base-passwd \
sysvinit mtd-utils openssl-conf libkmod lzo \
util-linux-libuuid libwrap sysvinit-inittab \
iperf nbench-byte ntp ntpdate nano"
DESCRIPTION = "***** Yocto-filesystem"
If I take out nano everything is fine.
I hope someone can help me.
To add more package into the rootfs,
in conf/local.conf add this line:
IMAGE_INSTALL_append = " nano"
The space in front is really important.
In addition, please show where you get your bsp and your conf/bblayers.conf
Edit:
Let's start from the beginning. Copy this, replace my local.conf to yours local.conf. With this minimal set up, you could at least bitbake core-image-minimal
Then, to add your packages into the image, just add them to IMAGE_INSTALL_append = " "
MACHINE ?= "zedboard-zynq7"
DISTRO ?= "poky"
EXTRA_IMAGE_FEATURES = "debug-tweaks ssh-server-openssh package-manager"
USER_CLASSES ?= "buildstats image-mklibs image-prelink"
PATCHRESOLVE = "noop"
BB_DISKMON_DIRS = "\
STOPTASKS,${TMPDIR},1G,100K \
STOPTASKS,${DL_DIR},1G,100K \
STOPTASKS,${SSTATE_DIR},1G,100K \
ABORT,${TMPDIR},100M,1K \
ABORT,${DL_DIR},100M,1K \
ABORT,${SSTATE_DIR},100M,1K"
PACKAGECONFIG_pn-qemu-native = "sdl"
PACKAGECONFIG_pn-nativesdk-qemu = "sdl"
ASSUME_PROVIDED += "libsdl-native"
CONF_VERSION = "1"
#AT-ubifs config
MKUBIFS_ARGS = "-m 2048 -e 126976 -c 1884"
PACKAGE_CLASSES = "package_rpm "
DL_DIR = "/home/jonas/Zynq_AT_Debug/Yocto/poky/build/downloads"
SSTATE_DIR = "/home/jonas/Zynq_AT_Debug/Yocto/poky/build/sstate-cache"
SSTATE_MIRRORS = ""
PARALLEL_MAKE = "-j ${#oe.utils.cpu_count()}"
BB_NUMBER_THREADS = "${#oe.utils.cpu_count()}"
SDKMACHINE = "x86_64"
IMAGE_FSTYPES = "ubifs cpio"
IMAGE_INSTALL_append = " nano smartpm openssh-sftp-server "

Resources