Yocto + Autotools library + CMake application = linker error - cmake

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"

Related

Can't copy files to my target device in yocto

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 "

Yocto populate SDK - Receipe inherit from cmake

I use cmake to build my source code. It depend on a package named "spdlog".
I want to generate the sdk using yocto. SDK is correctly generated using populate_sdk but spdlog config cmake file is not shipped in SDK.
My receipe :
SUMMARY = "Spdlog"
DESCRIPTION = "Fast C++ logging library"
AUTHOR = "author name"
LICENSE = "CLOSED"
SECTION = "libs"
SRC_URI = "git://git#github.com/gabime/spdlog.git;branch=master;protocol=ssh"
SRCREV = "7088644d3f69f18b51671eb52dd49028fd858add"
PR = "r0"
PVBASE := "${PV}"
FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}-${PVBASE}:"
PV = "${PVBASE}.${SRCPV}"
S = "${WORKDIR}/git"
inherit cmake pkgconfig
FILES_${PN} += "/usr/lib/cmake/spdlog/spdlogConfig.cmake \
/usr/lib/cmake/spdlog/spdlogConfigVersion.cmake \
"
But, we I install my SDK and try to use it to compil my code, it failed with this error :
Make Error at CMakeLists.txt:89 (find_package):
Could not find a package configuration file provided by "spdlog" with any
of the following names:
spdlogConfig.cmake
spdlogConfigVersion.cmake
When I check my build tmp/work/spdlog folder, I can see the files exported :
./image/usr/lib/cmake/spdlog/spdlogConfig.cmake
./sysroot-destdir/usr/lib/cmake/spdlog/spdlogConfig.cmake
./packages-split/spdlog/usr/lib/cmake/spdlog/spdlogConfig.cmake
./build/CMakeFiles/Export/lib/cmake/spdlog/spdlogConfig.cmake
./build/spdlogConfig.cmake
./package/usr/lib/cmake/spdlog/spdlogConfig.cmake
./recipe-sysroot-native/usr/share/cmake-3.8/Modules/FindPkgConfig.cmake
./recipe-sysroot-native/usr/share/cmake-3.8/Modules/UsePkgConfig.cmake
Do you have any idea about this issue ?
Every package from FILES_${PN}-dev will be available in Yocto SDK.
The solution for my issue is to set cmake required config file *.cmake under FILES_${PN}-dev.

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.

review board diff not uploading

i am currently attempting to do a diff using review board but keep getting an ambiguous error message:
Error uploading diff
Your review request still exists, but the diff is not attached.
The debug messages do not give much away either, no errors whatsoever....
>>> RBTools 0.4.1
>>> Home = /home/tom
>>> HTTP GETting api/
>>> HTTP GETting http://127.0.0.1/api/info/
>>> Using the new web API
Index: /trunk/0.1/scripts/configure-apache.sh
===================================================================
--- /trunk/0.1/scripts/configure-apache.sh (revision 143)
+++ /trunk/0.1/scripts/configure-apache.sh (working copy)
## -1,5 +1,5 ##
#! /bin/bash
-
+echo hello
cd ..
#SRCHEAD="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
SRCHEAD=$SRC_HEAD
This is what my ".reviewboardrc" file contains:
REVIEWBOARD_URL = "http://127.0.0.1/"
the repository path is: "https://XXX/svn/infinity/trunk/0.1"
does anyone know where i can start in order to resolve this issue i am seeing?
thanks in advance
The problem you are facing may be that the relative path in the diff file is not correlated with the path of the repository as it is configured in Reviewboard.
Reviewboard, in order to find in the repository the files mentioned in the diff, will concatenate the URLs like this:
URL of the repo as configured in Reviewboard
+
optionally - the Base directory as it appears in the
Reviewboard Upload diff dialog - which can be absolute/complete
but also relative(!)
+
the relative path of the modified file as it appears in the diff file.
All these must be correlated.
Therefore, in your case, if your repository configured URL is:
https://XXX/svn/infinity/trunk/0.1
and your relative path in the diff file is:
/trunk/0.1/scripts/configure-apache.sh
... that will not work because the resulting absolute path of the file in the repo will be incorrect:
https://XXX/svn/infinity/trunk/0.1/trunk/0.1/scripts/configure-apache.sh
Possible solutions would be:
Your URL for SVN should be configured in Reviewboard like this:
https://XXX/svn/infinity
OR
The diff should be created at a lower level in the folders hierarchy - in this case it should be done at ../0.1/ level so that the path in the diff file results in /scripts/configure-apache.sh
HTH!
a workaround is to do a manual svn diff and save to a file and then compare the working copy with the trunk in the web ui

