1

I am trying to build DirectFB2 for my yocto image to be deployed on a Raspberry Pi 0 W. In order to do so, I requre Fluxcomp. From the github page for fluxcomp: "flux is an interface description language used by DirectFB". This is a tool used when building DirectFB2, however it is not required within the image which I am building for deployment (building for native not nativesdk). This is an issue I have been trying to work my way through for a few weeks now and suspect that it's more or less due to my inexperience with yocto.

At this stage, it appears that I am actually able to include the fluxcomp binary in /usr/bin/ however, it is named fluxcomp-native rather than fluxcomp. I can find nowhere that it is being named this during the build process.

Take note that before building a recipe, I perform a cleanall on it (so before building fluxcomp, I run bitbake -c cleanall fluxcomp, etc.

When I build fluxcomp with the command bitbake fluxcomp, I find the binary I would expect at build/tmp/work/arm1176jzfshf-vfp-poky-linux-gnueabi/fluxcomp/1.0+gitAUTOINC+10ad2ebc78-r0/image/usr/bin/, with only the fluxcomp binary in that directory. However, when I try to build fluxcomp-native like so; bitbake fluxcomp-native, I receive the following error;

| install: cannot stat 'build/tmp/work/x86_64-linux/fluxcomp-native/1.0+gitAUTOINC+10ad2ebc78-r0/build/fluxcomp-native': No such file or directory

When inspecting further into this directory, I find that it contains the binary named fluxcomp but not fluxcomp-native. I don't know how to tell bitbake that I want it to check for the binary at the name fluxcomp as that is the desired name for this binary.

If I move forward anyway and run bitbake build-sysroots, then under build/tmp/sysroots/x86_64/usr/bin, it is currently not placing fluxcomp-native. Previously it was, I don't know what I have done to stop this which seems like a step backwards for me. However ideally, I want it to be named fluxcomp.

Moving forward, I need to be able to run bitbake directfb2 and for it to build - currently, it is giving the same error as when I run bitbake fluxcomp-native.

Here is my fluxcomp.bb recipe;

LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://src/fluxcomp.cpp;md5=8f16923235d8fa62a6a19529614bf387"

BBCLASSEXTEND = "native"

SRC_URI = "git://github.com/deniskropp/flux.git;protocol=https;branch=master"
PV = "1.0+git${SRCPV}"
SRCREV = "10ad2ebc78b396032714b839f200848ea0dd9503"

S = "${WORKDIR}/git"
B = "${S}/src/build"

inherit autotools pkgconfig

do_configure() {
    # Generate the configure script using autotools
    if [ -f ${S}/configure.in ]; then
        mv ${S}/configure.in ${S}/configure.ac
    fi

    MYBUIDDIR=$(pwd)
    cd ${S}

    autoreconf -i -f -I ${S}/configure.ac
    # Run configure with the necessary options
    ${S}/configure --host=${TARGET_SYS} --prefix=${S} --exec-prefix=${exec_prefix} --bindir=${STAGING_BINDIR_NATIVE} --libdir=${libdir}
    cd ${MYBUILDDIR}
}

do_compile() {
    MYBUIDDIR=$(pwd)
    cd ${S}
    make -j 4 
    mkdir -p ${B}

    cp ${S}/src/fluxcomp ${B}/fluxcomp
    cp ${S}/src/fluxcomp.o ${B}/fluxcomp.o
    cp -R ${S}/src/.libs ${B}/.libs

    cd ${MYBUILDDIR}
}

do_install() {
    echo "DO_INSTALL FLUXCOMP TO ${D}${bindir}"
    install -d ${D}${bindir}
    install -m 0755 ${B}/${PN} ${D}${bindir}/
}

# Specify where the files will be installed
FILES_${PN} += "${bindir}/fluxcomp"

And my directfb2.bb recipe:

HOMEPAGE = "https://github.com/directfb2/DirectFB2"
LICENSE = "LGPLv2.1"
LIC_FILES_CHKSUM = "file://COPYING;md5=4fbd65380cdd255951079008b364516c"
PROVIDES += "directfb2"

DEPENDS += "meson ninja fluxcomp-native"

SRC_URI = "git://github.com/directfb2/DirectFB2.git;protocol=https;branch=master"

SRCREV = "ac4f10ca5dcb9fb8c848fcde26a19d88cc8afd25"

FILES_${PN}-dev += "${includedir}/directfb"

S = "${WORKDIR}/git"

inherit meson pkgconfig

do_show_fluxcomp_path() {
    echo "Fluxcomp dir: ${STAGING_BINDIR_NATIVE}"
}
addtask show_fluxcomp_path before do_configure

# Configure options for meson
EXTRA_OEMESON = '\
 --cross-file=${WORKDIR}/my.meson.x86target.cross\
 -Ddebug-support=false\
 -Ddrmkms=false\
 -Dfbdev=true\
 -Dlinuxinput=true\
 -Dmemcpy-probing=false\
 -Dmulti=false\
 -Dmulti-kernel=false\
 -Dsentinels=false\
 -Dsmooth-scaling=false\
 -Dtext=false\
 -Dtrace=false'

do_configure() {
    meson env2mfile --cross -o ${WORKDIR}/my.meson.x86target.cross --cpu=x86_64 --cpu-family=x86 --system=linux
    meson ${EXTRA_OEMESON} ${S} ${B}
}

do_compile() {
    ninja -C ${B}
}

do_install() {
    ninja -C ${B} install
    rm -rf ${D}${libdir}/libdirectfb*
}

Any thoughts would be appreciated.

Michael Thompson
  • 541
  • 4
  • 21

1 Answers1

1

Ok, so I only had to make 2 changes to my fluxcomp recipe in order to get this building correctly. The changes I made related to the last couple of lines in the fluxcomp.bb file, by changing the second install line, removing ${PN} and replcing it with fluxcomp (I had already tried this but found some issue, I don't remember what it was) and also changing on the last line ${bindir} to `${STAGING_BINDIR_NATIVE}:

    echo "DO_INSTALL FLUXCOMP TO ${D}${bindir}"
    install -d ${D}${bindir}
    install -m 0755 ${B}/fluxcomp ${D}${bindir}/
}

FILES_${PN} += "${STAGING_BINDIR_NATIVE}/fluxcomp"

I am now able to build fluxcomp and configure directfb2 however having issues with cross compilation, but that's a separate issue.

Michael Thompson
  • 541
  • 4
  • 21
  • Hello, you shouldn't override the do_configure/compile/install functions at all in the directfb recipe. Yocto will setup cross-compilation automatically properly. Also, remove the "-cross-file=${WORKDIR}/my.meson.x86target.cross\" line from the EXTRA_OEMESON. If you remove that and the compile/configure/install tasks, it should build successfully. Note that you'll have to specify files to install with FILES_${PN} properly. – Bruno Morais Apr 12 '23 at 01:33
  • Hi Bruno, yes I had it like that, but it was failing - without explicitly specifying some paths, it would recreate the whole path to the workdir in the packate output rather than creating a sysroot (i.e. /shared/yocto/poky/build/tmp/work/arm1176jzfshf-vfp-poky-linux-gnueabi/directfb2/1.0-r0/image/shared/yocto/poky/build/tmp/work/arm1176jzfshf-vfp-poky-linux-gnueabi/directfb2/1.0-r0/image/usr/ would contain the /usr directory), or would be unable to find the meson sanity checker. Maybe down to my lack of experience with yocto but those functions got it working as I would expect it. – Michael Thompson Apr 18 '23 at 14:45