Can't copy files to my target device in yocto - embedded

I am not being able to get my recipe to copy some files into my target device.
Currently the layers of my yocto project looks like this:
layer path priority
==========================================================================
meta /home/juanpablo/work/yocto/tegra-demo-distro/layers/meta 5
meta-tegra /home/juanpablo/work/yocto/tegra-demo-distro/layers/meta-tegra 5
contrib /home/juanpablo/work/yocto/tegra-demo-distro/layers/meta-tegra/contrib 4
meta-oe /home/juanpablo/work/yocto/tegra-demo-distro/layers/meta-oe 6
meta-python /home/juanpablo/work/yocto/tegra-demo-distro/layers/meta-python 7
meta-networking /home/juanpablo/work/yocto/tegra-demo-distro/layers/meta-networking 5
meta-filesystems /home/juanpablo/work/yocto/tegra-demo-distro/layers/meta-filesystems 6
meta-virtualization /home/juanpablo/work/yocto/tegra-demo-distro/layers/meta-virtualization 8
meta-tegra-community /home/juanpablo/work/yocto/tegra-demo-distro/layers/meta-tegra-community 20
meta-tegra-support /home/juanpablo/work/yocto/tegra-demo-distro/layers/meta-tegra-support 40
meta-demo-ci /home/juanpablo/work/yocto/tegra-demo-distro/layers/meta-demo-ci 40
meta-tegrademo /home/juanpablo/work/yocto/tegra-demo-distro/layers/meta-tegrademo 50
workspace /home/juanpablo/work/yocto/tegra-demo-distro/build/workspace 99
meta-mine /home/juanpablo/work/yocto/meta-kwali 6
The meta-mine layer is the layer I created with a recipe to copy files inside the image I am then flashing to the sd card of a jetson-nano-devkit.
The recipe log-generators_0.1.bb has the following content:
DESCRIPTON = "A template recipe to copy files from host directory to target. \
The example is written with docker-compose files"
LICENSE = "CLOSED"
SRC_URI = "file://.env \
file://docker-compose.yml \
"
FILES_${PN} += "/test"
inherit allarch
do_install() {
install -d ${D}/test
install -m 0755 ${WORKDIR}/.env ${D}/test/
install -m 0755 ${WORKDIR}/docker-compose.yml ${D}/test/
}
I have tried following the wiki's cookbook recipe and also 2 or 3 answers for similar questions posted in SO (e.g also defining ${S} = ${WORKDIR}, not using inherit allaarch, etc).
Any suggestions or help is welcome.

I tried your exact recipe on my setup and it seems to work correctly.
bitbake log-generators produces log-generators{,-dbg,-dev}_0.1-r0_all.ipk (I happen to use ipk) packages within build/tmp/deploy/ipk/all/ directory.
While inspecting log-generators_0.1-r0_all.ipk, I can see the correct files in /test inside.
If you don't see the files in your target image, my best guess is that you need to reference the package in the image's install list. The simplest way is to add this to your local.conf:
IMAGE_INSTALL_append = " log-generators "

Related

Why Conan shows me "ERROR: Specify the 'user' and the 'channel' or neither of them" when I try to run "conan export-pkg . hello/0.1#myuser/testing"?

I'm trying to use
conan export-pkg . hello/0.1#myuser/testing
command following the tutorial from https://docs.conan.io/en/latest/creating_packages/existing_binaries.html. But conan keeps showing this error message:
ERROR: Specify the 'user' and the 'channel' or neither of them.
It doesn't make any difference if I remove both user and channel.
I tried:
conan export-pkg . hello/0.1
conan export-pkg . hello
conan export-pkg .
And I got the same error every time. What is this error message about and how can be resolved? What am I doing wrong?
My conan version is: 1.29.0
I've been able to work around this problem after submitting an issue to the Conan developers.
I had changed the storage.path setting in my conan.conf to a top-level folder of drive D:\:
# File: <username>/.conan/conan.conf
# ...
[storage]
# (default) Relative path to a folder in C:\
#path = ./data
# Absolute path to a top-level folder in D:\
path = D:\conan_packages
After a while, it just stopped working.
I worked around this by setting storage.path to a non top-level folder of D:\, e.g.
[storage]
path = D:\conan\packages

