1
votes

I am having an issue building a recipe using bitbake which depends on i2c-tools. It appears to be due to missing files in my recipe's sysroot. In one of my .cpp files, I have

extern "C" {
    #include <sys/ioctl.h>
    #include <linux/i2c-dev.h>
    #include <i2c/smbus.h>
    #include <unistd.h>
    #include <fcntl.h>
    #include <string.h>
}

I've built and installed the Yocto image SDK at /opt/fslc-x11/2.6.2. I can successfully cross-compile my CMake app using the following commands:

mkdir build && cd build
source /opt/fslc-x11/2.6.2/environment-setup-armv7at2hf-neon-fslc-linux-gnueabi
export QT_SELECT=qt5.11.3
cmake .. -DCMAKE_TOOLCHAIN_FILE=/opt/fslc-x11/2.6.2/sysroots/x86_64-fslcsdk-linux/usr/share/cmake/OEToolchainConfig.cmake -DOE_QMAKE_PATH_EXTERNAL_HOST_BINS=${QT_BIN_PATH}
make -j4

However, when trying to build the same code in my bitbake recipe, the build fails, stating

fatal error: i2c/smbus.h: No such file or directory

I've been developing this software for quite a while, and the bitbake recipe worked fine until I added the i2c stuff.

In the SDK directory, the header and libi2c exist as determined with the following find commands:

/opt/fslc-x11/2.6.2$ sudo find . -name smbus.h
./sysroots/armv7at2hf-neon-fslc-linux-gnueabi/usr/src/debug/i2c-tools/4.1-r0/i2c-tools-4.1/include/i2c/smbus.h
./sysroots/armv7at2hf-neon-fslc-linux-gnueabi/usr/include/i2c/smbus.h

and

/opt/fslc-x11/2.6.2$ sudo find . -name libi2c*
./sysroots/armv7at2hf-neon-fslc-linux-gnueabi/usr/lib/.debug/libi2c.so.0.1.1
./sysroots/armv7at2hf-neon-fslc-linux-gnueabi/usr/lib/libi2c.so.0
./sysroots/armv7at2hf-neon-fslc-linux-gnueabi/usr/lib/libi2c.so.0.1.1
./sysroots/armv7at2hf-neon-fslc-linux-gnueabi/usr/lib/libi2c.so

However, in the recipe sysroot, these files are missing:

~/var-fslc-yocto/build_x11/tmp/work/armv7at2hf-neon-fslc-linux-gnueabi/magi/1.0-r0$ sudo find . -name libi2c*
~/var-fslc-yocto/build_x11/tmp/work/armv7at2hf-neon-fslc-linux-gnueabi/magi/1.0-r0$ sudo find . -name smbus.h

Do I need to add something to my recipe's .conf or .bb file to have those files in my recipe's sysroot? I'm new to Yocto/OE, so please go easy on me.

1
Please include the recipe contents in your questionJussi Kukkonen
I believe I've answered my own question. Posting an answer below...mattmunee

1 Answers

0
votes

I believe I've fixed the issue. I created a minimal .cpp file implementing the code found at www.kernel.org. Afterwards, adding DEPENDS = "i2c-tools" to my recipe's .bb file seems to have added all of the required dependencies to the recipe's sysroot.