Mbed-TLS / mbedtls

An open source, portable, easy to use, readable and flexible TLS library, and reference implementation of the PSA Cryptography API. Releases are on a varying cadence, typically around 3 - 6 months between releases.
https://www.trustedfirmware.org/projects/mbed-tls/
Other
5.52k stars 2.6k forks source link

Build error on Cygwin/MinGW-w64 #525

Closed wildart closed 8 years ago

wildart commented 8 years ago

I have following error during building mbedtls 2.2.1 on Cygwin/MinGW-w64 (x86 platform)

[ 15%] Building C object library/CMakeFiles/mbedcrypto.dir/threading.c.obj
[ 15%] Building C object library/CMakeFiles/mbedcrypto.dir/timing.c.obj
In file included from /usr/i686-w64-mingw32/sys-root/mingw/include/winsock.h:36:0,
                 from /usr/i686-w64-mingw32/sys-root/mingw/include/windows.h:92,
                 from /home/user/Development/mbedtls-bfafadb45daf8d2114e3109e2f9021fc72ee36bb/library/timing.c:49:
/usr/i686-w64-mingw32/sys-root/mingw/include/psdk_inc/_fd_types.h:100:2: warning: #warning "fd_set and associated macros have been defined in sys/types.
      This can cause runtime problems with W32 sockets" [-Wcpp]
 #warning "fd_set and associated macros have been defined in sys/types.  \
  ^
In file included from /usr/i686-w64-mingw32/sys-root/mingw/include/windows.h:92:0,
                 from /home/user/Development/mbedtls-bfafadb45daf8d2114e3109e2f9021fc72ee36bb/library/timing.c:49:
/usr/i686-w64-mingw32/sys-root/mingw/include/winsock.h:299:34: error: conflicting types for ‘select’
   WINSOCK_API_LINKAGE int WSAAPI select(int nfds,fd_set *readfds,fd_set *writefds,fd_set *exceptfds,const PTIMEVAL timeout);
                                  ^
In file included from /usr/include/sys/types.h:68:0,
                 from /usr/include/stdio.h:48,
                 from /home/user/Development/mbedtls-bfafadb45daf8d2114e3109e2f9021fc72ee36bb/include/mbedtls/platform.h:47,
                 from /home/user/Development/mbedtls-bfafadb45daf8d2114e3109e2f9021fc72ee36bb/library/timing.c:31:
/usr/include/sys/select.h:73:5: note: previous declaration of ‘select’ was here
 int select __P ((int __n, fd_set *__readfds, fd_set *__writefds,
     ^

cmake configuration:

cmake /home/user/Development/mbedtls-bfafadb45daf8d2114e3109e2f9021fc72ee36bb/ \
-DCMAKE_INSTALL_PREFIX:PATH=/home/user/usr \
-DCMAKE_C_COMPILER="i686-w64-mingw32-gcc" -DCMAKE_C_COMPILER_ARG1="-m32 " \
-DCMAKE_CXX_COMPILER="i686-w64-mingw32-g++" -DCMAKE_CXX_COMPILER_ARG1="-m32 " \
-DCMAKE_SYSTEM_NAME=Windows -DCMAKE_RC_COMPILER=`which i686-w64-mingw32-windres` \
-DUSE_SHARED_MBEDTLS_LIBRARY=ON -DENABLE_PROGRAMS=OFF \
-DENABLE_ZLIB_SUPPORT=ON -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_RPATH=/home/user/usr -DCMAKE_INSTALL_RPATH_USE_LINK_PATH=TRUE
$ i686-w64-mingw32-gcc -v
Using built-in specs.
COLLECT_GCC=i686-w64-mingw32-gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/i686-w64-mingw32/5.3.0/lto-wrapper.exe
Target: i686-w64-mingw32
Configured with: /cygdrive/i/szsz/tmpp/cygwin64/mingw64-i686/mingw64-i686-gcc-5.3.0-1.i686/src/gcc-5.3.0/configure --srcdir=/cygdrive/i/szsz/tmpp/cygwin64/mingw64-i686/mingw64-i686-gcc-5.3.0-1.i686/src/gcc-5.3.0 --prefix=/usr --exec-prefix=/usr --localstatedir=/var --sysconfdir=/etc --docdir=/usr/share/doc/mingw64-i686-gcc --htmldir=/usr/share/doc/mingw64-i686-gcc/html -C --build=i686-pc-cygwin --host=i686-pc-cygwin --target=i686-w64-mingw32 --without-libiconv-prefix --without-libintl-prefix --with-sysroot=/usr/i686-w64-mingw32/sys-root --with-build-sysroot=/usr/i686-w64-mingw32/sys-root --disable-multilib --disable-win32-registry --enable-languages=c,ada,c++,fortran,lto,objc,obj-c++ --enable-fully-dynamic-string --enable-graphite --enable-libgomp --enable-libquadmath --enable-libquadmath-support --enable-libssp --enable-version-specific-runtime-libs --with-dwarf2 --with-gnu-ld --with-gnu-as --with-tune=generic --with-cloog-include=/usr/include/cloog-isl --with-system-zlib --libexecdir=/usr/lib
Thread model: win32
gcc version 5.3.0 (GCC)

Update: Same error when building version 2.3.0

wildart commented 8 years ago

When I disabled zlib support, it was built without errors.