SOS first installation of libmodbus on VM with Linux Ubunto - with no success

2,233 views
Skip to first unread message

MiaGY

unread,
Sep 11, 2013, 4:04:59 AM9/11/13
to libm...@googlegroups.com
Hi
 My  name is Mia
 first of all thank you for the code, im sure it will help me a lot.

 Now, I download the libmodbus from the following link :http://libmodbus.org/download/ and pick this version libmodbus v3.1.0

 I have a win 64 bit os - and on it i installe VM with Linux UBUNTO , I pass the file to the VM using a shared window

 then,did the follwing actions

 [1] open the tar file: tar -xvf  libmodbus-3.1.0
 [2] CD into the unzip folder: libmodbus-3.1.0
    there was still no configuration  file (at your instruction you wrote "Download the tarball of the version you want and run ./configure; make; make install; to   compile and install libmodbus on your system." )

    after searching the web i understand that i have to  do the following comand
 [3] libmodbus-3.1.0$ sh autogen.sh
 [4]  then i finally see using ls  the configuration file

     miagy@ubuntu:/mnt/hgfs/linux_win_ex/libmodbus-3.1.0$ ls
     acinclude.m4  autom4te.cache  config.log    COPYING         doc                Makefile.am  README.rst
     aclocal.m4    config.guess    config.sub    COPYING.LESSER  install-sh         MIGRATION    src
     AUTHORS       config.h.in     configure     debian          libmodbus.pc.in    missing      tests
    autogen.sh    config.h.in~    configure.ac  depcomp         libmodbus.spec.in  NEWS

 [5] now i running the ./configure and get errors ,   Make doesnt work either
      here is the output i got while running ./configure command

checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking build system type... i686-pc-linux-gnu
checking host system type... i686-pc-linux-gnu
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking for style of include used by make... GNU
checking dependency style of gcc... gcc3
checking for g++... g++
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking dependency style of g++... gcc3
checking whether make sets $(MAKE)... (cached) yes
./configure: line 4317: syntax error near unexpected token `disable-static'
./configure: line 4317: `LT_INIT(disable-static win32-dll)'

miagy@ubuntu:/mnt/hgfs/linux_win_ex/libmodbus-3.1.0$ make
make: *** No targets specified and no makefile found.  Stop.


when i open the configure file i saw at line 4317 LT_INIT(disable-static win32-dll)
why is it written? im running the libmodbus on linux
shell i delete this line at the configure file?

thanks for you answer
Mia



MiaGY

unread,
Sep 11, 2013, 5:43:45 AM9/11/13
to libm...@googlegroups.com
Another thing
while putting # on the following line at the configure file -

#LT_INIT(disable-static win32-dll)

i saw that there were no error and the process almost ends but at the end i got :

configure: creating ./config.status
config.status: error: cannot find input file: `Makefile.in'

Айрат Сахабутдинов

unread,
Sep 20, 2013, 1:56:24 PM9/20/13
to libm...@googlegroups.com
Hello Mia.

Did you solve the installation problem?
When I use the 3.0.4 version, I do not have problems with install, compilation or run program. But I need non blocking mode for tcp socket in libmodbus (it is solved in 3.1.0).
By the way I use the Raspberry PI platform for design.
So on, I also download and try to install the 3.1.0 unstable version:
1. I download and extract source archive - $ tar -xvf  libmodbus-3.1.0
2. After that, i execute autogen.sh by command $sudo ./autogen.sh it is ends by lines: 
autoreconf: Entering directory `.'
autoreconf: configure.ac: not using Gettext
autoreconf: running: aclocal --force
autoreconf: configure.ac: tracing
autoreconf: configure.ac: not using Libtool
autoreconf: running: /usr/bin/autoconf --force
autoreconf: running: /usr/bin/autoheader --force
autoreconf: running: automake --add-missing --copy --force-missing
src/Makefile.am:1: Libtool library used but `LIBTOOL' is undefined
src/Makefile.am:1:   The usual way to define `LIBTOOL' is to add `LT_INIT'
src/Makefile.am:1:   to `configure.ac' and run `aclocal' and `autoconf' again.
src/Makefile.am:1:   If `LT_INIT' is in `configure.ac', make sure
src/Makefile.am:1:   its definition is in aclocal's search path.
autoreconf: automake failed with exit status: 1

