[LinuxCNC/linuxcnc Issue#105] compiling against libmodbus version 3.1.0 or greater fails due to API changes

未分类 bolang 4个月前 (10-15) 25次浏览

Issue #105 | 状态: 已关闭 | 作者: hazelnusse | 创建时间: 2016-07-03


modbus.h from <=3.0.x:

void modbussetresponsetimeout(modbust ctx, const struct timeval timeout);
void modbussetbytetimeout(modbust ctx, const struct timeval timeout);

while >= modbus 3.1.0 has:

MODBUSAPI int modbussetresponsetimeout(modbust *ctx, uint32t tosec, uint32t to_usec);
MODBUSAPI int modbussetbytetimeout(modbust *ctx, uint32t tosec, uint32t to_usec);

This gives this these compilation errors in mb2hal.c:

hal/usercomps/mb2hal/mb2hal.c: In function ‘gettx_connection’:
hal/usercomps/mb2hal/mb2hal.c:362:55: warning: passing argument 2 of ‘modbussetresponsetimeout’ makes integer from pointer without a cast [-Wint-conversion]
     modbussetresponsetimeout(thismb_link->modbus, &timeout);
                                                       ^
In file included from hal/user_comps/mb2hal/mb2hal.h:18:0,
                 from hal/user_comps/mb2hal/mb2hal.c:27:
/usr/include/modbus/modbus.h:188:16: note: expected ‘uint32_t {aka unsigned int}’ but argument is of type ‘struct timeval *’
 MODBUSAPI int modbussetresponsetimeout(modbust *ctx, uint32t tosec, uint32t to_usec);
                ^
hal/usercomps/mb2hal/mb2hal.c:362:5: error: too few arguments to function ‘modbussetresponsetimeout’
     modbussetresponsetimeout(thismb_link->modbus, &timeout);
     ^
In file included from hal/user_comps/mb2hal/mb2hal.h:18:0,
                 from hal/user_comps/mb2hal/mb2hal.c:27:
/usr/include/modbus/modbus.h:188:16: note: declared here
 MODBUSAPI int modbussetresponsetimeout(modbust *ctx, uint32t tosec, uint32t to_usec);
                ^
hal/usercomps/mb2hal/mb2hal.c:369:51: warning: passing argument 2 of ‘modbussetbytetimeout’ makes integer from pointer without a cast [-Wint-conversion]
     modbussetbytetimeout(thismb_link->modbus, &timeout);
                                                   ^
In file included from hal/user_comps/mb2hal/mb2hal.h:18:0,
                 from hal/user_comps/mb2hal/mb2hal.c:27:
/usr/include/modbus/modbus.h:191:16: note: expected ‘uint32_t {aka unsigned int}’ but argument is of type ‘struct timeval *’
 MODBUSAPI int modbussetbytetimeout(modbust *ctx, uint32t tosec, uint32t to_usec);
                ^
hal/usercomps/mb2hal/mb2hal.c:369:5: error: too few arguments to function ‘modbussetbytetimeout’
     modbussetbytetimeout(thismb_link->modbus, &timeout);
     ^
In file included from hal/user_comps/mb2hal/mb2hal.h:18:0,
                 from hal/user_comps/mb2hal/mb2hal.c:27:
/usr/include/modbus/modbus.h:191:16: note: declared here
 MODBUSAPI int modbussetbytetimeout(modbust *ctx, uint32t tosec, uint32t to_usec);
                ^
make: * [Makefile:207: objects/hal/user_comps/mb2hal/mb2hal.o] Error 1

原始Issue: https://github.com/LinuxCNC/linuxcnc/issues/105

喜欢 (0)