Re: yocto compile simple c++

Quentin Schulz

Hi Sergey,

On Sat, Aug 08, 2020 at 12:12:40PM +0300, Sergey Ivanov wrote:
Hi there.
I'm newbie ib yocto and (of course) nothing works for me from scratch.
For testing purposes, i work with yocto 3.1 based on
5d47cdf448b6cff5bb7cc5b0ba0426b8235ec478 rev aka dunfell-23.0.0
MACHINE ?= "qemuarm" and DISTRO ?= "poky" (btw i tried poky-tony as well
but machine didn't start properly under qemu)

I created my new layer with next structure:
├── conf
│ └── layer.conf
└── recipes-ice
No need.

└── ice_helloworld
No need.

├── files
│ └── ice_helloworld.cpp

(i copied COPYING.MIT to )every single place because of error below) and i

NOTE: Executing Tasks
WARNING: ice_helloworld-helloworld-0.1 do_populate_lic: Could not copy
license file
[Errno 2] No such file or directory:
ERROR: ice_helloworld-helloworld-0.1 do_populate_lic: QA Issue:
ice_helloworld: LIC_FILES_CHKSUM points to an invalid file:
ERROR: ice_helloworld-helloworld-0.1 do_populate_lic: Fatal QA errors
found, failing task.
ERROR: Logfile of failure stored in:
failed with exit code '1'
NOTE: Tasks Summary: Attempted 216 tasks of which 214 didn't need to be
rerun and 1 failed.

my bb file is:

SUMMARY = "Recipe to build the 'helloworld' in cpp"
SECTION = "ice"

PN = "ice_helloworld"
No need, default is the name of the recipe file.

PV = "0.1"
No need, default is the version in the recipe file (if there's one).

meta-ice_layer/recipes-ice/ice_helloworld/ will
PN = "ice_helloworld"
PV = "0.1"

SITE = "file://"
PACKAGE_VERSION_MAJOR = "${'PV',d,1).split('.')[0]}"
PACKAGE_VERSION_MINOR = "${'PV',d,1).split('.')[1]}"

SRC_URI = "${SITE}${PN}.cpp"
SRC_URI = "${SITE}/${PN}.cpp"

SRC_URI[md5sum] = "bc9dc64a44f9685d0310b94400a4631c"
SRC_URI[sha256sum] =
LIC_FILES_CHKSUM = "${SITE}COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420"
LIC_FILES_CHKSUM = "${SITE}/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420"

do_compile() {
${CXX} ${PN}.cpp -o ${PN}
Create a makefile/cmake instead, the logic of compiling your SW shouldn't be
in a build system.

do_install() {
install -d ${D}${bindir}
install -m 0755 ${PN} ${D}${bindir}
Same, create an install target in your makefile. If you do this well,
you don't even need your do_compile and do_install, it'll be

what could be wrong here?
1. Missing / in your paths.

2. Also, **never** put uppercase letter or underscores in the name of
a recipe. So your recipe should be:

The underscore is used in multiple places internally to separate
things so using an underscore is breaking some things in weird ways.

Fix 1 and 2 at least, create a makefile for added best practices.

Kind regards,

Join to automatically receive all group messages.