It looks as error, and next command $sudo ./configure
it gives me next lines, which look as non success result, also

checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... no
checking for mawk... mawk

checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking build system type... armv6l-unknown-linux-gnueabihf
checking host system type... armv6l-unknown-linux-gnueabihf

checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking for style of include used by make... GNU
checking dependency style of gcc... gcc3
checking for g++... g++
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking dependency style of g++... gcc3
checking whether make sets $(MAKE)... (cached) yes
./configure: line 4387: syntax error near unexpected token `disable-static'
./configure: line 4387: `LT_INIT(disable-static win32-dll)'


Please, help me!

Айрат Сахабутдинов

unread,
Sep 21, 2013, 1:54:20 AM9/21/13
to libm...@googlegroups.com
The "when i open the configure file i saw at line 4317 LT_INIT(disable-static win32-dll)" problem was sold by Lauri Nurmi (ln-) in irc chat, channel #libmodbus.
He also give small advice - install the libtool
I install it by the command sudo apt-get install libtool
After that, the command "sh autogen.sh" and ./configure executes without errors.
But i do not know how i must execute ./make and ./make install commands to compile and install libmodbus on my debian.
The complex command ./configure && make install pretend that makes many important gists, but return with mistakes:

pi@raspberrypi ~/myLibs/libmodbus-3.1.0 $ ./configure && make install

checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... no
checking for mawk... mawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking build system type... armv6l-unknown-linux-gnueabihf
checking host system type... armv6l-unknown-linux-gnueabihf
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking for style of include used by make... GNU
checking dependency style of gcc... gcc3
checking for g++... g++
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking dependency style of g++... gcc3
checking whether make sets $(MAKE)... (cached) yes
checking how to print strings... printf
checking for a sed that does not truncate output... /bin/sed
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for fgrep... /bin/grep -F
checking for ld used by gcc... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm -B
checking the name lister (/usr/bin/nm -B) interface... BSD nm
checking whether ln -s works... yes
checking the maximum length of command line arguments... 1572864
checking whether the shell understands some XSI constructs... yes
checking whether the shell understands "+="... yes
checking how to convert armv6l-unknown-linux-gnueabihf file names to armv6l-unknown-linux-gnueabihf format... func_convert_file_noop
checking how to convert armv6l-unknown-linux-gnueabihf file names to toolchain format... func_convert_file_noop
checking for /usr/bin/ld option to reload object files... -r
checking for objdump... objdump
checking how to recognize dependent libraries... pass_all
checking for dlltool... no
checking how to associate runtime and link libraries... printf %s\n
checking for ar... ar
checking for archiver @FILE support... @
checking for strip... strip
checking for ranlib... ranlib
checking command to parse /usr/bin/nm -B output from gcc object... ok
checking for sysroot... no
checking for mt... mt
checking if mt is a manifest tool... no
checking how to run the C preprocessor... gcc -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for dlfcn.h... yes
checking for objdir... .libs
checking if gcc supports -fno-rtti -fno-exceptions... no
checking for gcc option to produce PIC... -fPIC -DPIC
checking if gcc PIC flag -fPIC -DPIC works... yes
checking if gcc static flag -static works... yes
checking if gcc supports -c -o file.o... yes
checking if gcc supports -c -o file.o... (cached) yes
checking whether the gcc linker (/usr/bin/ld) supports shared libraries... yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... no
checking how to run the C++ preprocessor... g++ -E
checking for ld used by g++... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking whether the g++ linker (/usr/bin/ld) supports shared libraries... yes
checking for g++ option to produce PIC... -fPIC -DPIC
checking if g++ PIC flag -fPIC -DPIC works... yes
checking if g++ static flag -static works... yes
checking if g++ supports -c -o file.o... yes
checking if g++ supports -c -o file.o... (cached) yes
checking whether the g++ linker (/usr/bin/ld) supports shared libraries... yes
checking dynamic linker characteristics... (cached) GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking arpa/inet.h usability... yes
checking arpa/inet.h presence... yes
checking for arpa/inet.h... yes
checking errno.h usability... yes
checking errno.h presence... yes
checking for errno.h... yes
checking fcntl.h usability... yes
checking fcntl.h presence... yes
checking for fcntl.h... yes
checking limits.h usability... yes
checking limits.h presence... yes
checking for limits.h... yes
checking linux/serial.h usability... yes
checking linux/serial.h presence... yes
checking for linux/serial.h... yes
checking netdb.h usability... yes
checking netdb.h presence... yes
checking for netdb.h... yes
checking netinet/in.h usability... yes
checking netinet/in.h presence... yes
checking for netinet/in.h... yes
checking netinet/tcp.h usability... yes
checking netinet/tcp.h presence... yes
checking for netinet/tcp.h... yes
checking sys/ioctl.h usability... yes
checking sys/ioctl.h presence... yes
checking for sys/ioctl.h... yes
checking sys/socket.h usability... yes
checking sys/socket.h presence... yes
checking for sys/socket.h... yes
checking sys/time.h usability... yes
checking sys/time.h presence... yes
checking for sys/time.h... yes
checking for sys/types.h... (cached) yes
checking termios.h usability... yes
checking termios.h presence... yes
checking for termios.h... yes
checking time.h usability... yes
checking time.h presence... yes
checking for time.h... yes
checking for unistd.h... (cached) yes
checking for asciidoc... no
checking for xmlto... no
configure: WARNING: You are building an unreleased version of libmodbus and asciidoc or xmlto are not installed.
configure: WARNING: Documentation will not be built and manual pages will not be installed.
checking whether to build documentation... no
checking whether to install manpages... no
checking for ANSI C header files... (cached) yes
checking for an ANSI C-conforming const... yes
checking for size_t... yes
checking whether time.h and sys/time.h may both be included... yes
checking whether __CYGWIN__ is declared... no
checking for pid_t... yes
checking vfork.h usability... no
checking vfork.h presence... no
checking for vfork.h... no
checking for fork... yes
checking for vfork... yes
checking for working fork... yes
checking for working vfork... (cached) yes
checking for accept4... yes
checking for getaddrinfo... yes
checking for gettimeofday... yes
checking for inet_ntoa... yes
checking for memset... yes
checking for select... yes
checking for socket... yes
checking for strerror... yes
checking for strlcpy... no
checking winsock2.h usability... no
checking winsock2.h presence... no
checking for winsock2.h... no
checking whether TIOCSRS485 is declared... yes
checking whether TIOCM_RTS is declared... yes
configure: creating ./config.status
config.status: creating Makefile
config.status: creating src/Makefile
config.status: creating src/modbus-version.h
config.status: creating doc/Makefile
config.status: creating tests/Makefile
config.status: creating libmodbus.pc
config.status: creating libmodbus.spec
config.status: creating config.h
config.status: config.h is unchanged
config.status: creating tests/unit-test.h
config.status: tests/unit-test.h is unchanged
config.status: executing depfiles commands
config.status: executing libtool commands
Making install in src
make[1]: Entering directory `/home/pi/myLibs/libmodbus-3.1.0/src'
  CC     modbus.lo
  CC     modbus-rtu.lo
  CC     modbus-tcp.lo
  CCLD   libmodbus.la
make[2]: Entering directory `/home/pi/myLibs/libmodbus-3.1.0/src'
 /bin/mkdir -p '/usr/local/lib'
 /bin/bash ../libtool   --mode=install /usr/bin/install -c   libmodbus.la '/usr/local/lib'
