I've come across this earlier and had created a local patch,

Tested with both v3.0.6 and v3.1.4 (Latest Stable release)

>From 0b557f7116cd52a2b69e84872588e22577c1b459 Mon Sep 17 00:00:00 2001
From: Philip Mullen <[email protected]>
Date: Sun, 7 May 2017 13:52:53 +0100
Subject: [PATCH] Add support for libmodbus >= v3.1

Added support for the new form of modbus_set_response_timeout
and modbus_set_byte_timeout in versions >= 3.1
---
 src/hal/user_comps/mb2hal/mb2hal.c | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)

diff --git a/src/hal/user_comps/mb2hal/mb2hal.c b/src/hal/user_comps/mb2hal/mb2hal.c
index 1ba9a87..1ca067e 100644
--- a/src/hal/user_comps/mb2hal/mb2hal.c
+++ b/src/hal/user_comps/mb2hal/mb2hal.c
@@ -355,18 +355,28 @@ retCode get_tx_connection(const int this_mb_tx_num, int *ret_connected)
 
     //set the low level mb_link debug according to each mb_tx
     modbus_set_debug(this_mb_link->modbus, this_mb_tx->protocol_debug);
-
-    //set response and byte timeout according to each mb_tx
     timeout.tv_sec  = this_mb_tx->mb_response_timeout_ms / 1000;
     timeout.tv_usec = (this_mb_tx->mb_response_timeout_ms % 1000) * 1000;
-    modbus_set_response_timeout(this_mb_link->modbus, &timeout);
+    //set response and byte timeout according to each mb_tx
+    #if LIBMODBUS_VERSION_MAJOR >= 3 && LIBMODBUS_VERSION_MINOR >= 1
+        modbus_set_response_timeout(this_mb_link->modbus, (uint32_t) (&timeout)->tv_sec, (uint32_t) (&timeout)->tv_sec);
+    #else
+        modbus_set_response_timeout(this_mb_link->modbus, &timeout);
+    #endif // LIBMODBUS_VERSION
+
     //DBG(this_mb_tx->cfg_debug, "mb_tx_num[%d] mb_links[%d] response timeout [%d] ([%d] [%d])",
     //    this_mb_tx_num, this_mb_tx->mb_link_num, this_mb_tx->mb_response_timeout_ms,
     //    (int) timeout.tv_sec, (int) timeout.tv_usec);
 
     timeout.tv_sec  = this_mb_tx->mb_byte_timeout_ms / 1000;
     timeout.tv_usec = (this_mb_tx->mb_byte_timeout_ms % 1000) * 1000;
-    modbus_set_byte_timeout(this_mb_link->modbus, &timeout);
+
+    #if LIBMODBUS_VERSION_MAJOR >= 3 && LIBMODBUS_VERSION_MINOR >= 1
+        modbus_set_byte_timeout(this_mb_link->modbus, (uint32_t) (&timeout)->tv_sec, (uint32_t) (&timeout)->tv_sec);
+    #else
+        modbus_set_byte_timeout(this_mb_link->modbus, &timeout);
+    #endif // LIBMODBUS_VERSION
+
     //DBG(this_mb_tx->cfg_debug, "mb_tx_num[%d] mb_links[%d] byte timeout [%d] ([%d] [%d])",
     //    this_mb_tx_num, this_mb_tx->mb_link_num, this_mb_tx->mb_byte_timeout_ms,
     //    (int) timeout.tv_sec, (int) timeout.tv_usec);
-- 
2.9.3

Philip

Evan Foss <[email protected]> writes:

> Is anyone looking into this?
>
> On Thu, Apr 27, 2017 at 3:49 AM, Evan Foss <[email protected]> wrote:
>> On Wed, Apr 26, 2017 at 1:30 PM, Sebastian Kuzminsky <[email protected]> 
>> wrote:
>>> 2.7 should build anywhere the master branch (2.8-prerelease) builds, what
>>> build error do you get?
>>
>> Attached are the configure and build runs. I tried playing with the
>> --enable-non-distributable=yes option but it still lands on the same
>> error.
>> This is just the error extracted from the build.
>>
>> Compiling hal/user_comps/mb2hal/mb2hal.c
>> hal/user_comps/mb2hal/mb2hal.c: In function ‘get_tx_connection’:
>> hal/user_comps/mb2hal/mb2hal.c:362:5: warning: passing argument 2 of
>> ‘modbus_set_response_timeout’ makes integer from pointer without a
>> cast [enabled by default]
>> 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’ but
>> argument is of type ‘struct timeval *’
>> hal/user_comps/mb2hal/mb2hal.c:362:5: error: too few arguments to
>> function ‘modbus_set_response_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
>> hal/user_comps/mb2hal/mb2hal.c:369:5: warning: passing argument 2 of
>> ‘modbus_set_byte_timeout’ makes integer from pointer without a cast
>> [enabled by default]
>> 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’ but
>> argument is of type ‘struct timeval *’
>> hal/user_comps/mb2hal/mb2hal.c:369:5: error: too few arguments to
>> function ‘modbus_set_byte_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
>> make: *** [Makefile:211: objects/hal/user_comps/mb2hal/mb2hal.o] Error 1
>>
>>
>>> And how does matter fail to run?
>>
>> 2.8-prerelease has some quirks you should know. (or perhaps i am miss using 
>> it)
>> 1. It doesn't understand --prefix= as other packages seem too in my
>> experience. When I went to do make install it complained about not
>> having a DESTDIR so I added DESTDIR :=  / to the Makefile.
>> 2. It doesn't understand that when --prefix= points to say
>> /home/username/programs/whatever/ that it has to use the installers
>> permission level. (it kept bugging me for root)
>>
>> I added the following to my .bashrc because it is not installed in /
>> export PATH=/home/user1/programs/linuxcnc/bin:${PATH}
>> export LD_LIBRARY_PATH=/home/user1/programs/linuxcnc/lib:$LD_LIBRARY_PATH
>> export 
>> PKG_CONFIG_PATH=/home/user1/programs/linuxcnc/lib/pkgconfig:$PKG_CONFIG_PATH
>>
>> When I run this is what happens in the console. In the gui The
>> LinuxCNC Configuration Selector CURRENT: axis.ini.
>> I leave it on axis.ini and click Next. When it crashes.
>>
>> ~ $ linuxcnc
>> LINUXCNC - 2.8.0~pre1
>> Machine configuration directory is
>> '/home/user1/programs/linuxcnc/share/doc/linuxcnc/examples/sample-configs/sim/axis'
>> Machine configuration file is 'axis.ini'
>> can't find package Linuxcnc
>>     while executing
>> "package require Linuxcnc "
>>     (file 
>> "/home/user1/programs/linuxcnc/share/linuxcnc/hallib/check_config.tcl"
>> line 83)
>> check_config validation failed
>> LinuxCNC terminated with an error.  You can find more information in the log:
>>     /home/user1/linuxcnc_debug.txt
>> and
>>     /home/user1/linuxcnc_print.txt
>> as well as in the output of the shell command 'dmesg' and in the terminal
>>
>> I attached linuxcnc_print.txt but linuxcnc_debug.txt is empty (0 bytes).
>>
>> Thanks for the continued effort,
>> Evan (and the rest of the pcb-rnd team)
>>
>>>
>>> On April 25, 2017 7:01:29 PM MDT, Evan Foss <[email protected]> wrote:
>>>>
>>>> On Mon, Apr 24, 2017 at 2:49 PM, Sebastian Kuzminsky <[email protected]>
>>>> wrote:
>>>>>
>>>>>  On 04/23/2017 09:25 PM, Evan Foss wrote:
>>>>>>
>>>>>>  Ok so I tried
>>>>>>  LDFLAGS=-L/usr/lib64 ./configure --without-libmodbus
>>>>>>  --with-realtime=uspace --with-python=/usr/bin/python2.7
>>>>>>  --with-boost-python=py27
>>>>>>  (all one line) and it still lands in the same failure. I attached the
>>>>>> logfile
>>>>>
>>>>>
>>>>>  Chris Radek pointed out to me on IRC that i'd given you the wrong
>>>>>  boost-python library name.  That command line is right except it should
>>>>>  be --with-boost-python=2.7, *not* =py2.7.
>>>>
>>>>
>>>> You and Chris Radek ROCK! This worked past the configure stage but now
>>>> i have a different problem...
>>>> ./configure --enable-simulator --with-python=/usr/bin/python2.7
>>>> --with-boost-python=2.7 --prefix=/home/user1/programs/linuxcnc
>>>>
>>>> Using release 2.7.8 the build fails. Using the current git head it
>>>> builds but fails run. Which should I focus on?
>>>>
>>>>>
>>>>>  --
>>>>>  Sebastian Kuzminsky
>>>>>
>>>>> ________________________________
>>>>>
>>>>>  Check out the vibrant tech community on one of the world's most
>>>>>  engaging tech sites, Slashdot.org! http://sdm.link/slashdot
>>>>> ________________________________
>>>>>
>>>>>  Emc-users mailing list
>>>>>  [email protected]
>>>>>  https://lists.sourceforge.net/lists/listinfo/emc-users
>>>>
>>>>
>>>>
>>>
>>> --
>>> Sebastian Kuzminsky
>>
>>
>>
>> --
>> Home
>> http://evanfoss.googlepages.com/
>> Work
>> http://forge.abcd.harvard.edu/gf/project/epl_engineering/wiki/
>>
>> -----BEGIN PGP PUBLIC KEY BLOCK-----
>> Version: GnuPG v2
>>
>> mQENBFYy4RYBCAC183JomLtbdAlcKiaPDoVHq52LDmVmH75aiEc69m7YxDt54/ai
>> VtYCAobbGVIyn3Hlz3uhF6LnPl/6Lm1VdnCfpwu3KQhCO6ds10ow2C30X4ohCqOd
>> hCVg5C+ILmQkEffFrFODy3ji+PYTF4pADvHCWsTMv0hf0llwFOJsBCK6cl02IffE
>> JPqy4PjM1nZ9HpzT84JBaG/4OGvTZ8SQ2yFUl265jagvygPTf88H1xpZHH1r8dB1
>> stjUHLmPH8AOyDgKxFchgGeDc3p/vJtgDDIXAFfDXG0NSRovLmtaQdGxe47Zf/go
>> bXiEM7YL2WqQe5zfEA919JxkEwlDKYniOSVzABEBAAG0N0V2YW4gRm9zcyAoVGhp
>> cyBpcyBteSBwdWJsaWMga2V5LikgPGV2YW5mb3NzQGdtYWlsLmNvbT6JATkEEwEC
>> ACMFAlYy4RYCGwMHCwkIBwMCAQYVCAIJCgsEFgIDAQIeAQIXgAAKCRCIpQTcE8nN
>> bbBaCACAm8pU5lG1ev2Fsw68Axtcl57SJrYieqX96c3YuYH9JpqMqJRnd9nDKw9X
>> tQuvuH7tUk0VbOaDqReOYJVI/4c5wb9AaOFp6K2DUcupq6XhgXpvz3HzoPwjAdIj
>> XuQzdRUx5+innTJrSkGuBYW/CZ2zqEx4xfLlq4rO0hoTUMR8QVp2cCrkw6BT0m86
>> APIw/ZnjoxM8IEzr7MxfRIg3qpzrZk28rmhx+k78Jyk61UhwcCPGIm/pjUopTwYJ
>> 3YBdRB2cYD2aN7A1JVf5cRmSQYooHBGpH0kYvomGk97PKqypVuJ7OpG9xM58wUcC
>> qUVt9hKlePLzP8csYjt8onqI7qIIuQENBFYy4RYBCADlH8spG3WkCx62vB5mr5Z0
>> SCDd/RcyA4A5y5EOj5KurQkrSWpgi9Ho1yKruMJ6blQR2qkc66KqH9pnXDm/ZI1M
>> K/wdW3ngETxBmXoozzFMT89aEWIVR5/PFodWK1elekE9iJxACuR98Zg2QttTD3x8
>> A9w8VEyMLOXcDTrPFpHegMKswFBg5iuMulAdXAoGejWTI3n+qKFpabHm2Lfs6wjk
>> 5rjucpTdeFK6UeWF1xAvNxXibuu5BlGwv53930qIXRwO/Gn2Rh5DXWxKU2fEIme/
>> xgQQmIsDeUoWbfybdjw/x7Q0LW4mINiLDQcGHHRQKFIxbAJCT3USPLGh5xwE9/Er
>> ABEBAAGJAR8EGAECAAkFAlYy4RYCGwwACgkQiKUE3BPJzW0uYAf9Hf30n8tM3mR2
>> Zo6ESE0ivgdgjaJtAWrBUx7JzAzPjBnBOlNnu5Y9lVEqetvUPH6e3PvaHYUuaUU8
>> 0HwxuKBW9nUprgV6uIu1DZmlcp+SxpbuCy7RDpNocRLNWWFMaYYzznmTgfnTgD4D
>> gCq8Mf1mcfrluTkOAo+QNqbMfl1GISClopRqxVuAo59ewgMnFujwgd8w12BwWl24
>> CzqOs5HqcUslePj+LzcjSNgVCklYwKl+0dsb/fctMOCtHodwqm2CBJ+zydvNmYkD
>> fxda/J91Z1xrah5ec++FL0L4vs+jCiIWJeupJFKlr1hCMZiiGH7W554loK5l4jv3
>> EY347EidAw==
>> =Ta4p
>> -----END PGP PUBLIC KEY BLOCK-----
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Emc-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/emc-users

Reply via email to