stephane / libmodbus

A Modbus library for Linux, Mac OS, FreeBSD and Windows
http://libmodbus.org
GNU Lesser General Public License v2.1
3.29k stars 1.71k forks source link

problem with winsock2.h and configure ? #17

Closed sebi008 closed 12 years ago

sebi008 commented 12 years ago

the command ./configure send me a warning telling me to come here and report what's happened: " configure: WARNING: winsock2.h: present but cannot be compiled configure: WARNING: winsock2.h: check for missing prerequisite headers? configure: WARNING: winsock2.h: see the Autoconf documentation configure: WARNING: winsock2.h: section "Present But Cannot Be Compiled" configure: WARNING: winsock2.h: proceeding with the compiler's result configure: WARNING: ## ----------------------------------------------------------- ## configure: WARNING: ## Report this to https://github.com/stephane/libmodbus/issues ## configure: WARNING: ## ----------------------------------------------------------- ## "

stephane commented 12 years ago

Which version?

sebi008 commented 12 years ago

I'm on windows XP pro SP3; using cygwin 2.738 I've download "stephane-libmodbus-v3.0.0-0-g00cb49e.zip"

after the finish of configure with "no" error (nothing is written on the screen) the execution of make command tell me :

make all-recursive make[1]: Entering directory /home/solivier/liibmodbus' Making all in src make[2]: Entering directory/home/solivier/liibmodbus/src' if /bin/sh ../libtool --tag=CC --mode=compile gcc -DHAVE_CONFI u.Tpo" -c -o modbus-rtu.lo modbus-rtu.c; \ then mv -f ".deps/modbus-rtu.Tpo" ".deps/modbus-rtu.Pl libtool: compile: gcc -DHAVE_CONFIG_H -I. -I. -I.. -g -O2 -Wa ORT -DPIC -o .libs/modbus-rtu.o modbus-rtu.c:36:26: error: linux/serial.h: No such file or dir modbus-rtu.c: In function 'modbus_rtu_set_serial_mode': modbus-rtu.c:713: error: storage size of 'rs485conf' isn't kno modbus-rtu.c:714: error: invalid application of 'sizeof' to in modbus-rtu.c:717: error: 'SER_RS485_ENABLED' undeclared (first modbus-rtu.c:717: error: (Each undeclared identifier is report modbus-rtu.c:717: error: for each function it appears in.) modbus-rtu.c:718: error: 'TIOCSRS485' undeclared (first use in cc1: warnings being treated as errors modbus-rtu.c:713: error: unused variable 'rs485conf' make[2]: * [modbus-rtu.lo] Error 1 make[2]: Leaving directory `/home/solivier/liibmodbus/src' make[1]: * [all-recursive] Error 1 make[1]: Leaving directory`/home/solivier/liibmodbus' make: *\ [all] Error 2

I can't copy all the screen to paste here so the commands are truncated. I'm sorry this is my first use of cygwin. thank you

stephane commented 12 years ago

OK, I've merged some fixes for Windows for the v3.0.1 Can you test again with https://github.com/stephane/libmodbus/zipball/v3.0.1 ?

sebi008 commented 12 years ago

I have the same warning but the make command give me another thing with this version :

############################################################################## solivier@ST-RV-MNP-OLR ~/libmodbus

./autogen.sh

autoreconf-2.68: Entering directory .' autoreconf-2.68: configure.ac: not using Gettext autoreconf-2.68: running: aclocal --force autoreconf-2.68: configure.ac: tracing autoreconf-2.68: running: libtoolize --copy --force libtoolize: putting auxiliary files in.'. libtoolize: copying file ./ltmain.sh' libtoolize: Consider addingAC_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-2.68: running: /usr/bin/autoconf-2.68 --force autoreconf-2.68: running: /usr/bin/autoheader-2.68 --force autoreconf-2.68: running: automake --add-missing --copy --force-missing configure.ac:51: installing./config.guess' configure.ac:51: installing ./config.sub' configure.ac:30: installing./install-sh' configure.ac:30: installing ./missing' src/Makefile.am: installing./depcomp' autoreconf-2.68: Leaving directory `.'

solivier@ST-RV-MNP-OLR ~/libmodbus

./configure

