How to build json on Yocto

cancel
Showing results for 
Search instead for 
Did you mean: 

How to build json on Yocto

403 Views
Contributor IV

Hi,

I am having iMX8M Miini EVK and I am able to build - "core-image-minimal" yocto image for iMX8M Mini. 

I am following all the steps given in user guide - 

                                                   IMXLXYOCTOUG
                                                   Rev. L4.19.35_1.1.0, 11/2019
                                                   i.MX Yocto Project User's Guide


But Now I want to build and add json 11 in my yocto build but I am facing below issue -

******************************************************************

1. My json11_1.0.0.bb and layer.conf  files are below ->

******************************************************************

/home/MX8M_Yocto_Build/sources/meta-json11/recipes-json11/json11

***********************************************************************************

json11_1.0.0.bb

SUMMARY = "JSON11 bindings for apps which will manipulate JSON data"
DESCRIPTION = "JSON11 implements a reference counting object model that allows you to easily construct JSON objects in C++11."
HOMEPAGE = "https://github.com/dropbox/json11"
LICENSE = "CLOSED"
SRC_URI = "https://github.com/dropbox/json11/archive/v1.0.0.zip;"

S = "${WORKDIR}/json11-${PV}"

SRC_URI[md5sum] = "e69da5a76ba4cc41ab548d2c1045972d"
SRC_URI[sha256sum] = "c8bddf94e0cb40cd396480c02198f69ed3c1097446ea6e9730c16a0d568031c1"

inherit autotools cmake pkgconfig


 

/home/MX8M_Yocto_Build/sources/meta-json11/conf

***********************************************************************************

layer.conf

# We have a conf and classes directory, add to BBPATH
BBPATH .= ":${LAYERDIR}"

# We have recipes-* directories, add to BBFILES
BBFILES += "${LAYERDIR}/recipes-*/*/*.bb \
            ${LAYERDIR}/recipes-*/*/*.bbappend"

BBFILE_COLLECTIONS += "json11"
BBFILE_PATTERN_json11 = "^${LAYERDIR}/"
BBFILE_PRIORITY_json11 = "6"

LAYERVERSION_json11 = "1"
LAYERSERIES_COMPAT_json11 = "rocko sumo thud warrior"

******************************************************************

2. build the json 11 using bitbake command

******************************************************************

Apart from this I add below lines in following files =>

bblayers.conf

BBLAYERS += "${BSPDIR}/sources/meta-json11"

local.conf

IMAGE_INSTALL_append = " json11"

And when I run bitbake json11 command

json is getting compiled successfully and its binaries are also created in -

/home/iMX8M_Yocto_Build/imx8M_build_xwayland/tmp/work/aarch64-poky-linux/json11/1.0-r0

******************************************************************

2. build the json 11 with core-image-minimal using bitbake command

******************************************************************

core-image-minimal.bb

MAGE_INSTALL += " json11"

but when i try to add this with yocto and build core-image-minimal I get error -

ERROR: core-image-minimal-1.0-r0 do_rootfs: Could not invoke dnf. Command '/home/iMX8M_Yocto_Build/imx8M_build_xwayland/tmp/work/imx8mmevk-poky-linux/core-image-minimal/1.0-r0/recipe-sysroot-native/usr/bin/dnf -v --rpmverbosity=info -y -c /home/iMX8M_Yocto_Build/imx8M_build_xwayland/tmp/work/imx8mmevk-poky-linux/core-image-minimal/1.0-r0/rootfs/etc/dnf/dnf.conf --setopt=reposdir=/home/iMX8M_Yocto_Build/imx8M_build_xwayland/tmp/work/imx8mmevk-poky-linux/core-image-minimal/1.0-r0/rootfs/etc/yum.repos.d --installroot=/home/iMX8M_Yocto_Build/imx8M_build_xwayland/tmp/work/imx8mmevk-poky-linux/core-image-minimal/1.0-r0/rootfs --setopt=logdir=/home/iMX8M_Yocto_Build/imx8M_build_xwayland/tmp/work/imx8mmevk-poky-linux/core-image-minimal/1.0-r0/temp --repofrompath=oe-repo,/home/iMX8M_Yocto_Build/imx8M_build_xwayland/tmp/work/imx8mmevk-poky-linux/core-image-minimal/1.0-r0/oe-rootfs-repo --nogpgcheck install packagegroup-fsl-optee-imx packagegroup-core-boot jailhouse mongodb-c-driver json11 run-postinsts' returned 1:
DNF version: 4.1.0
cachedir: /home/iMX8M_Yocto_Build/imx8M_build_xwayland/tmp/work/imx8mmevk-poky-linux/core-image-minimal/1.0-r0/rootfs/var/cache/dnf
Added oe-repo repo from /home/iMX8M_Yocto_Build/imx8M_build_xwayland/tmp/work/imx8mmevk-poky-linux/core-image-minimal/1.0-r0/oe-rootfs-repo
repo: using cache for: oe-repo
not found other for:
not found modules for:
not found deltainfo for:
not found updateinfo for:
oe-repo: using metadata from Thu 06 Feb 2020 10:25:54 AM UTC.
Last metadata expiration check: 0:00:01 ago on Thu 06 Feb 2020 10:25:56 AM UTC.
No module defaults found
No match for argument: json11
Error: Unable to find a match

ERROR: core-image-minimal-1.0-r0 do_rootfs:
ERROR: core-image-minimal-1.0-r0 do_rootfs: Function failed: do_rootfs
ERROR: Logfile of failure stored in: /home/iMX8M_Yocto_Build/imx8M_build_xwayland/tmp/work/imx8mmevk-poky-linux/core-image-minimal/1.0-r0/temp/log.do_rootfs.8554
ERROR: Task (/home/iMX8M_Yocto_Build/sources/poky/meta/recipes-core/images/core-image-minimal.bb:do_rootfs) failed with exit code '1'
NOTE: Tasks Summary: Attempted 2939 tasks of which 2938 didn't need to be rerun and 1 failed.

 

But When I check my binaries in folder  -

/home/iMX8M_Yocto_Build/imx8M_build_xwayland/tmp/work/aarch64-poky-linux/json11/1.0.0-r0

But still I am getting error that -

No module defaults found
No match for argument: json11
Error: Unable to find a match

Please help me or suggest me what all changes or steps I need to do to solve this issue.

 

 

Thanks,

Maneesh

0 Kudos
1 Reply

104 Views
Contributor IV

Hi,

I have found that  do_install try to create few rpm packages such as base package, -dbg package, -dev package etc...

inside below folder of Yocto build  -

/tmp/work/aarch64-poky-linux/json11/1.0.0-r0/deploy-rpms/

and some pkgdata files inside -

/tmp/work/aarch64-poky-linux/json11/1.0.0-r0/pkgdata/runtime/

But in my case -dbg, -dev rpm package is getting created but main rpm package is not getting created. because yocot don't create empty rpm package by default.

(but empty package for -dbg, -dev are allowed by default hence .rpm files for these are getting created but not for main package )

Hence I used below line my .bb files and because of that empty rpm file for main package is also getting created.  -

ALLOW_EMPTY_${PN} = "1"  

But After I do core-image-minimal it will succeed and built the .scdard image. 

But when I check in this image I found no lib files or header files are included for  my recipe i.e.json11.

I mean to say lib and header files of json11 is not getting added as part of core-image-minimal final image. 

May be its because of empty .rpm package and pkgdata file.

Now My question is how can I solve this issue ?

What I need to do to add my .so files and header files of json11 to be included in  core-image-minimal image.

Thanks & Regards,

Maneesh