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

redefinition of i2c objects in linux. #221

Open
mwcarlis opened this issue Jun 5, 2020 · 1 comment
Open

redefinition of i2c objects in linux. #221

mwcarlis opened this issue Jun 5, 2020 · 1 comment

Comments

@mwcarlis
Copy link

mwcarlis commented Jun 5, 2020

We run into the following issue when trying to compile in linux.
One workaround is to remove libi2c-dev, but it seems the issue is the way it includes i2c-dev.h and i2c.h.

switchtec-user# make
  CC    lib/platform/linux-i2c.c
In file included from lib/platform/linux-i2c.c:46:0:
/usr/include/linux/i2c-dev.h:37:8: error: redefinition of 'struct i2c_msg'
 struct i2c_msg {
        ^
In file included from lib/platform/linux-i2c.c:45:0:
/usr/include/linux/i2c.h:68:8: note: originally defined here
 struct i2c_msg {
        ^
In file included from lib/platform/linux-i2c.c:46:0:
/usr/include/linux/i2c-dev.h:90:7: error: redefinition of 'union i2c_smbus_data'
 union i2c_smbus_data {
       ^
In file included from lib/platform/linux-i2c.c:45:0:
/usr/include/linux/i2c.h:129:7: note: originally defined here
 union i2c_smbus_data {
       ^
lib/platform/linux-i2c.c: In function 'i2c_msg_pec':
lib/platform/linux-i2c.c:87:14: warning: pointer targets in passing argument 1 of 'crc8' differ in signedness [-Wpointer-sign]
  return crc8(msg->buf, byte_count, pec, false);
              ^
In file included from lib/platform/linux-i2c.c:28:0:
lib/platform/../crc.h:34:9: note: expected 'uint8_t * {aka unsigned char *}' but argument is of type 'char *'
 uint8_t crc8(uint8_t *msg_ptr, uint32_t byte_cnt, uint32_t oldchksum,
         ^
lib/platform/linux-i2c.c: In function 'i2c_gas_cap_get':
lib/platform/linux-i2c.c:224:14: warning: pointer targets in assignment differ in signedness [-Wpointer-sign]
  msgs[0].buf = &command_code;
              ^
lib/platform/linux-i2c.c:228:14: warning: pointer targets in assignment differ in signedness [-Wpointer-sign]
  msgs[1].buf = rx_buf;
              ^
lib/platform/linux-i2c.c: In function 'i2c_gas_data_write':
lib/platform/linux-i2c.c:303:10: warning: pointer targets in assignment differ in signedness [-Wpointer-sign]
  msg.buf = (uint8_t *)i2c_data;
          ^
lib/platform/linux-i2c.c: In function 'i2c_gas_write_status_get':
lib/platform/linux-i2c.c:340:14: warning: pointer targets in assignment differ in signedness [-Wpointer-sign]
  msgs[0].buf = &command_code;
              ^
lib/platform/linux-i2c.c:344:14: warning: pointer targets in assignment differ in signedness [-Wpointer-sign]
  msgs[1].buf = rx_buf;
              ^
lib/platform/linux-i2c.c: In function 'i2c_gas_data_read':
lib/platform/linux-i2c.c:470:14: warning: pointer targets in assignment differ in signedness [-Wpointer-sign]
  msgs[0].buf = (uint8_t *)read_command;
              ^
lib/platform/linux-i2c.c:475:14: warning: pointer targets in assignment differ in signedness [-Wpointer-sign]
  msgs[1].buf = (uint8_t *)read_response;
              ^
lib/platform/linux-i2c.c: At top level:
cc1: warning: unrecognized command line option '-Wno-initializer-overrides'
Makefile:114: recipe for target 'build/lib/platform/linux-i2c.o' failed
make: *** [build/lib/platform/linux-i2c.o] Error 1
@lsgunth
Copy link
Collaborator

lsgunth commented Jun 8, 2020

That's odd, the headers in Debian do not have the duplicate define and both headers are clearly required. What distro and version are you using?

According to this similar issue you may also have to remove the libi2c-dev package as it replaces the i2c-dev header for some reason:

myriadrf/Novena-RF#18

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