martinling / libserialport

Unofficial personal repository for libserialport - see git://sigrok.org/libserialport for official repo
http://sigrok.org/wiki/Libserialport
GNU Lesser General Public License v3.0
65 stars 34 forks source link

build failed under cygwin64 #19

Closed heyong919 closed 4 years ago

heyong919 commented 8 years ago

STEP 1: $ ./autogen.sh autoreconf-2.69: Entering directory .' autoreconf-2.69: configure.ac: not using Gettext autoreconf-2.69: running: aclocal --force -I autostuff autoreconf-2.69: configure.ac: tracing autoreconf-2.69: running: libtoolize --copy --force libtoolize: putting auxiliary files in AC_CONFIG_AUX_DIR, 'autostuff'. libtoolize: copying file 'autostuff/ltmain.sh' libtoolize: putting macros in AC_CONFIG_MACRO_DIRS, 'autostuff'. libtoolize: copying file 'autostuff/libtool.m4' libtoolize: copying file 'autostuff/ltoptions.m4' libtoolize: copying file 'autostuff/ltsugar.m4' libtoolize: copying file 'autostuff/ltversion.m4' libtoolize: copying file 'autostuff/lt~obsolete.m4' autoreconf-2.69: running: /usr/bin/autoconf-2.69 --force autoreconf-2.69: running: /usr/bin/autoheader-2.69 --force autoreconf-2.69: running: automake --add-missing --copy --force-missing Unescaped left brace in regex is deprecated, passed through in regex; marked by <-- HERE in m/\${ <-- HERE ([^ \t=:+{}]+)}/ at /usr/bin/automake-1.14 line 3930. configure.ac:46: installing 'autostuff/compile' configure.ac:54: installing 'autostuff/config.guess' configure.ac:54: installing 'autostuff/config.sub' configure.ac:44: installing 'autostuff/missing' Makefile.am: installing 'autostuff/depcomp' autoreconf-2.69: Leaving directory.'

STEP 2: $ ./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 whether make supports nested variables... yes checking whether make supports nested variables... (cached) yes checking for style of include used by make... GNU 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 whether gcc understands -c and -o together... yes checking dependency style of gcc... gcc3 checking for ar... ar checking the archiver (ar) interface... ar checking for gcc... (cached) gcc checking whether we are using the GNU C compiler... (cached) yes checking whether gcc accepts -g... (cached) yes checking for gcc option to accept ISO C89... (cached) none needed checking whether gcc understands -c and -o together... (cached) yes checking dependency style of gcc... (cached) gcc3 checking whether ln -s works... yes checking build system type... x86_64-unknown-cygwin checking host system type... x86_64-unknown-cygwin 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/x86_64-pc-cygwin/bin/ld.exe checking if the linker (/usr/x86_64-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 the maximum length of command line arguments... 8192 checking how to convert x86_64-unknown-cygwin file names to x86_64-unknown-cygwin format... func_convert_file_noop checking how to convert x86_64-unknown-cygwin file names to toolchain format... func_convert_file_noop checking for /usr/x86_64-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 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 a working dd... /usr/bin/dd checking how to truncate binary pipes... /usr/bin/dd bs=4096 count=1 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 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... 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/x86_64-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... yes checking for special C compiler options needed for large files... no checking for _FILE_OFFSET_BITS value needed for large files... no checking for size_t... yes checking for struct termios2... no checking for struct termiox... no checking for struct termios.c_ispeed... no checking for struct termios.c_ospeed... no checking for struct termios2.c_ispeed... no checking for struct termios2.c_ospeed... no checking whether BOTHER is declared... no checking for struct serial_struct... no checking for visibility control... declspec checking that generated files are newer than configure... done configure: creating ./config.status config.status: creating Makefile config.status: creating libserialport.pc config.status: creating config.h config.status: creating libserialport.h config.status: executing depfiles commands config.status: executing libtool commands

libserialport configuration summary:

STEP 3: $ make make all-am CC serialport.lo serialport.c: In function ‘sp_blocking_write’: serialport.c:779:2: error: unknown type name ‘fd_set’ fd_set fds; ^ serialport.c:789:3: warning: implicit declaration of function ‘timeradd’ [-Wimplicit-function-declaration] timeradd(&start, &delta, &end); ^ serialport.c:792:2: warning: implicit declaration of function ‘FD_ZERO’ [-Wimplicit-function-declaration] FD_ZERO(&fds); ^ serialport.c:793:2: warning: implicit declaration of function ‘FD_SET’ [-Wimplicit-function-declaration] FD_SET(port->fd, &fds); ^ serialport.c:804:8: warning: implicit declaration of function ‘timercmp’ [-Wimplicit-function-declaration] if (timercmp(&now, &end, >)) ^ serialport.c:804:29: error: expected expression before ‘>’ token if (timercmp(&now, &end, >)) ^ serialport.c:807:4: warning: implicit declaration of function ‘timersub’ [-Wimplicit-function-declaration] timersub(&end, &now, &delta); ^ serialport.c:809:12: warning: implicit declaration of function ‘select’ [-Wimplicit-function-declaration] result = select(port->fd + 1, NULL, &fds, NULL, timeout_ms ? &delta : NULL); ^ serialport.c: In function ‘sp_blocking_read’: serialport.c:1005:2: error: unknown type name ‘fd_set’ fd_set fds; ^ serialport.c:1030:29: error: expected expression before ‘>’ token if (timercmp(&now, &end, >)) ^ serialport.c: In function ‘sp_blocking_read_next’: serialport.c:1143:2: error: unknown type name ‘fd_set’ fd_set fds; ^ serialport.c:1168:29: error: expected expression before ‘>’ token if (timercmp(&now, &end, >)) ^ serialport.c: In function ‘sp_output_waiting’: serialport.c:1303:22: error: ‘TIOCOUTQ’ undeclared (first use in this function) if (ioctl(port->fd, TIOCOUTQ, &bytes_waiting) < 0) ^ serialport.c:1303:22: note: each undeclared identifier is reported only once for each function it appears in serialport.c: In function ‘sp_wait’: serialport.c:1471:29: error: expected expression before ‘>’ token if (timercmp(&now, &end, >)) { ^ serialport.c:1476:57: error: expected expression before ‘>’ token if ((timeout_overflow = timercmp(&delta, &max_delta, >))) ^ make[1]: [Makefile:517: serialport.lo] Error 1 make: [Makefile:387: all] Error 2

The build script seems to use w32 socket head file under cygwin? And it's strange that no timercmp macro in /usr/include/sys/time.h ...

Any help needed pls tell me. Thanks!

mstranne commented 7 years ago

I got exactly the same problem, how did you fix it?

pt300 commented 6 years ago

See https://github.com/martinling/libserialport/issues/10#issuecomment-412968458 for info on the problem.

martinling commented 4 years ago

It's now possible to build on MSYS2/Cygwin64 with this branch: https://github.com/martinling/libserialport/commits/cygwin

Ports can be opened and used, but enumeration and port metadata (USB VID/PID etc) are not available, as we would need to go around Cygwin and call into the Windows API directly for this info. That can be done, but raises some issues about how to propagate errors correctly. See further comments here: https://sigrok.org/bugzilla/show_bug.cgi?id=963

For many purposes the MSYS2/MinGW-w64 environment is a better choice - this builds versions using the Windows API directly with all operations supported.

martinling commented 4 years ago

This is now fixed in upstream master.