checking for a BSD-compatible install... /usr/bin/install -c checking whether build environment is sane... yes checking for a thread-safe mkdir -p... /usr/bin/mkdir -p checking for gawk... gawk checking whether make sets $(MAKE)... yes checking build system type... i686-pc-cygwin checking host system type... i686-pc-cygwin checking for gcc... gcc checking whether the C compiler works... yes checking for C compiler default output file name... a.exe checking for suffix of executables... .exe 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... /usr/bin/sed checking for grep that handles long lines and -e... /usr/bin/grep checking for egrep... /usr/bin/grep -E checking for fgrep... /usr/bin/grep -F checking for ld used by gcc... /usr/i686-pc-cygwin/bin/ld.exe checking if the linker (/usr/i686-pc-cygwin/bin/ld.exe) 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... 8192 checking whether the shell understands some XSI constructs... yes checking whether the shell understands "+="... yes checking how to convert i686-pc-cygwin file names to i686-pc-cygwin format... func_convert_file_noop checking how to convert i686-pc-cygwin file names to toolchain format... func_convert_file_noop checking for /usr/i686-pc-cygwin/bin/ld.exe option to reload object files... -r checking for objdump... objdump checking how to recognize dependent libraries... file_magic ^x86 archive import|^x86 DLL checking for dlltool... dlltool checking how to associate runtime and link libraries... func_cygming_dll_for_implib 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... no checking if : 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 as... as checking for dlltool... (cached) dlltool checking for objdump... (cached) objdump checking for objdir... .libs checking if gcc supports -fno-rtti -fno-exceptions... no checking for gcc option to produce PIC... -DDLL_EXPORT -DPIC checking if gcc PIC flag -DDLL_EXPORT -DPIC works... yes checking if gcc static flag -static works... no 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/i686-pc-cygwin/bin/ld.exe) supports shared libraries... yes checking whether -lc should be explicitly linked in... yes checking dynamic linker characteristics... Win32 ld.exe 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/i686-pc-cygwin/bin/ld.exe checking if the linker (/usr/i686-pc-cygwin/bin/ld.exe) is GNU ld... yes checking whether the g++ linker (/usr/i686-pc-cygwin/bin/ld.exe) supports shared libraries... yes checking for g++ option to produce PIC... -DDLL_EXPORT -DPIC checking if g++ PIC flag -DDLL_EXPORT -DPIC works... yes checking if g++ static flag -static works... no 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/i686-pc-cygwin/bin/ld.exe) supports shared libraries... yes checking dynamic linker characteristics... Win32 ld.exe checking how to hardcode library paths into programs... immediate checking termios.h usability... yes checking termios.h presence... yes checking for termios.h... yes checking sys/time.h usability... yes checking sys/time.h presence... yes checking for sys/time.h... yes checking time.h usability... yes checking time.h presence... yes checking for time.h... yes checking for unistd.h... (cached) yes checking errno.h usability... yes checking errno.h presence... yes checking for errno.h... yes checking limits.h usability... yes checking limits.h presence... yes checking for limits.h... yes checking fcntl.h usability... yes checking fcntl.h presence... yes checking for fcntl.h... yes checking for sys/types.h... (cached) yes checking sys/socket.h usability... yes checking sys/socket.h presence... yes checking for sys/socket.h... yes checking sys/ioctl.h usability... yes checking sys/ioctl.h presence... yes checking for sys/ioctl.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 arpa/inet.h usability... yes checking arpa/inet.h presence... yes checking for arpa/inet.h... yes checking netdb.h usability... yes checking netdb.h presence... yes checking for netdb.h... yes checking linux/serial.h usability... no checking linux/serial.h presence... no checking for linux/serial.h... no checking for asciidoc... yes checking for xmlto... yes checking whether to build documentation... yes checking whether to install manpages... yes 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... yes 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 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... yes checking for getaddrinfo... yes checking winsock2.h usability... no checking winsock2.h presence... yes configure: WARNING: winsock2.h: present but cannot be compiled configure: WARNING: winsock2.h: check for missing prerequisite headers? configure: WARNING: winsock2.h: see the Autoconf documentation configure: WARNING: winsock2.h: section "Present But Cannot Be Compiled" configure: WARNING: winsock2.h: proceeding with the compiler's result configure: WARNING: ## ----------------------------------------------------------- ## configure: WARNING: ## Report this to https://github.com/stephane/libmodbus/issues ## configure: WARNING: ## ----------------------------------------------------------- ## checking for winsock2.h... no checking whether TIOCSRS485 is declared... no 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: executing depfiles commands config.status: executing libtool commands

solivier@ST-RV-MNP-OLR ~/libmodbus

make

