Yocto Build Dependency on Debian Package - yocto

I am working on migrating from Debian to Yocto. As a result, many of the proprietary packages I am writing recipes for have dependencies on Debian libraries which do not appear to be available directly in Yocto. This might be a rookie question, but I'm trying to figure out how to do this.
Below, I have one of my recipe for a Makefile C project that was generated with recipetool create:
# Recipe created by recipetool
# This is the basis of a recipe and may need further editing in order to be fully functional.
# (Feel free to remove these comments when editing.)
# WARNING: the following LICENSE and LIC_FILES_CHKSUM values are best guesses - it is
# your responsibility to verify that the values are complete and correct.
#
# The following license files were not able to be identified and are
# represented as "Unknown" below, you will need to check them yourself:
# debian/copyright
LICENSE = "Unknown"
LIC_FILES_CHKSUM = "file://debian/copyright;md5=some-hash"
SRC_URI = "git://git#my-project.git;protocol=ssh"
# Modify these as desired
PV = "1.0+git${SRCPV}"
SRCREV = "<...>"
S = "${WORKDIR}/git"
DEPENDS = "systemd"
# NOTE: this is a Makefile-only piece of software, so we cannot generate much of the
# recipe automatically - you will need to examine the Makefile yourself and ensure
# that the appropriate arguments are passed in.
do_compile () {
oe_runmake my-project
}
As you can see, I have specified a dependency on systemd. However, the dependency I really think I need is the Debian package libsystemd.
Whenever I bitbake this recipe, I get the following:
NOTE: Executing Tasks
ERROR: <recipe-name> do_compile: oe_runmake failed
ERROR: <recipe-name> do_compile: Execution of '/home/mitch/bin/yocto/project-name/build/tmp/work/armv7vet2hf-neon-poky-linux-gnueabi/recipe-name/1.0+gitAUTOINC+...-r0/temp/run.do_compile.13271' failed with exit code 1:
make[1]: Entering directory '/home/mitch/bin/yocto/project-name/build/tmp/work/armv7vet2hf-neon-poky-linux-gnueabi/recipe-name/1.0+gitAUTOINC+...-r0/git/src/core'
CC file-name.c
../file-name.c:6:10: fatal error: systemd/sd-daemon.h: No such file or directory
6 | #include <systemd/sd-daemon.h>
| ^~~~~~~~~~~~~~~~~~~~~
compilation terminated.
make[1]: *** [Makefile:93: build/file-name.o] Error 1
make[1]: Leaving directory '/home/mitch/bin/yocto/project-name/build/tmp/work/armv7vet2hf-neon-poky-linux-gnueabi/recipe-name/1.0+gitAUTOINC+...-r0/git/src/core'
make: *** [Makefile:72: some-recipe] Error 2
WARNING: exit code 1 from a shell command.
ERROR: Logfile of failure stored in: /home/mitch/bin/yocto/project-name/build/tmp/work/armv7vet2hf-neon-poky-linux-gnueabi/recipe-name/1.0+gitAUTOINC+...-r0/temp/log.do_compile.13271
Log data follows:
| DEBUG: Executing shell function do_compile
| NOTE: make -j 24 my-project
| make[1]: Entering directory '/home/mitch/bin/yocto/project-name/build/tmp/work/armv7vet2hf-neon-poky-linux-gnueabi/recipe-name/1.0+gitAUTOINC+...-r0/git/src/core'
| CC my-file.c
| ../my-file.c:6:10: fatal error: systemd/sd-daemon.h: No such file or directory
| 6 | #include <systemd/sd-daemon.h>
| | ^~~~~~~~~~~~~~~~~~~~~
| compilation terminated.
| make[1]: *** [Makefile:93: build/my-file.o] Error 1
| make[1]: Leaving directory '/home/mitch/bin/yocto/project-name/build/tmp/work/armv7vet2hf-neon-poky-linux-gnueabi/recipe-name/1.0+gitAUTOINC+...-r0/git/src/core'
| make: *** [Makefile:72: my-project] Error 2
| ERROR: oe_runmake failed
| WARNING: exit code 1 from a shell command.
| ERROR: Execution of '/home/mitch/bin/yocto/project-name/build/tmp/work/armv7vet2hf-neon-poky-linux-gnueabi/recipe-name/1.0+gitAUTOINC+...-r0/temp/run.do_compile.13271' failed with exit code 1:
| make[1]: Entering directory '/home/mitch/bin/yocto/project-name/build/tmp/work/armv7vet2hf-neon-poky-linux-gnueabi/recipe-name/1.0+gitAUTOINC+...-r0/git/src/core'
| CC my-file.c
| ../my-file.c:6:10: fatal error: systemd/sd-daemon.h: No such file or directory
| 6 | #include <systemd/sd-daemon.h>
| | ^~~~~~~~~~~~~~~~~~~~~
| compilation terminated.
| make[1]: *** [Makefile:93: build/my-file.o] Error 1
| make[1]: Leaving directory '/home/mitch/bin/yocto/project-name/build/tmp/work/armv7vet2hf-neon-poky-linux-gnueabi/recipe-name/1.0+gitAUTOINC+...-r0/git/src/core'
| make: *** [Makefile:72: my-recipe] Error 2
| WARNING: exit code 1 from a shell command.
|
ERROR: Task (/home/mitch/bin/yocto/project-name/layers/meta-project/recipes-main/my-recipe/my-recipe_git.bb:do_compile) failed with exit code '1'
NOTE: Tasks Summary: Attempted 2166 tasks of which 2163 didn't need to be rerun and 1 failed.
To summarize, what this looks like is my project requires libraries provided by systemd. What am I missing here that would allow me to get this project to build? Is there a way to build it?

