Hi all. Trying to compile mlx90640-library on the latest raspbian I get the following:
sudo apt-get install libi2c-dev
Paketlisten werden gelesen… Fertig
Abhängigkeitsbaum wird aufgebaut.
Statusinformationen werden eingelesen… Fertig
libi2c-dev ist schon die neueste Version (3.1.2-3).
0 aktualisiert, 0 neu installiert, 0 zu entfernen und 0 nicht aktualisiert.
===> is already newest version // I2C is enabled …
pi@rpi-touch-1:~/mlx90640-library $ make clean
rm -f test step fbuf interp video
rm -f examples/.o
rm -f examples/lib/.o
rm -f functions/*.o
rm -f *.o
rm -f *.so
rm -f test
rm -f *.a
pi@rpi-touch-1:~/mlx90640-library $ make I2C_MODE=LINUX
g++ -I. -std=c++11 -std=c++11 -c -o examples/test.o examples/test.cpp
g++ -I. -std=c++11 -fPIC -I headers -shared -c -o functions/MLX90640_API.o functions/MLX90640_API.cpp
g++ -I. -std=c++11 -fPIC -I headers -shared -c -o functions/MLX90640_LINUX_I2C_Driver.o functions/MLX90640_LINUX_I2C_Driver.cpp
In file included from functions/MLX90640_LINUX_I2C_Driver.cpp:24:0:
/usr/include/linux/i2c.h:68:8: error: redefinition of ‘struct i2c_msg’
struct i2c_msg {
^~~~~~~
In file included from functions/MLX90640_LINUX_I2C_Driver.cpp:23:0:
/usr/include/linux/i2c-dev.h:37:8: error: previous definition of ‘struct i2c_msg’
struct i2c_msg {
^~~~~~~
In file included from functions/MLX90640_LINUX_I2C_Driver.cpp:24:0:
/usr/include/linux/i2c.h:131:7: error: redefinition of ‘union i2c_smbus_data’
union i2c_smbus_data {
^~~~~~~~~~~~~~
In file included from functions/MLX90640_LINUX_I2C_Driver.cpp:23:0:
/usr/include/linux/i2c-dev.h:89:7: error: previous definition of ‘union i2c_smbus_data’
union i2c_smbus_data {
^~~~~~~~~~~~~~
functions/MLX90640_LINUX_I2C_Driver.cpp: In function ‘int MLX90640_I2CRead(uint8_t, uint16_t, uint16_t, uint16_t*)’:
functions/MLX90640_LINUX_I2C_Driver.cpp:51:27: error: invalid conversion from ‘__u8* {aka unsigned char*}’ to ‘char*’ [-fpermissive]
i2c_messages[0].buf = (__u8*)cmd;
^~~~~~~~~~
functions/MLX90640_LINUX_I2C_Driver.cpp:56:27: error: invalid conversion from ‘__u8* {aka unsigned char*}’ to ‘char*’ [-fpermissive]
i2c_messages[1].buf = (__u8*)buf;
^~~~~~~~~~
functions/MLX90640_LINUX_I2C_Driver.cpp: In function ‘int MLX90640_I2CWrite(uint8_t, uint16_t, uint16_t)’:
functions/MLX90640_LINUX_I2C_Driver.cpp:93:27: error: invalid conversion from ‘__u8* {aka unsigned char*}’ to ‘char*’ [-fpermissive]
i2c_messages[0].buf = (__u8*)cmd;
^~~~~~~~~~
: die Regel für Ziel „functions/MLX90640_LINUX_I2C_Driver.o“ scheiterte
make: *** [functions/MLX90640_LINUX_I2C_Driver.o] Fehler 1
The issue is that it’s assuming the bcm2835 library is used only for the non-generic I2C_MODE and isn’t linking against it when you specify I2C_MODE=LINUX. For the video example this isn’t the case, since it uses bcm2835 functions to pulse a GPIO pin as an oscilloscope trigger- redundant code I need to remove.
Thanks,much appreciate your work and help. I’m trying to visualize it in nodered. Have you done anything similar or can you give me some hints? Cheers, Jan
Hi! I ran into the exact same problem as GobLin77. I tried the solution you offered and some of the errors went away. Yet, 3 of them still prevent me from compiling:
functions/MLX90640_LINUX_I2C_Driver.cpp: In function ‘int MLX90640_I2CRead(uint8_t, uint16_t, uint16_t, uint16_t*)’:
functions/MLX90640_LINUX_I2C_Driver.cpp:51:27: error: invalid conversion from ‘__u8* {aka unsigned char*}’ to ‘char*’ [-fpermissive]
i2c_messages[0].buf = (__u8*)cmd;
^~~~~~~~~~
functions/MLX90640_LINUX_I2C_Driver.cpp:56:27: error: invalid conversion from ‘__u8* {aka unsigned char*}’ to ‘char*’ [-fpermissive]
i2c_messages[1].buf = (__u8*)buf;
^~~~~~~~~~
functions/MLX90640_LINUX_I2C_Driver.cpp: In function ‘int MLX90640_I2CWrite(uint8_t, uint16_t, uint16_t)’:
functions/MLX90640_LINUX_I2C_Driver.cpp:93:27: error: invalid conversion from ‘__u8* {aka unsigned char*}’ to ‘char*’ [-fpermissive]
i2c_messages[0].buf = (__u8*)cmd;
Any suggestions on how to proceed? Thanks in advance.