make all-recursive make[1]: Entering directory /home/solivier/libmodbus' Making all in src make[2]: Entering directory/home/solivier/libmodbus/src' CC modbus.lo CC modbus-data.lo CC modbus-rtu.lo CC modbus-tcp.lo CCLD libmodbus.la Creating library file: .libs/libmodbus.dll.a make[2]: Leaving directory /home/solivier/libmodbus/src' Making all in doc make[2]: Entering directory/home/solivier/libmodbus/doc' asciidoc -d manpage -b docbook -f asciidoc.conf \ -alibmodbus_version=3.0.1 modbus_close.txt xmlto man modbus_close.xml xmlto: /home/solivier/libmodbus/doc/modbus_close.xml does not validate (status 3) xmlto: Fix document syntax or use --skip-validation option I/O error : Attempt to load network entity http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd /home/solivier/libmodbus/doc/modbus_close.xml:2: warning: failed to load external entity "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" D DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" ^ I/O error : Attempt to load network entity http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd warning: failed to load external entity "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" Could not load the external subset "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" Document /home/solivier/libmodbus/doc/modbus_close.xml does not validate make[2]: * [modbus_close.3] Error 13 rm modbus_close.xml make[2]: Leaving directory `/home/solivier/libmodbus/doc' make[1]: * [all-recursive] Error 1 make[1]: Leaving directory`/home/solivier/libmodbus' make: *\ [all] Error 2

solivier@ST-RV-MNP-OLR ~/libmodbus

make install

Making install in src make[1]: Entering directory /home/solivier/libmodbus/src' make[2]: Entering directory/home/solivier/libmodbus/src' test -z "/usr/local/lib" || /usr/bin/mkdir -p "/usr/local/lib" /bin/sh ../libtool --mode=install /usr/bin/install -c libmodbus.la '/usr/local/lib' libtool: install: /usr/bin/install -c .libs/libmodbus.dll.a /usr/local/lib/libmodbus.dll.a libtool: install: base_file=basename libmodbus.la libtool: install: dlpath=/bin/sh 2>&1 -c '. .libs/'libmodbus.la'i; echo cygmodbus-5.dll' libtool: install: dldir=/usr/local/lib/dirname ../bin/cygmodbus-5.dll libtool: install: test -d /usr/local/lib/../bin || mkdir -p /usr/local/lib/../bin libtool: install: /usr/bin/install -c .libs/cygmodbus-5.dll /usr/local/lib/../bin/cygmodbus-5.dll libtool: install: chmod a+x /usr/local/lib/../bin/cygmodbus-5.dll libtool: install: if test -n '' && test -n 'strip --strip-unneeded'; then eval 'strip --strip-unneeded /usr/local/lib/../bin/cygmodbus-5.dll' || exit 0; fi libtool: install: /usr/bin/install -c .libs/libmodbus.lai /usr/local/lib/libmodbus.la test -z "/usr/local/include/modbus" || /usr/bin/mkdir -p "/usr/local/include/modbus" /usr/bin/install -c -m 644 modbus.h modbus-version.h modbus-rtu.h modbus-tcp.h '/usr/local/include/modbus' make[2]: Leaving directory /home/solivier/libmodbus/src' make[1]: Leaving directory/home/solivier/libmodbus/src' Making install in doc make[1]: Entering directory /home/solivier/libmodbus/doc' asciidoc -d manpage -b docbook -f asciidoc.conf \ -alibmodbus_version=3.0.1 modbus_close.txt xmlto man modbus_close.xml xmlto: /home/solivier/libmodbus/doc/modbus_close.xml does not validate (status 3) xmlto: Fix document syntax or use --skip-validation option I/O error : Attempt to load network entity http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd /home/solivier/libmodbus/doc/modbus_close.xml:2: warning: failed to load external entity "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" D DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" ^ I/O error : Attempt to load network entity http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd warning: failed to load external entity "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" Could not load the external subset "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" Document /home/solivier/libmodbus/doc/modbus_close.xml does not validate make[1]: *** [modbus_close.3] Error 13 rm modbus_close.xml make[1]: Leaving directory/home/solivier/libmodbus/doc' make: *\ [install-recursive] Error 1 #######################################################################################

stephane commented 12 years ago

It's useless to post so many lines for just this error, you just have an issue with xmlto or your asciidoc installation. The libmodbus is designed to be compiled under mingw not cygwin.

Your initial problem is fixed (winsock2.h error) so the but must be closed. Feel free to submit patch for Cygwin, but please don't submit bug report for this environment, I won't take time to support it.

sebi008 commented 12 years ago

thank you for your response . I'm sorry to flooded you but since i'm not the original creator of the library i can't know what thing can be important to have to debug. and for cygwin i never saw that the library was designed only for mingw . with the previous release cygwin and mingw had the same results and i thought it was the same with this version. It can be good for beginners to write it in the readme.rst and to avoid you wasting time for nothing. I will use mingw : it appears to be OK.