Okay, so I guess I was overthinking this. Yocto uses your system to compile the project. So, all I needed to do was provide the systemd header files on my host machine. Since I am running Ubuntu, installing libsystemd-dev on my host fixed the issue. I think that the DEPENDS on systemd will still be required for running on the Yocto system.

Related

/bin/sh: 1: cc: not found while compiling u-boot on YOCTO

I need help on creating a custom u-boot recipe for custom board.
I made a custom recipe for u-boot with our custom u-boot source and defconfig
While building iam getting the following error
ERROR: u-boot-cal-1.0-r1 do_compile: oe_runmake failed
ERROR: u-boot-cal-1.0-r1 do_compile: Execution of '/media/calixto-systems/cal_linux/Sethu/yocto/yocto-secure/iec61850_module/iec61850_module3.1/build/tmp/work/iec61850_module-poky-linux-gnueabi/u-boot-cal/1.0-r1/temp/run.do_compile.8827' failed with exit code 1
ERROR: Logfile of failure stored in: /media/calixto-systems/cal_linux/Sethu/yocto/yocto-secure/iec61850_module/iec61850_module3.1/build/tmp/work/iec61850_module-poky-linux-gnueabi/u-boot-cal/1.0-r1/temp/log.do_compile.8827
Log data follows:
| DEBUG: Executing shell function do_compile
| NOTE: make -j 4
| HOSTCC scripts/basic/fixdep
| /bin/sh: 1: cc: not found
| make[2]: *** [scripts/Makefile.host:95: scripts/basic/fixdep] Error 127
| make[1]: *** [Makefile:488: scripts_basic] Error 2
| make: *** No rule to make target 'include/config/auto.conf', needed by 'include/config/uboot.release'. Stop.
| make: *** Waiting for unfinished jobs....
| CFGCHK u-boot.cfg
| ERROR: oe_runmake failed
| WARNING: exit code 1 from a shell command.
| ERROR: Execution of '/media/calixto-systems/cal_linux/Sethu/yocto/yocto-secure/iec61850_module/iec61850_module3.1/build/tmp/work/iec61850_module-poky-linux-gnueabi/u-boot-cal/1.0-r1/temp/run.do_compile.8827' failed with exit code 1
ERROR: Task (/media/calixto-systems/cal_linux/Sethu/yocto/yocto-secure/iec61850_module/iec61850_module3.1/meta-iec61850_module/recipes-bsp/u-boot/u-boot-cal.bb:do_compile) failed with exit code '1'
NOTE: Tasks Summary: Attempted 580 tasks of which 579 didn't need to be rerun and 1 failed.
Summary: 1 task failed:
/media/calixto-systems/cal_linux/Sethu/yocto/yocto-secure/iec61850_module/iec61850_module3.1/meta-iec61850_module/recipes-bsp/u-boot/u-boot-cal.bb:do_compile
Summary: There were 2 ERROR messages shown, returning a non-zero exit code.
What all things i have to consider while writing a u-boot recipe.
The below lines are my recipe for u-boot
DESCRIPTION = "u-boot bootloader for Calixto devices"
LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"
#SRC_URI[md5sum] = "454a496b2ec8fa2cf60f6b2cba299b10"
FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
BRANCH ?= "2019.01"
UBOOT_GIT_PROTOCOL = "https"
S = "${WORKDIR}/git"
SRC_URI = "git://sethucalixto#bitbucket.org/calixtolinuxplatform/calixto-am335x-uboot.git;protocol=${UBOOT_GIT_PROTOCOL};branch=${BRANCH}; \
file://am335x_iec61850_module_defconfig"
DEPENDS += "dtc-native bc-native lzop-native flex-native bison-native python3-setuptools-native"
COMPATIBLE_MACHINE = "iec61850-module"
SRCREV = "b96e9f6aed2c0a6cbf08c3f31b917694cc1f1b14"
Have a look at the u-boot recipe in OE-Core. In particular you probably need the EXTRA_OEMAKE lines from u-boot.inc to setup the compiler/linker correctly.

How to compile openssl natively - custom version in yocto?

I am trying to add the recipe in the yocto to build openssl natively i.e for my host machine - X86.
Here is my recipe and my compilation is failing saying circular dependencies. I am unsure what to do next.
Here is the recipe -
openssl_git.bb
DESCRIPTION = "Potluck with different functions for different purposes that can be shared among C programs"
HOMEPAGE = "https://github.com/openssl/openssl"
LICENSE = "Apache License 2.0"
LIC_FILES_CHKSUM = "file://LICENSE;md5=c75985e733726beaba57bc5253e96d04"
#inherit cmake pkgconfig
SRC_URI = "git://github.com/openssl/openssl.git"
SRCREV = "${AUTOREV}"
S = "${WORKDIR}/git"
do_configure () {
cd ${S}
./config
}
do_compile () {
# Build openssl
oe_runmake -C ${S}
}
BBCLASSEXTEND += "native"
Here is the build error -
arm-poky-linux-gnueabi-gcc: error: unrecognized command line option '-m64'
| arm-poky-linux-gnueabi-gcc: error: unrecognized command line option '-m64'
| Makefile:3979: recipe for target 'apps/lib/libapps-lib-app_params.o' failed
| make[1]: *** [apps/lib/libapps-lib-app_params.o] Error 1
| make[1]: *** Waiting for unfinished jobs....
| Makefile:3987: recipe for target 'apps/lib/libapps-lib-app_provider.o' failed
| make[1]: *** [apps/lib/libapps-lib-app_provider.o] Error 1
| arm-poky-linux-gnueabi-gcc: error: unrecognized command line option '-m64'
| Makefile:3995: recipe for target 'apps/lib/libapps-lib-app_rand.o' failed
| make[1]: *** [apps/lib/libapps-lib-app_rand.o] Error 1
| arm-poky-linux-gnueabi-gcc: error: unrecognized command line option '-m64'
| Makefile:4003: recipe for target 'apps/lib/libapps-lib-app_x509.o' failed
| make[1]: *** [apps/lib/libapps-lib-app_x509.o] Error 1
| make[1]: Leaving directory '/home/user/temp/custom_yocto/build-custom-zynq/tmp/work/cortexa9t2hf-neon-poky-linux-gnueabi/openssl/git-r0/git'
| Makefile:3055: recipe for target 'build_sw' failed

Adding new dts to Raspberry Yocto project

