0

This question follows on from:
Do I need to edit the .patch files needed for building mdns 878.200.35 in Yocto?
This chains back through several posts to considerable background.

Since "mDNS" seemed to be working in my target and the recipe puts libdns_sd.so in "/usr/bin/", I went on to the next need, which is to build OCA, which links with libdns_sd.so. I created another layer for it and copied in my source files, in a folder called "Src", to an oca-1.2.7 folder under the files folder in my layer. I wrote the following recipe for it. The CAP_HOME environment variable has to be set to the base folder, oca-1.2.7, for "makefileOCA", etc., to work.
Putting underlined text in quotes seems to help get StackOverflow to accept my question formatting.
Also I put // comment markers in front of every line in my code or output blocks. Not sure if that helped.

//DESCRIPTION = "OCA"  
//PRIORITY = "optional"  
//SECTION = "protocols"  
//LICENSE = "MIT"  
//LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"  
//SRC_URI = "file://oca-1.2.7"  
//S = "${WORKDIR}/oca-1.2.7/Src"  
//# Need to override S because BitBake expects the source to be in a dir called  
//#  oca-1.2.7 in the work dir, but it's actually additionally under Src/.  
//# Need a do_compile, since OCA has a makefile with a non-standard name,  
//# makefileOCA. Also needs non-standard flags, -f and linuxRelease.  
//do_compile() {  
//export CAP_HOME="${WORKDIR}/oca-1.2.7"  
//make -f makefileOCA linuxRelease  
//}  
//do_install() {  
//    install -d ${D}${libdir}  
//    cp ../Obj/linuxApp/Release/OcaProtoController.so ${D}${libdir}/OcaProtoController.so  
//    chmod 0755 ${D}${libdir}/OcaProtoController.so  
//}  

Then I "bitbaked" or compiled my new layer:

//~/Yocto/imx-yocto-bsp/build-wayland$ time bitbake oca  
//[Text is in white starting with the preceeding "time bitbake oca"]  
//Parsing recipes: 100% |############################################################################################| Time: 0:01:04  
//Parsing of 3212 .bb files complete (0 cached, 3212 parsed). 4627 targets, 468 skipped, 1 masked, 0 errors.  
//NOTE: Resolving any missing task queue dependencies  

//Build Configuration:  
//BB_VERSION           = "1.44.0"  
//BUILD_SYS            = "x86_64-linux"  
//NATIVELSBSTRING      = "ubuntu-18.04"  
//TARGET_SYS           = "aarch64-poky-linux"  
//MACHINE              = "imx8mnddr4evk"  
//DISTRO               = "fsl-imx-wayland"  
//DISTRO_VERSION       = "5.4-zeus"  
//TUNE_FEATURES        = "aarch64 cortexa53 crc crypto"  
//TARGET_FPU           = ""  
//(snip SHA IDs)  

//Initialising tasks: 100% |#########################################################################################| Time: 0:00:01  
//Sstate summary: Wanted 13 Found 7 Missed 6 Current 67 (53% match, 92% complete)  
//NOTE: Executing Tasks  
//NOTE: Setscene tasks completed  
//[Following text is all in red]  
//ERROR: oca-1.2.7-r0 do_populate_sysroot: Fatal errors occurred in subprocesses:  
//Command '['aarch64-poky-linux-strip', '--remove-section=.comment', '--remove-section=.note', '--strip-unneeded', '~/Yocto/imx-yocto-bsp/build-wayland/tmp/work/aarch64-poky-linux/oca/1.2.7-r0/sysroot-destdir/usr/lib/OcaProtoController.so']' returned non-zero exit status 1.  
//Subprocess output:aarch64-poky-linux-strip: Unable to recognise the format of the input file `~/Yocto/imx-yocto-bsp/build-wayland/tmp/work/aarch64-poky-linux/oca/1.2.7-r0/sysroot-destdir/usr/lib/OcaProtoController.so'  

//ERROR: Logfile of failure stored in: ~/Yocto/imx-yocto-bsp/build-wayland/tmp/work/aarch64-poky-linux/oca/1.2.7-r0/temp/log.do_populate_sysroot.14772  
//ERROR: Task (~/Yocto/imx-yocto-bsp/build-wayland/meta-oca-so/recipes-example/oca/oca_1.2.7.bb:do_populate_sysroot) failed with exit code '1'  
//ERROR: oca-1.2.7-r0 do_package: Fatal errors occurred in subprocesses:  
//Command '['aarch64-poky-linux-objcopy', '--only-keep-debug', '~/Yocto/imx-yocto-bsp/build-wayland/tmp/work/aarch64-poky-linux/oca/1.2.7-r0/package/usr/lib/OcaProtoController.so', '~/Yocto/imx-yocto-bsp/build-wayland/tmp/work/aarch64-poky-linux/oca/1.2.7-r0/package/usr/lib/.debug/OcaProtoController.so']' returned non-zero exit status 1.  
//Subprocess output:aarch64-poky-linux-objcopy: Unable to recognise the format of the input file `~/Yocto/imx-yocto-bsp/build-wayland/tmp/work/aarch64-poky-linux/oca/1.2.7-r0/package/usr/lib/OcaProtoController.so'  

//ERROR: Logfile of failure stored in: ~/Yocto/imx-yocto-bsp/build-wayland/tmp/work/aarch64-poky-linux/oca/1.2.7-r0/temp/log.do_package.14771  
//ERROR: Task (~/Yocto/imx-yocto-bsp/build-wayland/meta-oca-so/recipes-example/oca/oca_1.2.7.bb:do_package) failed with exit code '1'  
//[Above text is all in red; back to white text following]  
//NOTE: Tasks Summary: Attempted 504 tasks of which 494 didn't need to be rerun and 2 failed.  

//Summary: 2 tasks failed:  
  //~/Yocto/imx-yocto-bsp/build-wayland/meta-oca-so/recipes-example/oca/oca_1.2.7.bb:do_populate_sysroot  
  //~/Yocto/imx-yocto-bsp/build-wayland/meta-oca-so/recipes-example/oca/oca_1.2.7.bb:do_package  
//Summary: There were 2 ERROR messages shown, returning a non-zero exit code.  

//real    5m36.431s  
//user    0m0.344s  
//sys     0m0.057s  

I found:

//~/Yocto/imx-yocto-bsp/build-wayland$ find -iname *OcaProtoController*  
//./tmp/work/aarch64-poky-linux/oca/1.2.7-r0/oca-1.2.7/Obj/linuxApp/Release/OcaProtoController.so  
//./tmp/work/aarch64-poky-linux/oca/1.2.7-r0/image/usr/lib/OcaProtoController.so  
//./tmp/work/aarch64-poky-linux/oca/1.2.7-r0/sysroot-destdir/usr/lib/OcaProtoController.so  
//./tmp/work/aarch64-poky-linux/oca/1.2.7-r0/package/usr/lib/OcaProtoController.so  

This is extremely encouraging. I am getting my build result, OcaProtoController.so, and now I just need to get it through the indicated strip and "objcopy" operations, or "do_populate_sysroot" and "do_package", which appear to be the respective tasks.

So how do I fix this? Additionally, can you point me to the best relevant documentation so that I can understand the fundamental processes? Meanwhile I continue to google and read.

Edit: I'm kind of hoping for an answer that would obviate the following horrible hack. But whatever works, I guess.

I found and tried this: https://github.com/nefethael/meta-random/issues/1 :

//It compiles if you do the most horrible hack ever.  
//INHIBIT_SYSROOT_STRIP = "1"  
//INHIBIT_PACKAGE_STRIP = "1"  
//INHIBIT_PACKAGE_DEBUG_SPLIT = "1"  
//The file stats is an executable file hidden in the vendor reference.  

I put those three lines in ~/Yocto/imx-yocto-bsp/build-wayland/conf/local.conf under CONF_VERSION = "1". That clearly had an effect:
It seemed to go over almost every other package, taking about 20 mins:

//~/Yocto/imx-yocto-bsp/build-wayland$ time bitbake oca  
//Parsing recipes: 100% |############################################################################################| Time: 0:01:04  
//Parsing of 3212 .bb files complete (0 cached, 3212 parsed). 4627 targets, 468 skipped, 1 masked, 0 errors.  
//NOTE: Resolving any missing task queue dependencies  

//Build Configuration:  
//(snip)  
//Initialising tasks: 100% |#########################################################################################| Time: 0:00:00  
//Sstate summary: Wanted 80 Found 0 Missed 80 Current 0 (0% match, 0% complete)  
//NOTE: Executing Tasks  
//NOTE: Setscene tasks completed  
//[Following text is all in red]  
//ERROR: oca-1.2.7-r0 do_package: QA Issue: oca: Files/directories were installed but not shipped in any package:  
  // /usr  
  // /usr/lib  
  // /usr/lib/OcaProtoController.so  
//Please set FILES such that these items are packaged. Alternatively if they are unneeded, avoid installing them or delete them within do_install.  
//oca: 3 installed and not shipped files. [installed-vs-shipped]  
//ERROR: oca-1.2.7-r0 do_package: Fatal QA errors found, failing task.  
//ERROR: Logfile of failure stored in: ~/Yocto/imx-yocto-bsp/build-wayland/tmp/work/aarch64-poky-linux/oca/1.2.7-r0/temp/log.do_package.6146  
//ERROR: Task (~/Yocto/imx-yocto-bsp/build-wayland/meta-oca-so/recipes-example/oca/oca_1.2.7.bb:do_package) failed with exit code '1'  
//[Above text is all in red; back to white text following]  
//NOTE: Tasks Summary: Attempted 504 tasks of which 2 didn't need to be rerun and 1 failed.  

//Summary: 1 task failed:  
  //~/Yocto/imx-yocto-bsp/build-wayland/meta-oca-so/recipes-example/oca/oca_1.2.7.bb:do_package  
//Summary: There were 2 ERROR messages shown, returning a non-zero exit code.  

//real    19m43.796s  
//user    0m1.270s  
//sys     0m0.164s  

It seems that not packaging the build result is not the answer.

Edit: An apparent can of worms has opened, necessitating a new question; please see How do I get a complex non-Yocto makefile-based project to cross-compile in a Yocto layer?

microajim
  • 17
  • 9
  • 1
    using plain make within do_compile tasks seems wrong. would you mind to try to use oe_runmake ? – Florian Berndl Mar 16 '21 at 16:32
  • @Florian Berndl: Thanks for that input. I'll try it right away. The next error I'm getting is: "cc1plus: error: bad value ('armv8-a') for '-march=' switch" which got me to find out that I can't use the host machine's installed gcc for cross-compiling and I am trying to figure out how to set up the cross-compilation that is happening in my other added layers. Would changing to oe_runmake do it or are there additional changes necessary? – microajim Mar 17 '21 at 17:27
  • Changing the make in the do_compile to oe_runmake didn't make any apparent difference in doing "bitbake oca"; I'm still getting "cc1plus: error: bad value ('armv8-a') for '-march=' switch" I always delete the tmp folder and do "bitbake -c cleansstate oca" first. – microajim Mar 17 '21 at 18:29
  • An apparent can of worms has opened, necessitating a new question; please see https://stackoverflow.com/questions/66680355/how-do-i-get-a-complex-non-yocto-makefile-based-project-to-cross-compile-in-a-yo – microajim Mar 17 '21 at 20:04

1 Answers1

1

The last error of you question tells you that the do_install tasks installs files but they are not assigned to any package. Add following lines to your recipe

FILES_${PN} += "${libdir}/OcaProtoController.so"
Florian Berndl
  • 1,136
  • 8
  • 27
  • Thanks; that helps. It's going on to other errors now. I was kind of hoping for an answer that would obviate the horrible hack; see edited addition in my post that I'll add soon. I upvoted your answer. – microajim Mar 16 '21 at 14:23