cmakeshared-librariesyoctocmocka

How to deal with symbolic links in Yocto recipe using cmake?


I am trying to put cmocka into Embedded Linux target board.
I have created rootfs using Yocto, and I have added a custom recipe for cmocka-1.1.5. The cmocka shared library gets generated using my custom bitbake recipe, but when I try to build the complete image using bitbake core-image-sato it fails with the following error:

ERROR: cmocka-1.1.5-1.0+AUTOINC+546bd50924-r0 do_package_qa: QA Issue: non -dev/-dbg/nativesdk- package contains symlink .so: cmocka-1.1.5 path '/work/aarch64-poky-linux/cmocka-1.1.5/1.0+AUTOINC+546bd50924-r0/packages-split/cmocka-1.1.5/usr/lib/libcmocka.so' [dev-so]
ERROR: cmocka-1.1.5-1.0+AUTOINC+546bd50924-r0 do_package_qa: QA run found fatal errors. Please consider fixing them.
ERROR: cmocka-1.1.5-1.0+AUTOINC+546bd50924-r0 do_package_qa: 
ERROR: cmocka-1.1.5-1.0+AUTOINC+546bd50924-r0 do_package_qa: Function failed: do_package_qa
ERROR: Logfile of failure stored in: /mnt/Drive_2/odroid-yocto/build/tmp/work/aarch64-poky-linux/cmocka-1.1.5/1.0+AUTOINC+546bd50924-r0/temp/log.do_package_qa.22650
ERROR: Task (/mnt/Drive_2/odroid-yocto/meta-xeb360/recipes-cmocka/cmocka-1.1.5/cmocka-1.1.5.bb:do_package_qa) failed with exit code '1'  

My custom bitbake recipe cmocka-1.1.5.bb is shown below:

DESCRIPTION = "An elegant unit testing framework for C with support for mock objects"
SECTION = "Unit Testing"
LICENSE = "GPLv3"

PR = "r0"

LIC_FILES_CHKSUM = "file://COPYING;md5=3b83ef96387f14655fc854ddc3c6bd57"

SRCREV = "${AUTOREV}"
PVBASE := "${PV}"
PV = "${PVBASE}+${SRCPV}"

SRC_URI = "git://git.cryptomilk.org/projects/cmocka.git"

S = "${WORKDIR}/git"

inherit pkgconfig cmake

EXTRA_OECMAKE = ""

PACKAGES = "${PN} ${PN}-dev ${PN}-dbg ${PN}-staticdev"

RDEPENDS_${PN}-staticdev = ""
RDEPENDS_${PN}-dev = ""
RDEPENDS_${PN}-dbg = ""

do_configure() { 
 cd ${S}/../build/
 cmake -DCMAKE_INSTALL_PREFIX=${exec_prefix} ../git/
}

do_compile() {
    cd ${S}/../build/
    oe_runmake
}

INHIBIT_PACKAGE_STRIP = "1"
INHIBIT_SYSROOT_STRIP = "1"
SOLIBS = ".so*"
SOLIBSDEV += ".so"
FILES_SOLIBSDEV = ""

FILES_${PN}-dev = "\
    ${libdir}/lib*${SOLIBS} \
    ${includedir} \
    ${libdir}/pkgconfig \
    ${libdir}/cmake \
    ${libdir}/cmake/cmocka \
    ${libdir}/cmake/cmocka/cmocka-config.cmake \
    ${libdir}/cmake/cmocka/cmocka-config-version.cmake \
"  

Can anyone please let me know what I am missing or what I am doing wrong?


Solution

  • this recipe could be simplified a bit like below. Some of the constructs in play are not needed.

    DESCRIPTION = "\
    cmocka is an elegant unit testing framework for C with support for mock \
    objects. It only requires the standard C library, works on a range of computing \
    platforms (including embedded) and with different compilers."
    
    LICENSE = "Apache-2.0"
    
    LIC_FILES_CHKSUM = "file://COPYING;md5=3b83ef96387f14655fc854ddc3c6bd57"
    
    SRC_URI = "git://git.cryptomilk.org/projects/cmocka.git"
    
    SRCREV = "546bd50924245f4ca7292a3ef6a92504aa375455"
    
    PV = "1.1.5+git${SRCPV}"
    
    S = "${WORKDIR}/git"
    
    inherit pkgconfig cmake