I have an experimental hardware connected to Raspberry's GPIO lines, and related dts file has been created. In Raspbian, the kernel module and dtbo (overlay) works well i.e. the hardware can be controlled.
Now I have tried to port this to Yocto 2.7.1 using Jumpnowtek's meta-rpi layer [x]. The kernel module porting was otherwise successful (at least, I did not get any complains during compilation), but I haven't been able to add the dts file to system such, that it would be automatically compiled to dtbo and added to /boot/overlays -directory.
[x] https://jumpnowtek.com/rpi/Raspberry-Pi-Systems-with-Yocto.html
I have created a linux-raspberrypi_4.19.bbappend recipe as follows:
FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
SRC_URI += "file://newlayer.dts"
RPI_KERNEL_DEVICETREE_OVERLAYS_append = " overlays/newlayer.dtbo "
do_compile_prepend() {
sed -i '/dtbo-$(CONFIG_ARCH_BCM2835) += \\/a newlayer.dtbo \\' ${S}/arch/${ARCH}/boot/dts/overlays/Makefile
cp ${WORKDIR}/newlayer.dts ${S}/arch/${ARCH}/boot/dts/overlays/
}
When I execute the "bitbake console-image", I get following error:
| make[3]: *** No rule to make target 'arch/arm/boot/dts/overlays/newlayer.dtbo'. Stop.
| make[2]: *** [arch/arm/Makefile:345: overlays/newlayer.dtbo] Error 2
| make[1]: *** [Makefile:146: sub-make] Error 2
| make: *** [Makefile:24: __sub-make] Error 2
| ERROR: oe_runmake failed
| WARNING: exit code 1 from a shell command.
If I don't add the "RPI_KERNEL_DEVICETREE_OVERLAYS_append" line, I don't get any error message, but the dts file won't be compiled either. It seems, that contents of the mentioned variable control, which dts files will be compiled.
Any help is welcome.

Trying to create sample linux mage with yocto prject but cause building error

I tried to create a Linux image based on "yocto project mega Manuel".But I got an error in building image step.
I followed the mega Manuel.
I'm using Ubuntu 18.04.1 LTS.
Error:
aju#aju-HP-15-Notebook-PC:~/poky/build$ bitbake core-image-sato
WARNING: Host distribution "Ubuntu-18.04" has not been validated with this version of the build system; you may possibly experience
unexpected failures. It is recommended that you use a tested
distribution.
Parsing recipes: 100% |#########################################| Time: 00:00:49
Parsing of 899 .bb files complete (0 cached, 899 parsed). 1330 targets, 38 skipped, 0 masked, 0 errors.
NOTE: Resolving any missing task queue dependencies
Build Configuration: BB_VERSION = "1.28.0" BUILD_SYS = "x86_64-linux" NATIVELSBSTRING = "Ubuntu-18.04" TARGET_SYS = "i586-poky-linux" MACHINE = "qemux86" DISTRO = "poky" DISTRO_VERSION = "2.0.3" TUNE_FEATURES = "m32 i586"
TARGET_FPU = "" meta meta-yocto
meta-yocto-bsp = "jethro:331275422b2c3f326f605c23ae89eedb4e222eb5"
NOTE: Preparing RunQueue NOTE: Executing SetScene Tasks NOTE:
Executing RunQueue Tasks ERROR: oe_runmake failed ERROR: Function
failed: do_compile (log file is located at
/home/aju/poky/build/tmp/work/x86_64-linux/automake-native/1.15-r0/temp/log.do_compile.301)
ERROR: Logfile of failure stored in:
/home/aju/poky/build/tmp/work/x86_64-linux/automake-native/1.15-r0/temp/log.do_compile.301
Log data follows: | DEBUG: Executing shell function do_compile | NOTE:
make -j 4 | : && /bin/mkdir -p doc && {
PATH='/home/aju/poky/build/tmp/work/x86_64-linux/automake-native/1.15-r0/build/t/wrap:'$PATH
&& export PATH; } && /usr/bin/perl
/home/aju/poky/build/tmp/work/x86_64-linux/automake-native/1.15-r0/automake-1.15/doc/help2man
--output=doc/automake-1.15.1 automake-1.15
| help2man: can't get --help' info from automake-1.15
| Try--no-discard-stderr' if option outputs to stderr
| Makefile:3687: recipe for target 'doc/automake-1.15.1' failed
| make: *** [doc/automake-1.15.1] Error 255
| WARNING: exit code 1 from a shell command.
| ERROR: oe_runmake failed
| ERROR: Function failed: do_compile (log file is located at /home/aju/poky/build/tmp/work/x86_64-linux/automake-native/1.15-r0/temp/log.do_compile.301)
ERROR: Task 403 (virtual:native:/home/aju/poky/meta/recipes-devtools/automake/automake_1.15.bb,
do_compile) failed with exit code '1'
NOTE: Tasks Summary: Attempted 73 tasks of which 53 didn't need to be rerun and 1 failed.
Waiting for 0 running tasks to finish:
Summary: 1 task failed: virtual:native:/home/aju/poky/meta/recipes-devtools/automake/automake_1.15.bb,
do_compile Summary: There was 1 WARNING message shown. Summary: There
were 2 ERROR messages shown, returning a non-zero exit code.
Is it the problem with this latest version or is it something else?
Why are you using such an old release of Yocto? 2.0.x was first released in 2015 and isn't supported on modern distributions. If you need to use 2.0.x then you can pick a patch from a recent release to fix autoconf, but I really do recommend using 2.5 (or 2.6, due to release any day now) instead.

