Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compile error #19

Open
girst opened this issue Jan 25, 2017 · 3 comments
Open

Compile error #19

girst opened this issue Jan 25, 2017 · 3 comments

Comments

@girst
Copy link

girst commented Jan 25, 2017

I tried to build the library with

cmake . -DCMAKE_INSTALL_PREFIX=/usr  -DUSE_FREETYPE=OFF -DUSE_MAGICK=OFF
make

but it won't compile.

Scanning dependencies of target rpihw
[  3%] Building CXX object CMakeFiles/rpihw.dir/src/utils.cpp.o
[  6%] Building CXX object CMakeFiles/rpihw.dir/src/time.cpp.o
[  9%] Building CXX object CMakeFiles/rpihw.dir/src/gpio.cpp.o
[ 12%] Building CXX object CMakeFiles/rpihw.dir/src/driver/bcm2835.cpp.o
[ 15%] Building CXX object CMakeFiles/rpihw.dir/src/driver/spi.cpp.o
[ 18%] Building CXX object CMakeFiles/rpihw.dir/src/driver/i2c.cpp.o
In file included from /home/pi/libs/Rpi-hw/include/rpi-hw/driver/i2c.hpp:29:0,
                 from /home/pi/libs/Rpi-hw/src/driver/i2c.cpp:25:
/usr/include/linux/i2c-dev.h:37:8: error: redefinition of ‘struct i2c_msg’
 struct i2c_msg {
        ^
In file included from /home/pi/libs/Rpi-hw/include/rpi-hw/driver/i2c.hpp:28:0,
                 from /home/pi/libs/Rpi-hw/src/driver/i2c.cpp:25:
/usr/include/linux/i2c.h:68:8: error: previous definition of ‘struct i2c_msg’
 struct i2c_msg {
        ^
In file included from /home/pi/libs/Rpi-hw/include/rpi-hw/driver/i2c.hpp:29:0,
                 from /home/pi/libs/Rpi-hw/src/driver/i2c.cpp:25:
/usr/include/linux/i2c-dev.h:89:7: error: redefinition of ‘union i2c_smbus_data’
 union i2c_smbus_data {
       ^
In file included from /home/pi/libs/Rpi-hw/include/rpi-hw/driver/i2c.hpp:28:0,
                 from /home/pi/libs/Rpi-hw/src/driver/i2c.cpp:25:
/usr/include/linux/i2c.h:128:7: error: previous definition of ‘union i2c_smbus_data’
 union i2c_smbus_data {
       ^
CMakeFiles/rpihw.dir/build.make:182: recipe for target 'CMakeFiles/rpihw.dir/src/driver/i2c.cpp.o' failed
make[2]: *** [CMakeFiles/rpihw.dir/src/driver/i2c.cpp.o] Error 1
CMakeFiles/Makefile2:99: recipe for target 'CMakeFiles/rpihw.dir/all' failed
make[1]: *** [CMakeFiles/rpihw.dir/all] Error 2
Makefile:127: recipe for target 'all' failed
make: *** [all] Error 2

Raspberry Pi image from 2017-01-11, using g++4.7, last commit db4d9c0

@girst
Copy link
Author

girst commented Jan 25, 2017

removing line 28 in include/rpi-hw/driver/i2c.hpp fixes the compile error.

i have not checked if it breaks something else though.

@girst
Copy link
Author

girst commented Jan 27, 2017

I found an explaination and proper fix here.

in short: when the package i2c-tools is installed, i2c-dev.h completely replaces i2c.h

@Wicker25
Copy link
Owner

Hi @girst , thank you very much! Unfortunately my library has not been very successful, so I'm not dedicating much time to this project. Anyway I will merge your PR as soon as possible!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants