SRC_URI not working in bitabake recipe - yocto

I created a bitbake recipe for installing https://pypi.python.org/pypi/Adafruit-GPIO/1.0.3 python package. Following is my recipe
DESCRIPTION = "Library to provide a cross-platform GPIO interface on the Raspberry Pi and Beaglebone Black using the RPi.GPIO and Adafruit_BBIO libraries"
SECTION = "devel/python"
LICENSE = "CLOSED"
PR = "r1"
SRC_URI = "https://pypi.python.org/packages/db/1c/2dc8a674514219f287fa344e44cadfd77b3e2878d6ff602a8c2149b50dd8/Adafruit_GPIO-1.0.3.tar.gz"
inherit pypi setuptools
do_install_append() {
rm -f ${D}${libdir}/python*/site-packages/site.py*
}
do_compile_prepend() {
${STAGING_BINDIR_NATIVE}/python setup.py install ${DISTUTILS_BUILD_ARGS} || \
true
}
SRC_URI[md5sum] = "dfcdb1ba90188d18ba80b6d2958c8c33"
But whenever I try to bitbake recipe I always receive following error
ERROR: Function failed: Fetcher failure for URL: 'https://pypi.python.org/packages/source/A/Adafruit-GPIO/Adafruit-GPIO-1.0.3.tar.gz'. Unable to fetch URL from any source
My question why does bitbake tries to download from some other link while I have some other link in SRC_URI? How can I correct my recipe>

It's pypi.bbclass that specifies another download URL.
So either
remove inherit pypi
or
remove your SRC_URI. In this case, you will also need to set PYPI_PACKAGE = "Adafruit-GPIO" to the correct package name in pypi (as your recipe has a - instead of a _ in its name).
See pypi.bbclass
An untested version of your recipe that at least builds on my system is adafruit-gpio_1.0.3.bb (note, only lowercase letters in the recipe name):
DERIPTION = "Library to provide a cross-platform GPIO interface on the Raspberry Pi and Beaglebone Black using the RPi.GPIO and Adafruit_BBIO libraries"
SECTION = "devel/python"
LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://PKG-INFO;md5=e41c52dbe1b96447d1c50129a124f586"
SRC_URI[md5sum] = "dfcdb1ba90188d18ba80b6d2958c8c33"
SRC_URI[sha256sum] = "d6465b92c866c51ca8f3bc1e8f2ec36f5ccdb46d0fd54101c1109756d4a2dcd0"
PYPI_PACKAGE = "Adafruit_GPIO"
inherit pypi setuptools

Related

Unable to put lapack.so file inside rootfs

I'm trying to install lapack on my 64 bit ARMV8 board with yocto. I have lapack-3.9 bitbake recipe and it has been successfully built. It has successfully created libblas.so and liblapack.so inside image/usr/lib64 folder.
I added lapack to my local.conf . The problem is when i do
bitbake core-image-weston
I don't have these .so inside my rootfs. That is, inside /usr/lib64.
What am i missing here???
Below is my lapack_3.9.0.bb recipe-
SUMMARY = "Linear Algebra PACKage"
URL = "http://www.netlib.org/lapack"
LICENSE = "BSD-3-Clause"
LIC_FILES_CHKSUM = "file://LICENSE;md5=930f8aa500a47c7dab0f8efb5a1c9a40"
# Recipe needs FORTRAN support (copied from conf/local.conf.sample.extended)
# Enabling FORTRAN
# Note this is not officially supported and is just illustrated here to
# show an example of how it can be done
# You'll also need your fortran recipe to depend on libgfortran
#FORTRAN_forcevariable = ",fortran"
#RUNTIMETARGET_append_pn-gcc-runtime = " libquadmath"
DEPENDS = "libgfortran"
SRC_URI = "https://github.com/Reference-LAPACK/lapack/archive/v${PV}.tar.gz"
SRC_URI[md5sum] = "0b251e2a8d5f949f99b50dd5e2200ee2"
SRC_URI[sha256sum] = "106087f1bb5f46afdfba7f569d0cbe23dacb9a07cd24733765a0e89dbe1ad573"
EXTRA_OECMAKE = " -DBUILD_SHARED_LIBS=ON "
OECMAKE_GENERATOR = "Unix Makefiles"
inherit cmake pkgconfig
EXCLUDE_FROM_WORLD = "1"
Also, when i try to add lapack-dev and lapack-dbg ipks to my local.conf, it only allows lapack-dbg but gives an error for lapack-dev -
ERROR:
Collected errors:
* Solver encountered 1 problem(s):
* Problem 1/1:
* - nothing provides lapack = 3.9.0-r0 needed by lapack-dev-3.9.0-r0.aarch64
*
* Solution 1:
* - do not ask to install a package providing lapack-dev