unable to build core-image-sato with yocto rocko

I'm just starting out with yocto. Reading Embedded Linux Systems with the Yocto Project. Downloaded latest rocko release with git, created a new environment and ran bitbake core-image-sato. Got the following errors during build
ERROR: binutils-native-2.29-r0 do_install: oe_runmake failed
ERROR: binutils-native-2.29-r0 do_install: Function failed: do_install (log file is located at /home/some-user/projects/rpi-yocto-build/tmp/work/x86_64-linux/binutils-native/2.29-r0/temp/log.do_install.73730)
ERROR: Logfile of failure stored in: /home/some-user/projects/rpi-yocto-build/tmp/work/x86_64-linux/binutils-native/2.29-r0/temp/log.do_install.73730
...
...
...
ERROR: Task (virtual:native:/home/some-user/projects/poky/meta/recipes-devtools/binutils/binutils_2.29.bb:do_install) failed with exit code '1'
NOTE: Tasks Summary: Attempted 826 tasks of which 431 didn't need to be rerun and 1 failed.
Looked at the home/some-user/projects/rpi-yocto-build/tmp/work/x86_64-linux/binutils-native/2.29-r0/temp/log.do_install.73730 log file and found the following in it
/home/some-user/projects/rpi-yocto-build/tmp/hosttools/ld: cannot find ../bfd/.libs/libbfd.a: No such file or directory
collect2: error: ld returned 1 exit status
Makefile:1116: recipe for target 'ld-new' failed
make[4]: *** [ld-new] Error 1
make[4]: Leaving directory '/home/some-user/projects/rpi-yocto-build/tmp/work/x86_64-linux/binutils-native/2.29-r0/git/build.x86_64-linux.x86_64-linux/ld'
Makefile:1760: recipe for target 'install-recursive' failed
make[3]: *** [install-recursive] Error 1
make[3]: Leaving directory '/home/some-user/projects/rpi-yocto-build/tmp/work/x86_64-linux/binutils-native/2.29-r0/git/build.x86_64-linux.x86_64-linux/ld'
Makefile:1931: recipe for target 'install' failed
make[2]: *** [install] Error 2
make[2]: Leaving directory '/home/some-user/projects/rpi-yocto-build/tmp/work/x86_64-linux/binutils-native/2.29-r0/git/build.x86_64-linux.x86_64-linux/ld'
Makefile:7204: recipe for target 'install-ld' failed
make[1]: *** [install-ld] Error 2
make[1]: *** Waiting for unfinished jobs...
Is ../bfd/.libs/libbfd.a something I should have installed on my machine or it is rocko that is missing it? Is there a fix for this?
I'd suggest that that isn't the actual error, but a subsequent one. Can you do bitbake binutils-native -cclean (to wipe away the partial build) and then bitbake binutils-native, and assuming it breaks again pastebin the entire log.do_install.
Also I've not read that book but it might be worth trying with MACHINE=qemux86 from just a clone of Poky, so we can rule out other layers or configuration.