#include <linux/i2c-dev-user.h> error

Hi,
When i try to build and install my app i get the following error. How can i fix this?

[1/7] Compiling C source
FAILED: /home/lukas/Documents/MangOH/_build_batteryReading/wp77xx/component/6c4c10c88513c020b93e46a985f26858/obj/b127d244a5f06e5187fa9d5b1155ceec.o
/home/lukas/Documents/MangOH/leaf-data/MangOHYellow/wp77-toolchain/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi/arm-poky-linux-gnueabi-gcc --sysroot=/home/lukas/Documents/MangOH/leaf-data/MangOHYellow/wp77-toolchain/sysroots/armv7a-neon-poky-linux-gnueabi -MMD -MF /home/lukas/Documents/MangOH/_build_batteryReading/wp77xx/component/6c4c10c88513c020b93e46a985f26858/obj/b127d244a5f06e5187fa9d5b1155ceec.o.d -Wall -Werror -fvisibility=hidden -c /home/lukas/Documents/MangOH/BatteryChargerReading/batteryReadingComponent/batteryReading.c -o /home/lukas/Documents/MangOH/_build_batteryReading/wp77xx/component/6c4c10c88513c020b93e46a985f26858/obj/b127d244a5f06e5187fa9d5b1155ceec.o -DLE_FILENAME=basename /home/lukas/Documents/MangOH/BatteryChargerReading/batteryReadingComponent/batteryReading.c -DMK_TOOLS_BUILD -DLEGATO_EMBEDDED -fPIC -I /home/lukas/Documents/MangOH/_build_batteryReading/wp77xx -I/home/lukas/Documents/MangOH/leaf-data/MangOHYellow/wp77-legato/interfaces -I/home/lukas/Documents/MangOH/leaf-data/MangOHYellow/wp77-legato/framework/include -I/home/lukas/Documents/MangOH/leaf-data/MangOHYellow/wp77-legato/build/wp77xx/framework/include -I/home/lukas/Documents/MangOH/BatteryChargerReading -I/home/lukas/Documents/MangOH/_build_batteryReading/wp77xx/component/6c4c10c88513c020b93e46a985f26858/src -DLE_COMPONENT_NAME=batteryReadingComponent -DLE_LOG_SESSION=batteryReadingComponent_LogSession -DLE_LOG_LEVEL_FILTER_PTR=batteryReadingComponent_LogLevelFilterPtr
/home/lukas/Documents/MangOH/BatteryChargerReading/batteryReadingComponent/batteryReading.c:14:10: fatal error: linux/i2c-dev-user.h: No such file or directory
#include <linux/i2c-dev-user.h>
^~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
ninja: build stopped: subcommand failed.
The terminal process “bash ‘-c’, ‘mkapp ${LEGATO_DEF_FILE} -s components -t ${LEGATO_TARGET} -w ${LEGATO_OBJECT_DIR} -o ${LEGATO_OUTPUT_DIR} && update ${LEGATO_UPDATE_FILE}’” failed to launch (exit code: 1).
Terminal will be reused by tasks, press any key to close it.

You can see here

I already tried it but doesn’t work

You mean you cannot find i2c-dev.h in the toolchain?

Yes, thats what i mean

I have installed the SDK swi-wp77_4.0.0 , and I can find the i2c-dev.h in the toolchain:


owner@owner-ThinkPad-X220:~/LEAF/wp77/leaf-data/wp77/wp77-toolchain$ find ./ -name "i2c-dev.h"
./sysroots/armv7a-neon-poky-linux-gnueabi/usr/src/kernel/usr/include/uapi/linux/i2c-dev.h
./sysroots/armv7a-neon-poky-linux-gnueabi/usr/src/kernel/usr/include/linux/i2c-dev.h
./sysroots/armv7a-neon-poky-linux-gnueabi/usr/src/kernel/include/uapi/linux/i2c-dev.h
./sysroots/armv7a-neon-poky-linux-gnueabi/usr/src/kernel/include/linux/i2c-dev.h
./sysroots/armv7a-neon-poky-linux-gnueabi/usr/include/linux/i2c-dev.h

Now it works for me too. But when I now try to install my app i get this error:

[1/7] Compiling C source
FAILED: /home/lukas/Documents/MangOH/_build_batteryReading/wp77xx/component/6c4c10c88513c020b93e46a985f26858/obj/b127d244a5f06e5187fa9d5b1155ceec.o 
/home/lukas/Documents/MangOH/leaf-data/MangOHYellow/wp77-toolchain/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi/arm-poky-linux-gnueabi-gcc --sysroot=/home/lukas/Documents/MangOH/leaf-data/MangOHYellow/wp77-toolchain/sysroots/armv7a-neon-poky-linux-gnueabi -MMD -MF /home/lukas/Documents/MangOH/_build_batteryReading/wp77xx/component/6c4c10c88513c020b93e46a985f26858/obj/b127d244a5f06e5187fa9d5b1155ceec.o.d -Wall -Werror -fvisibility=hidden  -c /home/lukas/Documents/MangOH/BatteryChargerReading/batteryReadingComponent/batteryReading.c -o /home/lukas/Documents/MangOH/_build_batteryReading/wp77xx/component/6c4c10c88513c020b93e46a985f26858/obj/b127d244a5f06e5187fa9d5b1155ceec.o  -DLE_FILENAME=`basename /home/lukas/Documents/MangOH/BatteryChargerReading/batteryReadingComponent/batteryReading.c` -DMK_TOOLS_BUILD  -DLEGATO_EMBEDDED -fPIC -I /home/lukas/Documents/MangOH/_build_batteryReading/wp77xx -I/home/lukas/Documents/MangOH/leaf-data/MangOHYellow/wp77-legato/interfaces -I/home/lukas/Documents/MangOH/leaf-data/MangOHYellow/wp77-legato/framework/include -I/home/lukas/Documents/MangOH/leaf-data/MangOHYellow/wp77-legato/build/wp77xx/framework/include -I/home/lukas/Documents/MangOH/BatteryChargerReading -I/home/lukas/Documents/MangOH/_build_batteryReading/wp77xx/component/6c4c10c88513c020b93e46a985f26858/src -DLE_COMPONENT_NAME=batteryReadingComponent -DLE_LOG_SESSION=batteryReadingComponent_LogSession  -DLE_LOG_LEVEL_FILTER_PTR=batteryReadingComponent_LogLevelFilterPtr 
/home/lukas/Documents/MangOH/BatteryChargerReading/batteryReadingComponent/batteryReading.c: In function ‘SmbusReadReg’:
/home/lukas/Documents/MangOH/BatteryChargerReading/batteryReadingComponent/batteryReading.c:103:28: error: implicit declaration of function ‘i2c_smbus_read_byte_data’ [-Werror=implicit-function-declaration]
     const int readResult = i2c_smbus_read_byte_data(i2cFd, reg);
                            ^~~~~~~~~~~~~~~~~~~~~~~~
/home/lukas/Documents/MangOH/BatteryChargerReading/batteryReadingComponent/batteryReading.c: In function ‘SmbusWriteReg’:
/home/lukas/Documents/MangOH/BatteryChargerReading/batteryReadingComponent/batteryReading.c:149:29: error: implicit declaration of function ‘i2c_smbus_write_byte_data’ [-Werror=implicit-function-declaration]
     const int writeResult = i2c_smbus_write_byte_data(i2cFd, reg, data);
                             ^~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /home/lukas/Documents/MangOH/leaf-data/MangOHYellow/wp77-legato/framework/include/legato.h:188:0,
                 from /home/lukas/Documents/MangOH/BatteryChargerReading/batteryReadingComponent/batteryReading.c:12:
/home/lukas/Documents/MangOH/BatteryChargerReading/batteryReadingComponent/batteryReading.c: In function ‘EnableI2cBus’:
/home/lukas/Documents/MangOH/BatteryChargerReading/batteryReadingComponent/batteryReading.c:184:17: error: implicit declaration of function ‘i2c_smbus_write_byte’ [-Werror=implicit-function-declaration]
     LE_FATAL_IF(i2c_smbus_write_byte(i2cdev_fd, enableAllPorts) == -1, "failed to write i2c data");
                 ^
/home/lukas/Documents/MangOH/leaf-data/MangOHYellow/wp77-legato/framework/include/le_log.h:915:13: note: in definition of macro ‘LE_FATAL_IF’
         if (condition) { LE_FATAL(formatString, ##__VA_ARGS__) }
             ^~~~~~~~~
cc1: all warnings being treated as errors
ninja: build stopped: subcommand failed.
The terminal process "bash '-c', 'mkapp ${LEGATO_DEF_FILE} -s components -t ${LEGATO_TARGET} -w ${LEGATO_OBJECT_DIR} -o ${LEGATO_OUTPUT_DIR} && update ${LEGATO_UPDATE_FILE}'" terminated with exit code: 1.

Terminal will be reused by tasks, press any key to close it.

you can see here:

I found the file on my host but won’t work.

you can delete line 14

YESS! It’s working!
Thanks a lot