In Yocto, how to include header files from another recipes

My program depends on the poco recipes, which provides both the header files and shared libraries. However, I cannot make use of the header files from poco in my recipe, which leads to the error Poco/Delegate.h: No such file for directory.
How do I make the header available at build time for my software package?
Here is an example recipe:
SUMMARY = ""
DESCRIPTION = ""
AUTHOR = ""
LICENSE = "CLOSED"
LIC_FILES_CHKSUM = ""
HOMEPAGE = ""
BUGTRACKER = ""
S = "${WORKDIR}"
SRC_URI = " file://foo.cpp \
file://CMakeLists.txt \
"
inherit pkgconfig cmake
DEPENDS_foo = "poco"
RDEPENDS_foo = "poco"
do_install() {
install -d ${D}/${bindir}
install -m 755 ${S}/foo ${D}/${bindir}
}
FILES_${PN} = "${bindir}/foo"
We can use provider and user to illustrate this case, the package (recipe) provides a header file to be used by another package (recipe) is the provider, the package (recipe) use a header file from another package (recipe) is the user.
First we change the provider's recipe (myprovider.bb) to export the header file -- myapi.h,
...
do_install() {
install -d ${D}/${bindir}
install -m 755 ${B}/hello_provider ${D}/${bindir}
install -d ${D}${libdir}/lib_myprovider/
install -m 0755 ${WORKDIR}/myapi.h ${STAGING_DIR_TARGET}${libdir}/lib_myprovider/
}
...
Secondly we change the user's recipe (myuser.bb) to refer the header file -- myapi.h
...
do_compile () {
${CC} ${WORKDIR}/main.c -o hello_user ${CFLAGS} ${LDFLAGS} -I${STAGING_DIR_TARGET}/${libdir}/lib_myprovider/
}
# file dependency declaration
FILES_${PN} = "${libdir}/lib_myprovider"
# package dependency declaration
DEPENDS += "myprovider"
...
At last, rebuild myprovider.bb and myuser.bb recipes, it should work.
Manual recommends:
Recipes should never populate the sysroot directly:
Recommended way is (poco recipe should do something similar):
Files should be installed into standard locations:
...
do_install() {
...
install -d ${D}${includedir}
install -m 0755 ${S}/myapi.h ${D}${includedir}/
...
}
...
Than, include poco recipe as a build dependency of foo.bb :
DEPENDS += "poco"
And compile normally.
You could use DEPENDS to have dependency with "poco" recipe and it would build and populate "poco" recipe's headers and libs into your recipe's sysroot.
Similar way you have to mention the export paths in the provider's recipe with FILES_*( * - package type)

systemd yocto recipe for an existing executable

I'm looking for a template recipe for enabling a systemd recipe in yocto. The executable is already installed by a recipe provided by yocto. The goal of this recipe is to provide make /usr/bin/btattach be run at startup.
As a start I created the following structure in my layer in the appropriate recipe directory:
btattach-systemd/
|-- files
| `-- btattach.service
`-- btattach-systemd.bb
The content of the recipe
SUMMARY = "Writes patterns to the fb device"
LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"
inherit systemd
REQUIRED_DISTRO_FEATURES= "systemd"
SRC_URI = "file://btattach.service"
S = "${WORKDIR}"
do_install () {
install -m 0644 ${WORKDIR}/btattach.service.service ${D}${sysconfdir}/systemd/system
}
SYSTEMD_SERVICE_${PN} = "btattach.service"
Besides that, the IMAGE_INSTALL in the image recipe has been correctly extended with btattach-systemd.
bitbake btattach-systemd runns ok but when trying to build the complete image the at do_rootfs step for the whole image. with the error:
* opkg_solver_install: Cannot install package btattach-systemd.
Ideas on where the bug is?
I think the recipe should look like this (leaving out summary, license, license checksum, and assuming that the binary package is called "btattach"):
SRC_URI = "file://btattach.service"
SYSTEMD_SERVICE_${PN} = "btattach.service"
inherit systemd
do_install_append() {
install -d ${D}${systemd_unitdir}/system
for service in ${SYSTEMD_SERVICE_${PN}}; do
install -m 0644 ${WORKDIR}/${service} ${D}${systemd_unitdir}/system/
sed -i -e 's,#BINDIR#,${bindir},g' ${D}${systemd_unitdir}/system/${service}
done
}
RDEPENDS_${PN} = "btattach"
I am sorry for not commenting your question as I have no reputation for that. Also, LetoThe2nd answer is more complete than mine, but here follows a possible quick fix:
It seems to me you are installing 'btattach.service.service' instead of 'btattach.service'.
Assuming that the .service file is correct, my take on the Yocto recipe and why it might be failing is because that the btattach.service file isn't included with the installation which is what the final line does below.
Have you ensured that you do a bitbake btattach.systemd -c cleanall and bitbake btattach.systemd -c cleanstate beforehand as well, as I noticed you had a typo in the Yocto recipe as btattach.service.service.
SUMMARY = "Writes patterns to the fb device"
LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"
inherit systemd
REQUIRED_DISTRO_FEATURES= "systemd"
SRC_URI = "file://btattach.service"
S = "${WORKDIR}"
do_install () {
install -m 0644 ${WORKDIR}/btattach.service ${D}${sysconfdir}/systemd/system
}
SYSTEMD_SERVICE_${PN} = "btattach.service"
FILES_${PN} += "/lib/systemd/system/btattach.service"