Why is clang-tidy not getting its options set through ALE?

I'm able to run clang-tidy with my source file clang-tidy -p build/compile_commands.json filename.h and it works as expected. When I open the file through vim I get errors with the first #includes, which happens if I leave the -p option off the invocation.
In my vimrc I tried setting g:ale_c_build_dir to build and that didn't work, so I tried setting g:ale_cpp_clangtidy_extra_options with the -p argument above and that didn't work. I'm able to confirm that these values are being set properly with ALEInfo, they're just not being used in the clang-tidy invocation apparently.
I am currently trying to set ALE up with clang-tidy myself, and eventually got it working with the following config:
let g:ale_linters = {
\ 'cpp': ['clangtidy'],
\ 'c': ['clangtidy'],
\}
let g:ale_fixers={
\ 'cpp': ['clang-format'],
\ '*': ['remove_trailing_lines', 'trim_whitespace'],
\}
let g:ale_cpp_clangtidy_checks = []
let g:ale_cpp_clangtidy_executable = 'clang-tidy'
let g:ale_c_parse_compile_commands=1
let g:ale_cpp_clangtidy_extra_options = ''
let g:ale_cpp_clangtidy_options = ''
let g:ale_set_balloons=1
let g:ale_linters_explicit=1
let g:airline#extensions#ale#enabled=1
As you can see, i have skipped setting g:ale_c_build_dir_names or g:ale_c_build_dir, since the defaults should do the job just fine (see excerpts from documentation below), given that your compile_commands.json resides in build or bin directory of the root of your project. One thing i have noticed is that linting with clang-tidy when used as ALE's linter is very slow.
g:ale_c_build_dir_names
Type: List
Default: ['build', 'bin']
A list of directory names to be used when searching upwards from cpp
files to discover compilation databases with. For directory named 'foo',
ALE will search for 'foo/compile_commands.json' in all directories on and above
the directory containing the cpp file to find path to compilation database.
This feature is useful for the clang tools wrapped around LibTooling (namely
here, clang-tidy)
And:
g:ale_c_build_dir
Type: String
Default: ''
For programs that can read compile_commands.json files, this option can be
set to the directory containing the file for the project. ALE will try to
determine the location of compile_commands.json automatically, but if your
file exists in some other directory, you can set this option so ALE will
know where it is.
This directory will be searched instead of g:ale_c_build_dir_names.

Yocto - Can't build library for host SDK

I've made a custom recipe for a third-party library.
It contains:
BBCLASSEXTEND =+ "native nativesdk"
The recipe builds a static library, depends on virtual/kernel and copies some headers - relatively simple.
I'm trying to install this into the host SDK for cross-compilation, but I'm having some issues.
When I try adding:
TOOLCHAIN_HOST_TASK_append = " nativesdk-<recipe>"
... to local.conf and run bitbake core-image-weston -c populate_sdk, BitBake completes, but the headers and library are absent from the host SDK (for my host's architecture).
When I try adding:
TOOLCHAIN_HOST_TASK_append = " <package>-staticdev"
... I get the following error:
package <package>-staticdev-1.11.0-r0.aarch64 does not have a compatible architecture
Any help would be appreciated.
As you don't need native part of recipe to run something on host (build machine) but target part, you should add the following line to add it to SDK:
TOOLCHAIN_TARGET_TASK_append = " <package>-staticdev <package>-dev"

Yocto + Autotools library + CMake application = linker error

I have a Yocto BSP with my own layer that includes an autotools 3rdy part library (libcoap).
My application ".bb" file has the following lines, telling libcoap is needed:
DEPENDS += "libcoap"
RDEPENDDS_${PN} += " libcoap libcoap-dev libcoap-devstatic"
I can see the library files are being copied to sysroot:
$ ls -l /projects/oe-core/build/tmp-glibc/work/armv7at2hf-neon-angstrom-linux-gnueabi/coap-playground/1.0-r0/recipe-sysroot/usr/lib/libcoap*
-rw-r--r-- 2 udev udev 286430 Ago 21 13:53 /projects/oe-core/build/tmp-glibc/work/armv7at2hf-neon-angstrom-linux-gnueabi/coap-playground/1.0-r0/recipe-sysroot/usr/lib/libcoap.a
lrwxrwxrwx 1 udev udev 173 Ago 29 14:33 /projects/oe-core/build/tmp-glibc/work/armv7at2hf-neon-angstrom-linux-gnueabi/coap-playground/1.0-r0/recipe-sysroot/usr/lib/libcoap.so -> ../../projects/oe-core/build/tmp-glibc/work/armv7at2hf-neon-angstrom-linux-gnueabi/libcoap/4.1.2+gitAUTOINC+d48ab449fd-r0/image/usr/lib/libcoap.so.4.1.2
-rwxr-xr-x 2 udev udev 38444 Ago 21 13:53 /projects/oe-core/build/tmp-glibc/work/armv7at2hf-neon-angstrom-linux-gnueabi/coap-playground/1.0-r0/recipe-sysroot/usr/lib/libcoap.so.4.1.2
It is not hard to noticed that the symlink is kind of weird:
/projects/oe-core/build/tmp-glibc/work/armv7at2hf-neon-angstrom-linux-gnueabi/coap-playground/1.0-r0/recipe-sysroot/usr/lib/libcoap.so -> ../../projects/oe-core/build/tmp-glibc/work/armv7at2hf-neon-angstrom-linux-gnueabi/libcoap/4.1.2+gitAUTOINC+d48ab449fd-r0/image/usr/lib/libcoap.so.4.1.2
My libcoap.bb contains inherit relative_symlinks (otherwise an absolute link to "/projects" is created and bitbake fails) but the symlink created simply prepends "../../" to the original link.
So... the questions are:
Why do I need inherit relative_symlinks? Shouldn't make install create a symlink relative to sysroot out of the box?
Generated Makefile contains:
librootdir = $(DESTDIR)$(prefix)/lib
# ...
ln -s $(librootdir)/$(LIBSO).4.1.2 $(librootdir)/$(LIBSO)
And I thought $(DESTDIR) would already point to the correct place during bitbake's installation...
What is the right way to fix it? Could it be something wrong at the other side (the application trying to link against libcoap)?
Thanks in advance.
Resources
libcoap.bb is based on Internet and quite simple:
SUMMARY = "A C implementation of IETF Constrained Application Protocol (RFC 7252)"
DESCRIPTION = "Libcoap provides an implementation of the IETF CoAP protocol"
HOMEPAGE = "http://sourceforge.net/projects/libcoap/"
SECTION = "libs/network"
PROVIDES = "libcoap"
SRCREV = "d48ab449fd05801e574e4966023589ed7dac500b"
# Lookout for PV bump too when SRCREV is changed
PV = "4.1.2+git${SRCPV}"
LICENSE = "GPLv2 | BSD"
LIC_FILES_CHKSUM = "file://${S}/LICENSE.BSD;md5=1164f52f9c4db2c13f681b201010d518 \
file://${S}/LICENSE.GPL;md5=4641e94ec96f98fabc56ff9cc48be14b"
S = "${WORKDIR}/git"
SRC_URI = "git://git.code.sf.net/p/libcoap/code"
inherit autotools-brokensep relative_symlinks
EXTRA_OECONF += "--with-shared"
EXTRA_OEMAKE += "all"
INSANE_SKIP_${PN} = "ldflags"
BBCLASSEXTEND = "native nativesdk"

Yocto SDK, QtWebEngine: Unknown module(s) in QT: webengine

I'm doing my first steps with Qt and QtWebEngine on an embedded board (i.MX6), using Yocto. Using provided example recipes, like the quicknanobrowser, works nicely on the target. So I can't confirm this answer which claims that WebEngine is not available on embedded platforms.
Now I want to write my own QML application and deploy it on the board. With the recipe meta-toolchain-qt5 I created an SDK and installed it. In QtCreator I set all paths to the SDK installation and tried to build it, but got this error:
Project ERROR: Unknown module(s) in QT: webengine
11:13:13: The process "/opt/poky/1.8/sysroots/x86_64-pokysdk-linux/usr/bin/qt5/qmake" exited with code 3.
It turned out that WebEngine was not included in the SDK. Thanks to this answer, I fixed that by putting the following to my own packagegroup-qt5-toolchain-target.bbappend file:
RDEPENDS_${PN} += " \
qtwebengine \
qtwebengine-qmlplugins \
qtquickcontrols-qmlplugins \
qtwebengine-examples \
"
Then reinstalled the SDK. Now it seems that all WebEngine files are available in the SDK installation (the zsh glob pattern below matches all directories in any subdirectory of /opt/poky/1.8/, which contain "webengine", case-insensitively):
% ls -1 -d (#i)/opt/poky/1.8/**/*webengine*(/)
/opt/poky/1.8/sysroots/cortexa9hf-vfp-neon-poky-linux-gnueabi/usr/include/qt5/QtWebEngine/
/opt/poky/1.8/sysroots/cortexa9hf-vfp-neon-poky-linux-gnueabi/usr/include/qt5/QtWebEngine/5.4.3/QtWebEngine/
/opt/poky/1.8/sysroots/cortexa9hf-vfp-neon-poky-linux-gnueabi/usr/include/qt5/QtWebEngineWidgets/
/opt/poky/1.8/sysroots/cortexa9hf-vfp-neon-poky-linux-gnueabi/usr/include/qt5/QtWebEngineWidgets/5.4.3/QtWebEngineWidgets/
/opt/poky/1.8/sysroots/cortexa9hf-vfp-neon-poky-linux-gnueabi/usr/lib/qt5/qml/QtWebEngine/
/opt/poky/1.8/sysroots/cortexa9hf-vfp-neon-poky-linux-gnueabi/usr/share/qt5/examples/webengine/
/opt/poky/1.8/sysroots/cortexa9hf-vfp-neon-poky-linux-gnueabi/usr/share/qt5/examples/webenginewidgets/
/opt/poky/1.8/sysroots/cortexa9hf-vfp-neon-poky-linux-gnueabi/usr/share/qt5/translations/qtwebengine_locales/
Still, I get the same Unknown module error. This is independent of QtCreator, and can also be shown by directly calling qmake:
% source /opt/poky/1.8/environment-setup-cortexa9hf-vfp-neon-poky-linux-gnueabi
% /opt/poky/1.8/sysroots/x86_64-pokysdk-linux/usr/bin/qt5/qmake /home/me/test/test.pro -r -spec linux-oe-g++ CONFIG+=debug CONFIG+=declarative_debug CONFIG+=qml_debug
Project ERROR: Unknown module(s) in QT: webengine
The project itself should be fine, because it compiles and runs without problems on the Desktop installation.
Any ideas? Are there maybe still some files missing in the SDK? Where does qmake search for the modules? How can I tell qmake where to find the WebEngine installation?
In /opt/poky/1.8/environment-setup-cortexa9hf-vfp-neon-poky-linux-gnueabi
add sh /opt/poky/1.8/sysroots/x86_64-pokysdk-linux/environment-setup.d/qt5.sh
This will set up the Qt5 environment.