error: ‘I2C_SMBUS_BLOCK_MAX’ undeclared

Home Forums Forums Technical Support for BerryGPS and BerryGPS-IMU error: ‘I2C_SMBUS_BLOCK_MAX’ undeclared


Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
  • #9115


    I have a BerryGPS-IMUv3, Raspberry Pi 3B+, running Raspbian Buster full (2019-07-10).

    GPS module works fine.
    sudo i2cdetect -y 1 – shows 1C, 6A and 77.

    I have followed the guides including this . However, when compiling gyro_accelerometer_tutorial02.c I get the following error : IMU.c:143:14: error: ‘I2C_SMBUS_BLOCK_MAX’ undeclared (first use in this function)
    __u16 block[I2C_SMBUS_BLOCK_MAX];

    N.B. The readme says that v1 and v2 are supported, implication that v3 is NOT supported, is this correct?

    Any guidance greatly appreciated.

    Mark Williams

    it looks like you are missing some libraries

    try installing these

    sudo apt-get install i2c-tools libi2c-dev python-smbus

    Mark --


    Hi Mark,

    Firstly, many thanks for your speedy response and support.

    I ran the command / installed the packages you specified, however, it did not resolve the error!

    Here is the output, also I have attached a screenshot of the shell. Any further ideas please?

    $ sudo apt-get install i2c-tools libi2c-dev python-smbus
    Reading package lists… Done
    Building dependency tree
    Reading state information… Done
    i2c-tools is already the newest version (4.1-1).
    libi2c-dev is already the newest version (4.1-1).
    python-smbus is already the newest version (4.1-1).
    The following package was automatically installed and is no longer required:
    Use ‘sudo apt autoremove’ to remove it.
    0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.


    Mark Williams

    Mmmm… strange.
    do you have this file?

    can you show me the output of this command
    dpkg -l libi2c-dev

    Also try this header file..
    1. go into the directory where the code is
    2. download this older header file
    3. open IMU.c and change this line;
    #include "linux/i2c-dev.h"
    to this
    #include "i2c-dev.h"
    4. try to compile again

    Mark --

    Mark Williams

    i forgot to add.. ill need to check to see if something has changed with Raspbian Buster

    Mark --


    Hi Mark,

    Again, many thanks for your speedy response and support, it’s very much appreciated!

    To answer your questions;

    I do have just 1 i2c-dev.h (I did use “find” to search the entire file-system), ls -l

    -rw-r–r– 1 root root 2612 Dec 3 2018 /usr/include/linux/i2c-dev.h

    Interestingly, and I think related, is this post,, As can be seen from the “ls -l”, i2c-dev.h with “Raspbian Buster” is 2612 in size, the download you suggest is 11507!

    -rw-r–r– 1 pi pi 11507 Aug 6 03:49 i2c-dev.h

    $ dpkg -l libi2c-dev
    | Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
    |/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
    ||/ Name Version Architecture Description
    ii libi2c-dev 4.1-1 armhf userspace I2C programming library development files

    I followed your re-compile instructions, and THAT WORKED! many thanks.

    I have a suspicion / intuition, that this issue is related to the “Rasbian Buster” build / install, PLEASE let us know what you find?

    Again, many thanks!

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.

Blip, blop, bloop…