AIX Missing Symbols ap_cleanup_scoreboard and ap_accept_lock_mech for Apache Process. However, the symbols do exist

I am having a problem whereby apache is not able to find certain symbols referenced from a library (mod_wsgi) loaded within the apache process.
When i start the apache process, i get this error.
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
root [zibal]% ./usr/local/apache2/bin/apachectl restart httpd: Syntax error on line 53 of /usr/local/apache2/conf/httpd.conf: Cannot load /usr/local/apache2/modules/mod_wsgi.so into server:
rtld:0712-001 Symbol ap_cleanup_scoreboard was referenced from module /usr/local/apache2/modules/mod_wsgi.so(), but a runtime definition of the symbol was not found.
rtld: 0712-001 Symbol ap_accept_lock_mech was referenced from module /usr/local/apache2/modules/mod_wsgi.so(), but a runtime definition of the symbol was not found
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
I am pasting the output of nm command on the apache executable and those symbols seem to exist.
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
root [zibal]% nm ./usr/local/apache2/bin/httpd | grep ap_accept_lock_mech
ap_accept_lock_mech D 536880332
ap_accept_lock_mech d 536900392 4
ap_accept_lock_mech:G879 - 0
root [zibal]% nm ./usr/local/apache2/bin/httpd | grep ap_cleanup_scoreboard
.ap_cleanup_scoreboard T 268613428 212
ap_cleanup_scoreboard D 536890068
ap_cleanup_scoreboard d 536890068 12
ap_cleanup_scoreboard d 536899972 4
ap_cleanup_scoreboard:F385 - 2976 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Please guide.
And this is how I was able to solve this issue (I had to do apply two solutions as indicated below).
Solution 1 (Thanks to Graham Dumpleton)
Don't change anything in Apache Code.
Go into mod_wsgi.c source code and change:
/*
* Cleanup the Apache scoreboard to ensure that any
* shared memory segments or memory mapped files not
* available to code in daemon processes.
*/
ap_cleanup_scoreboard(0);
to
#if 0
/*
* Cleanup the Apache scoreboard to ensure that any
* shared memory segments or memory mapped files not
* available to code in daemon processes.
*/
ap_cleanup_scoreboard(0);
#endif
and then look for:
#if !defined(AP_ACCEPT_MUTEX_TYPE)
sconfig->lock_mechanism = ap_accept_lock_mech;
#else
sconfig->lock_mechanism = APR_LOCK_DEFAULT;
#endif
and change it to:
#define AP_ACCEPT_MUTEX_TYPE 1
#if !defined(AP_ACCEPT_MUTEX_TYPE)
sconfig->lock_mechanism = ap_accept_lock_mech;
#else
sconfig->lock_mechanism = APR_LOCK_DEFAULT;
#endif
Then build mod_wsgi
Solution 2 (Thanks to Jeff Trawick from Apache)
Extract the Source tar ball in a directory.....cd into that directory
Locate the file include/mpm_common.h
Change
extern apr_lockmech_e ap_accept_lock_mech;
to
AP_DECLARE_DATA extern apr_lockmech_e ap_accept_lock_mech;
Locate the file include/scoreboard.h
Change
apr_status_t ap_cleanup_scoreboard(void *d);
to
AP_DECLARE(apr_status_t) ap_cleanup_scoreboard(void *d);
And then issue the following commands
./configure
make
After this step, there will be a httpd.exp file create in the server
directory and a httpd file created in the present directory
remove httpd
edit server/httpd.exp and add one line for ap_accept_lock_mech
make
make install (as root)
Then build mod_wsgi 3.3 from Source Tarball
I hope this helps others facing the same problem.