I am trying to use Bitbake tool for the cross-compilation of a Git project from x86 architecture to aarm64 architecture, but I am getting ld errors during the do_compile stage. I already checked d/tmp/work/aarch64-xilinx-linux/commandlinetool/1.0+gitAUTOINC+ce84868f3c-r0/recipe-sysroot/ and those missing files are actually exist! I don't know why bitbake complains about missing files. I also tried to add related paths to my custom recipe using FILES_${PN} = "" but this didn't help.
Also, I have glibc as a dependency in my recipe but this doesn't help:
# dependencies DEPENDS += "glibc" RDEPENDS_${PN} = "glibc"
Errors I am getting are as the following:
| ~/bin/build/tmp/work/aarch64-xilinx-linux/commandlinetool/1.0+gitAUTOINC+ce84868f3c-r0/recipe-sysroot-native/usr/bin/aarch64-xilinx-linux/../../libexec/aarch64-xilinx-linux/gcc/aarch64-xilinx-linux/9.2.0/ld: cannot find /lib/libc.so.6
| ~/bin/build/tmp/work/aarch64-xilinx-linux/commandlinetool/1.0+gitAUTOINC+ce84868f3c-r0/recipe-sysroot-native/usr/bin/aarch64-xilinx-linux/../../libexec/aarch64-xilinx-linux/gcc/aarch64-xilinx-linux/9.2.0/ld: cannot find /usr/lib/libc_nonshared.a
| ~/bin/build/tmp/work/aarch64-xilinx-linux/commandlinetool/1.0+gitAUTOINC+ce84868f3c-r0/recipe-sysroot-native/usr/bin/aarch64-xilinx-linux/../../libexec/aarch64-xilinx-linux/gcc/aarch64-xilinx-linux/9.2.0/ld: cannot find /lib/ld-linux-aarch64.so.1
Edit: Here is the recipe I am using. It depends on another Git project named "deviceaccess" (which my recipe for that project cross-compiled successfully):
LICENSE = "GPLv3 & Unknown"
LIC_FILES_CHKSUM = "file://LICENSE;md5=84dcc94da3adb52b53ae4fa38fe49e5d \
file://cmake/debian_package_templates/copyright;md5=0630bd8af87d19e6a57f9d1f9c5cf11f"
SRC_URI = "git://github.com/ChimeraTK/CommandLineTools.git;protocol=https"
# Modify these as desired
PV = "1.0+git${SRCPV}"
SRCREV = "ce84868f3c86f3f0790772a31fb5202a14f38fb8"
S = "${WORKDIR}/git"
# dependencies
DEPENDS += "glibc deviceaccess"
RDEPENDS_${PN} = "glibc deviceaccess"
# cmake
inherit pkgconfig cmake
FILES_${PN} = ""
# Specify any options you want to pass to cmake using EXTRA_OECMAKE:
EXTRA_OEMAKE = ""
Related
Hi in my project I configure the gcc to be used by the option
meson build --cross-file mygcc.txt
in the file mygcc.txt I set the gcc commands needed:
[binaries]
c = '/usr/bin/gcc'
cc = '/usr/bin/gcc'
cpp = '/usr/bin/g++'
ar = '/usr/bin/gcc-ar'
strip = '/usr/bin/strip'
ld = '/usr/bin/ld'
....
I wonder if it is possible to set dynamically the root where the gcc is installed.
for example if I use gcc-toolset I can switch the default gcc installed under
/user/bin
to
/opt/rh/gcc-toolset-9/root/usr/bin
and in order to use the new gcc I need to change the path in mygcc.txt , remove the build dir and reconfigure meson.
but is it possible to configure meson in order to pick the gcc set in the bash used?
devel#lnx+ which gcc
/opt/rh/gcc-toolset-9/root/usr/bin/gcc
In order to solve the problem I have modified the mygcc.txt file in
[binaries]
c = 'gcc'
cc = 'gcc'
cpp = 'g++'
ar = 'gcc-ar'
strip = 'strip'
ld = 'ld'
pkgconfig = 'pkg-config'
.......
then in the .bashrc I have added
#source gcc
source /opt/rh/gcc-toolset-9/enable
I have my own .so closed source library and provide header file. My .so library file should be inside the yocto image, but header file should be used during another projects compilation only.
Here is yocto receipt:
SUMMARY = "foo library"
LICENSE = "CLOSED"
SECTION = "libs"
SRC_URI = "file://usr/lib/libfoo.so \
file://usr/include/foo.h "
S = "${WORKDIR}"
inherit autotools pkgconfig
do_compile() {
}
do_install() {
install -d ${D}/usr/lib
install -m 0755 ${WORKDIR}/usr/lib/libfoo.so ${D}/usr/lib/libfoo.so.1
ln -s /usr/lib/libfoo.so.1 ${D}/usr/lib/libfoo.so
install -d ${D}/usr/include
install -m 0644 ${WORKDIR}/usr/include/foo.h ${D}/usr/include/
}
FILES_${PN}-dev += "${includedir} "
FILES_${PN} += "/usr/lib/libfoo.so \
/usr/lib/libfoo.so.1"
PROVIDES += "libfoo"
I expect ${PN} package has libfoo.so and libfoo.so.1 and ${PN}-dev package has only one header file. But yocto bitbake copies only libfoo.so.1 in ${PN} and libfoo.so is in ${PN}-dev packet.
Could you please help me how to move so file into ${PN} package?
The behavior is correct here. Non-versioned .so files are installed in the -dev package because packages in the system should link against versioned files.
It is pretty uncommon to need to install a -dev package in an image, so effectively, only your versioned so file will make it.
As you saw already, the header is in the -dev package so won't make it to the image except if the -dev package is explicitly added to the image.
Because your header file is in includedir which is one of the directories used for the sysroot of other recipes (c.f. SYSROOT_DIRS), it'll be available to other recipes at build time. Same for your library as it's installed in lib_dir (also in aforementioned variable).
So the current behavior is expected. It is not clear why exactly you want your non-versioned symlink in the main package too.
If for some reason it's really what you want to do, you just need to add the following to your recipe:
SOLIBS = ".so"
FILES_SOLIBSDEV = ""
c.f. https://wiki.yoctoproject.org/wiki/TipsAndTricks/Packaging_Prebuilt_Libraries#Non-versioned_Libraries
I am trying to incorporate a CPLD programming utility on Github available at https://github.com/kontron/altera-stapl into my Yocto build but am getting undefined references to gpiod functions. I have that it depends on libgpiod in my recipe. Am I specifying the dependency correctly?
Here is my recipe:
SUMMARY = "CPLD STAPL Programming"
DESCRIPTION = "A userspace port of the Altera Jam STAPL Bytecode Player."
MAINTAINER = "Michael Walle <michael.walle#kontron.com>"
HOMEPAGE = "https://github.com/kontron/altera-stapl"
LICENSE = "GPLv2"
LIC_FILES_CHKSUM = "file://COPYING;md5=4641e94ec96f98fabc56ff9cc48be14b"
SRC_URI = "git://github.com/kontron/altera-stapl.git"
SRCREV = "71540fb3dccf57ea0e43cef77d628244de402152"
SRC_URI[sha256sum] = "DCF8A052CD7908F484EAEE8A1924809056611E68EA28652E17C021BE836FAA6C"
DEPENDS = "libgpiod"
S="${WORKDIR}/git"
do_install () {
install -d ${D}${bindir}
install -m 0755 altera-stapl ${D}${bindir}
}
These are the linker errors I am getting (there are a lot of them, not just this one, I can post the whole log if needed)
gnueabi/gcc/arm-poky-linux-gnueabi/9.2.0/ld: altera-gpio.c:(.text+0x3f4): undefined reference to `gpiod_line_request_output'
/home/gen-ccm-root/workdir/tools/poky/build-dev/tmp/work/armv7at2hf-neon-poky-linux-gnueabi/altera-stapl/1.0-r0/recipe-sysroot-native/usr/bin/arm-poky-linux-gnueabi/../../libexec/arm-poky-linux-gnueabi/gcc/arm-poky-linux-gnueabi/9.2.0/ld: altera-gpio.o: in function `close_jtag_hardware':
altera-gpio.c:(.text+0x4da): undefined reference to `gpiod_line_release'
collect2: error: ld returned 1 exit status
Makefile:31: recipe for target 'altera-stapl' failed
What is the correct way to set the dependency?
Update: I am running Yocto Zeus on Ubuntu 18.04 (my GCC is 7.4.0).
Turns out this issue was in the Makefile that was part of the GitHub project, and was actually fixed in a recent version. In case anyone else ever wants to use this project, the final recipe is as follows (just update the SRCREV if newer versions are release):
SUMMARY = "CPLD STAPL Programming"
DESCRIPTION = "A userspace port of the Altera Jam STAPL Bytecode Player."
HOMEPAGE = "https://github.com/kontron/altera-stapl"
LICENSE = "GPLv2"
LIC_FILES_CHKSUM = "file://COPYING;md5=4641e94ec96f98fabc56ff9cc48be14b"
SRC_URI = "git://github.com/kontron/altera-stapl.git"
SRCREV = "852ff9d13cc06fef7d207abe12cc19ea5b67a16b"
DEPENDS = "libgpiod"
S="${WORKDIR}/git"
do_install () {
install -d ${D}${bindir}
install -m 0755 altera-stapl ${D}${bindir}
}
I am using Petalinux 2017.2 and the included tools to build a Linux image for a Zynq ZC702 board. I am trying to add a pre-compiled executable to my rootfs with a bitbake recipe.
SUMMARY = "Demo on ARM-Linux"
SECTION = "PETALINUX/apps"
LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"
SRC_URI = " \
file://Demo1.out \
"
FILES_${PN} = " \
/home/root/Demo/ \
/home/root/Demo/Demo1.out \
"
S = "${WORKDIR}"
do_install() {
install -d ${D}/home/root/Demo
install -m 0755 ${S}/Demo1.out ${D}/home/root/Demo
}
When I attempt to build the rootfs with my app included I get this error:
ERROR: demo-1.0-r0 do_package: objcopy failed with exit code 1 (cmd was 'arm-xilinx-linux-gnueabi-objcopy' --only-keep-debug '/home/common/peta_proj_2017.2_secure/build/tmp/work/cortexa9hf-neon-xilinx-linux-gnueabi/demo/1.0-r0/package/home/root/Demo/Demo1.out' '/home/common/peta_proj_2017.2_secure/build/tmp/work/cortexa9hf-neon-xilinx-linux-gnueabi/demo/1.0-r0/package/home/root/Demo/.debug/Demo1.out'):
arm-xilinx-linux-gnueabi-objcopy:/home/common/peta_proj_2017.2_secure/build/tmp/work/cortexa9hf-neon-xilinx-linux-gnueabi/demo/1.0-r0/package/home/root/Demo/Demo1.out: File format not recognized
ERROR: demo-1.0-r0 do_package: Function failed: split_and_strip_files
I assume objcopy has an issue with my file having been compiled for arm-linux-gnueabihf, but I already know it works since I've tried copying it to the rootfs manually after Linux is booted and tested it. I would try to recompile it with the arm-xilinx-linux-gnueabi toolchain but it's missing some of the libraries I need. I don't know why objcopy is being called for this operation anyway. All I want is for it to move the file to the rootfs, but for some reason it's doing all this extra work on it. Is there a way I can make bitbake ignore the file's format?
looks like the problem is that objcopy is trying to strip symbols, and as you said, the toolchain used is not the same as the one it was used to build it.
You can try to setting:
INHIBIT_PACKAGE_STRIP="1"
somewhere (perhaps in your local.conf).
It should skip the step on which the build system tries to strip debug symbols from binaries hence will probably not invoke objcopy.
1 [https://www.yoctoproject.org/docs/current/mega-manual/mega-manual.html#var-INHIBIT_PACKAGE_STRIP]1
I am trying to write my own custom recipe. I am using Yocto Project with Bitbake.
The following package when given bitbake apriltags commands does the following and throws error at do_package
It successfully does the following tasks:
do_fetch
unpack
do_compile
and then fails at do_package
In my /yocto/build/tmp/work/armv7a-vfp-neon-poky-linux-gnueabi/apriltags/0.1-r4/git/build/lib there is a pkgconfig.pc and libapriltags.a which is causing the error.
My package recipe:
DESCRIPTION = "Apriltags application"
SECTION = "examples"
LICENSE = "CLOSED"
PR = "r3"
DEPENDS = "opencv"
SRC_URI = "git://github.com/zafrullahsyed/apriltags.git;protocol=https;tag=v0.1"
S = "${WORKDIR}/git"
inherit pkgconfig autotools
do_install() {
install -d ${D}${bindir}
install -m 0755 ${WORKDIR}/git/build/bin/apriltags_demo ${D}${bindir}
}
My error as follows:
ERROR: QA Issue: package apriltags contains bad RPATH /home/zaif/yocto/build/tmp/work/armv7a-vfp-neon-poky-linux-gnueabi/apriltags/0.1-r3/git/build/lib in file /home/zaif/yocto/build/tmp/work/armv7a-vfp-neon-poky-linux-gnueabi/apriltags/0.1-r3/packages-split/apriltags/usr/bin/apriltags_demo
ERROR: QA run found fatal errors. Please consider fixing them.
ERROR: Function failed: do_package_qa
ERROR: Logfile of failure stored in: /home/zaif/yocto/build/tmp/work/armv7a-vfp-neon-poky-linux-gnueabi/apriltags/0.1-r3/temp/log.do_package.21621
ERROR: Task 10 (/home/zaif/yocto/poky/meta-bebot/recipes-bebot/apriltags/apriltags_0.1.bb, do_package) failed with exit code '1'
The Apriltags has dependencies which need to be modified according to the machine you are working on.
You need to have the values of the requires, Libs and Cflags accordingly. Also verify whether you need the python pod packages or not.
My package Apriltags has bad dependencies that are according to PC in AprilTags/cmake/pods.cmake such as Eigen3(default), whereas for OE eigen3 package is libeigen. Hard coded the requires, Libs and Cflags and also removed python pod packages which are not required.
pods.cmake:
"Name: ${pc_name}\n"
"Description: ${pc_description}\n"
"Requires: ${libeigen}\n"
# "Version: ${pc_version}\n"
"Libs: -L\${bindir} ${pc_libs}\n"
"Cflags: -I\${bindir} ${pc_cflags}\n")
My recipe is as follows:
DESCRIPTION = "Apriltags application"
SECTION = "examples"
LICENSE = "CLOSED"
PR = "r5"
DEPENDS = "opencv"
SRC_URI = "git://github.com/zafrullahsyed/apriltags.git;protocol=https;tag=v0.3"
S = "${WORKDIR}/git"
inherit pkgconfig autotools
do_install() {
install -d ${D}${bindir}
install -m 0755 ${WORKDIR}/git/build/bin/apriltags_demo ${D}${bindir}
}