bitbake error package not found in base feeds

I want to include https://pypi.python.org/pypi/ndeflib in my image. Thus I created a recipe for this. Following are the contents of python-ndeflib_0.2.0.bb
DESCRIPTION = "NFC Data Exchange Format decoder and encoder."
SECTION = "devel/python"
LICENSE = "CLOSED"
SRC_URI = "https://pypi.python.org/packages/0c/0f/b9d94cee7847697469c49a25b4d23236de534451990b83008e6bf4fab15b/ndeflib-0.2.0.tar.gz"
do_install_append() {
rm -f ${D}${libdir}/python*/site-packages/site.py*
}
do_compile_prepend() {
${STAGING_BINDIR_NATIVE}/python setup.py install ${DISTUTILS_BUILD_ARGS} || \
true
}
SRC_URI[md5sum] = "b7ae0c34f49289c44c292e24843cfeb1"
I am able to bitbake python-ndeflib successfully
but whenever I try to build my final os image bitbake fsl-image-machine-test
the process fails at the with following error
ERROR: python-ndeflib not found in the base feeds
Thus where I am making mistake?
I had this error (projectname not found in base feeds in do_rootfs)solved in different project (non cmake , non make) with this:
ALLOW_EMPTY_${PN} = "1"
in its *.bb file.
Some other people has this error because they were using capital letters in project name.
Did you try to write a recipe similar to the one in your previousquestion? That should have solved your issue.
Writing something similar to that recipe, gives you python3-ndeflib_0.2.0.bb:
DESCRIPTION = "NFC Data Exchange Format decoder and encoder."
SECTION = "devel/python"
LICENSE = "ISC"
LIC_FILES_CHKSUM = "file://LICENSE;md5=f7c92777f3af9604e192a0d195b6a6a4"
SRC_URI[md5sum] = "b7ae0c34f49289c44c292e24843cfeb1"
SRC_URI[sha256sum] = "baa86a48cf310cf77524f6fa04f5bd90775c4c290116b6b543aa3d6d65b721bf"
inherit pypi setuptools3
Which seems to work pretty well. Note that I used Python 3 instead of two (setuptools3).
Ie inherit setuptools or setuptools3 instead of writing your own do_compile, do_install, etc, unless you really have to.

How to add HAProxy package into bitbake recipe

I am new to bitbake recipe. I am trying to add HAProxy package into bitbake. I am trying to create a recipe but not sure how to proceed with it.
so far I have just made it till here:
SUMMARY = "HAProxy support for NEXT"
HOMEPAGE = "http://www.haproxy.org/"
SECTION = "tools"
LICENSE = "GPLv2"
LIC_FILES_CHKSUM = "file://LICENSE;md5=2d862e836f92129cdc0ecccc54eed5e0"
SRC_URI = "http://www.haproxy.org/download/1.6/src/haproxy-${PV}.tar.gz"
SRC_URI[md5sum] = "3362d1e268c78155c2474cb73e7f03f9"
SRC_URI[sha256sum] = "fd06b45054cde2c69cb3322dfdd8a4bcfc46eb9d0c4b36d20d3ea19d84e338a7"
Can anyone point me to right direction?
haproxy is a Makefile based project, so this link should help:
http://www.yoctoproject.org/docs/2.1/dev-manual/dev-manual.html#new-recipe-makefile-based-package
You should define this variable in your recipe:
EXTRA_OEMAKE = "TARGET=XXX"
replacing XXX by the target your are interested (generic, linux22, linux24, and so on). That string TARGET=XXX will be passed as argument to the 'make' command, so bitbake will start compilation. Most probably that's all you need.