libtool: install: /usr/bin/install -c .libs/libmodbus.so.5.1.0 /usr/local/lib/libmodbus.so.5.1.0
/usr/bin/install: cannot create regular file `/usr/local/lib/libmodbus.so.5.1.0': Permission denied
make[2]: *** [install-libLTLIBRARIES] Error 1
make[2]: Leaving directory `/home/pi/myLibs/libmodbus-3.1.0/src'
make[1]: *** [install-am]
Error 2
make[1]: Leaving directory `/home/pi/myLibs/libmodbus-3.1.0/src'
make: *** [install-recursive]
Error 1
It is my main problem at this moment

Please help me again

Айрат Сахабутдинов

unread,
Sep 21, 2013, 2:01:59 AM9/21/13
to libm...@googlegroups.com
Is i correctly understand, that libtool have not enough rights to install our lib?

Stéphane Raimbault

unread,
Sep 21, 2013, 6:37:15 AM9/21/13
to libm...@googlegroups.com
No, your user don't have permissions to write in /usr/local/ (you must be root).
If you are new to Linux, could take time to learn a bit about it?


Le 21 septembre 2013 08:01, Айрат Сахабутдинов <phd...@gmail.com> a écrit :
Is i correctly understand, that libtool have not enough rights to install our lib?

--
Vous recevez ce message, car vous êtes abonné au groupe Google Groupes libmodbus.
Pour vous désabonner de ce groupe et ne plus recevoir d'e-mails le concernant, envoyez un e-mail à l'adresse libmodbus+...@googlegroups.com.
Pour plus d'options, visitez le site https://groups.google.com/groups/opt_out .

Айрат Сахабутдинов

unread,
Sep 21, 2013, 10:35:32 AM9/21/13
to libm...@googlegroups.com
O, Stephane, Guru!

Tell me please right sequence of commands.
  1. At first I wrote: $tar -xvf  libmodbus-3.1.0.tag.gz
  2. After that I change a directory to libmodbus-3.1.0 directory by the command $cd libmodbus-3.1.0
  3. Then I send the command $sh autogen.sh
  4. The next step will $./configure
  5. After that $sudo make install
Is it correct commands sequence?

MiaGY

unread,
Sep 29, 2013, 5:31:24 AM9/29/13
to libm...@googlegroups.com
OK
I did it finally and  i think i know the answer for your case
as you are not a root user - you need to use sudo !
well just follow the installation consequence

1.download the libmodbus-3.1.0 from the website
I copy the tar file into the following folder /mnt/hgfs/linux_win_ex
2./mnt/hgfs/linux_win_ex$ sudo apt-get install libtool
3./mnt/hgfs/linux_win_ex$ tar -xvf libmodbus-3.1.0.tar.gz
4./mnt/hgfs/linux_win_ex/libmodbus-3.1.0$ sudo sh autogen.sh
5./mnt/hgfs/linux_win_ex/libmodbus-3.1.0$ sudo ./configure
6./mnt/hgfs/linux_win_ex/libmodbus-3.1.0$ sudo make
7./mnt/hgfs/linux_win_ex/libmodbus-3.1.0$ sudo make install
8. when the installation process ends you will get the following note
Libraries have been installed in:

   /usr/local/lib

hope it will help you!

 Mia

Stéphane Raimbault

unread,
Sep 29, 2013, 4:31:57 PM9/29/13
to libm...@googlegroups.com
It's a very bad habit to use sudo when you don't need it, in your example, it's only required to use sudo (or to be root) for make install.


2013/9/29 MiaGY <mia...@gmail.com>

מיה גדליהו יפה

unread,
Sep 30, 2013, 5:05:45 AM9/30/13
to libm...@googlegroups.com
Maybe you are right and it is a bad Habit but I don't have time to read about it right now...
I have lots of tasks on my head....

any way you did a great job even thought i didnt read your code yet....

now you were saying that i need sudo only at the make install but if you will look the followint lines you will see that
There is also a difference between running the autogen.sh with or without the sudo

miagy@ubuntu:/mnt/hgfs/linux_win_ex/libmodbus-3.1.0$ sh autogen.sh (if you dont use the sudo - you will get an error)

autoreconf: Entering directory `.'

autoreconf: configure.ac: not using Gettext

autoreconf: running: aclocal --force

autoreconf: configure.ac: tracing

autoreconf: running: libtoolize --install --copy --force

libtoolize: putting auxiliary files in `.'.

libtoolize: copying file `./config.guess'

libtoolize: copying file `./config.sub'

libtoolize: copying file `./install-sh'

libtoolize: copying file `./ltmain.sh'

libtoolize: Consider adding `AC_CONFIG_MACRO_DIR([m4])' to configure.ac and

libtoolize: rerunning libtoolize, to keep the correct libtool macros in-tree.

