frasersdev / librpip

A Library for using Raspberry Pi Peripherals in user space.
http://librpip.frasersdev.net/
GNU General Public License v2.0
3 stars 3 forks source link

Fails on make ( Raspberry Pi B+ jesse) #10

Closed Q-point closed 7 years ago

Q-point commented 8 years ago

I am getting the following error when I try to install the library.

`gcc -fpic -g -Wall -O3 -c -o rpi.o rpi.c In file included from transact.c:28:0: /usr/include/linux/i2c-dev.h:37:8: error: redefinition of ‘struct i2c_msg’ struct i2c_msg { ^ In file included from transact.c:27:0: /usr/include/linux/i2c.h:68:8: note: originally defined here struct i2c_msg { ^ In file included from transact.c:28:0: /usr/include/linux/i2c-dev.h:89:7: error: redefinition of ‘union i2c_smbus_data’ union i2c_smbus_data { ^ In file included from transact.c:27:0: /usr/include/linux/i2c.h:128:7: note: originally defined here union i2c_smbus_data { ^ In file included from i2c.c:29:0: /usr/include/linux/i2c-dev.h:37:8: error: redefinition of ‘struct i2c_msg’ struct i2c_msg { ^ In file included from i2c.c:28:0: /usr/include/linux/i2c.h:68:8: note: originally defined here struct i2c_msg { ^ In file included from i2c.c:29:0: /usr/include/linux/i2c-dev.h:89:7: error: redefinition of ‘union i2c_smbus_data’ union i2c_smbus_data { ^ In file included from i2c.c:28:0: /usr/include/linux/i2c.h:128:7: note: originally defined here union i2c_smbus_data { ^ transact.c: In function ‘librpip_transaction_i2c_create’: transact.c:451:11: warning: pointer targets in assignment differ in signedness [-Wpointer-sign] p->buf = m->tx->buf; ^ transact.c:455:11: warning: pointer targets in assignment differ in signedness [-Wpointer-sign] p->buf = m->rx->buf; ^

: recipe for target 'i2c.o' failed make[2]: *** [i2c.o] Error 1 make[2]: *** Waiting for unfinished jobs.... : recipe for target 'transact.o' failed make[2]: *** [transact.o] Error 1 make[2]: Leaving directory '/home/pi/Documents/librpip-0.3.2/src/librpip' Makefile:15: recipe for target 'all' failed make[1]: *** [all] Error 2 make[1]: Leaving directory '/home/pi/Documents/librpip-0.3.2/src/librpip' Makefile:10: recipe for target 'all' failed make: *** [all] Error 2 cp include/librpip.h /usr/local/include cp lib/librpip.a /usr/local/lib cp: cannot stat ‘lib/librpip.a’: No such file or directory`
frasersdev commented 8 years ago

Hi,

your /usr/include/linux/i2c-dev.h file seems to be redefining everything that is in /usr/include/linux/i2c.h? This is considerably different to what I have on my system. Could you post these two files here?

Also which version of jessie are you using?

Q-point commented 8 years ago

Hi,

I am using the latest version on Rasbian. Kernel 4.4. The issue was due to the libi2c-dev.

Everything works fine after issuing : sudo apt-get remove libi2c-dev

frasersdev commented 8 years ago

ahh confirmed at my end too. After installing libi2c-dev I have this in /usr/include/linux:

$ ls -l i2c*
-rw-r--r-- 1 root root 10414 Oct  3  2015 i2c-dev.h
-rw-r--r-- 1 root root  2427 Sep 23  2015 i2c-dev.h.kernel
-rw-r--r-- 1 root root  6772 Sep 23  2015 i2c.h

I should be able to work this into the config somehow

thanks, F.

frasersdev commented 8 years ago

I've patched with a test for the alternate header file now. If you have the chance could you test the patch on your system?

git clone -b 0.4.1-i2c-header-conflict https://github.com/frasersdev/librpip

Q-point commented 8 years ago

I'll give it a try and let you know. Thanks.

frasersdev commented 7 years ago

fixed in 0.4.1