libtoolize: Consider adding `-I m4' to ACLOCAL_AMFLAGS in Makefile.am.

autoreconf: running: /usr/bin/autoconf --force

autoreconf: running: /usr/bin/autoheader --force

autoreconf: running: automake --add-missing --copy --force-missing

configure.ac:28: installing `./missing'-ERROR

src/Makefile.am: installing `./depcomp'

autoreconf: Leaving directory `.'

miagy@ubuntu:/mnt/hgfs/linux_win_ex/libmodbus-3.1.0$ sudo sh autogen.sh

autoreconf: Entering directory `.'

autoreconf: configure.ac: not using Gettext

autoreconf: running: aclocal --force

autoreconf: configure.ac: tracing

autoreconf: running: libtoolize --install --copy --force

libtoolize: putting auxiliary files in `.'.

libtoolize: copying file `./config.guess'

libtoolize: copying file `./config.sub'

libtoolize: copying file `./install-sh'

libtoolize: copying file `./ltmain.sh'

libtoolize: Consider adding `AC_CONFIG_MACRO_DIR([m4])' to configure.ac and

libtoolize: rerunning libtoolize, to keep the correct libtool macros in-tree.

libtoolize: Consider adding `-I m4' to ACLOCAL_AMFLAGS in Makefile.am.

autoreconf: running: /usr/bin/autoconf --force

autoreconf: running: /usr/bin/autoheader --force

autoreconf: running: automake --add-missing --copy --force-missing

autoreconf: Leaving directory `.'




2013/9/29 Stéphane Raimbault <stephane....@gmail.com>

--
Vous recevez ce message car vous êtes abonné à un sujet dans le groupe Google Groupes "libmodbus".
Pour vous désabonner de ce sujet, visitez le site https://groups.google.com/d/topic/libmodbus/cS_5RINJzg8/unsubscribe.
Pour vous désabonner de ce groupe et de tous ses sujets, envoyez un e-mail à l'adresse libmodbus+...@googlegroups.com.

Stéphane Raimbault

unread,
Sep 30, 2013, 10:34:36 AM9/30/13
to libm...@googlegroups.com
You've an error because you've created files as root by running autogen.sh as root and now you can't overwrite them as plain user.

2013/9/30 מיה גדליהו יפה <mia...@gmail.com>

>
> Maybe you are right and it is a bad Habit but I don't have time to read about it right now...


If you don't have time to read answers, please don't waste our time with questions.



> I have lots of tasks on my head....
>
> any way you did a great job even thought i didnt read your code yet....
>
> now you were saying that i need sudo only at the make install but if you will look the followint lines you will see that
> There is also a difference between running the autogen.sh with or without the sudo
>
> miagy@ubuntu:/mnt/hgfs/linux_win_ex/libmodbus-3.1.0$ sh autogen.sh (if you dont use the sudo - you will get an error)

You got an error because you've created root files by running autogen.sh as root and now you can't overwrite them as plain user.

Stéphane

מיה גדליהו יפה

unread,
Oct 1, 2013, 3:10:10 AM10/1/13
to libm...@googlegroups.com
Hi Stéphane

 
Thanks for the answers

I wrote that I don't have time to read about how to fix the root user and all that issues because i have a lot tasks at my mind and at the end the code is going to reside the target anyway and there i have no root issues
Its not that i have no time to read answer i read a lot of answers at the forum before i wrote my question
No one tries to waste anyone time...
 

Any way if you have a good link for that i will be happy to read about that (maybe at my day off)
BTW i needed to link the lib folders


ln -s /usr/local/lib/libmodbus.so.5 /usr/lib/libmodbus.so.5



Mia



2013/9/30 Stéphane Raimbault <stephane....@gmail.com>

Stéphane Raimbault

unread,
Oct 6, 2013, 7:41:55 AM10/6/13
to libm...@googlegroups.com
The proper way to do that is to add an entry in /etc/ld.so.conf.d/


2013/10/1 מיה גדליהו יפה <mia...@gmail.com>

--
Vous recevez ce message, car vous êtes abonné au groupe Google Groupes libmodbus.
Pour vous désabonner de ce groupe et ne plus recevoir d'e-mails le concernant, envoyez un e-mail à l'adresse libmodbus+...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages