Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Does not build with GCC 7.3.0 on Cygwin due to -Werror=sign-compare #1468

Closed
Bu11etmagnet opened this issue Sep 2, 2018 · 1 comment
Closed

Comments

@Bu11etmagnet
Copy link

Problem Description

Trying to build OpenSC on Cygwin fails.

Proposed Resolution

Write warning-free code.

Steps to reproduce

  1. git clone
  2. patch configure.ac (possibly a better solution to Cygwin/ssh with opensc-pkcs11.dll: Segmentation fault #607)
diff --git a/configure.ac b/configure.ac
index 3769757a..7fba83eb 100644
--- a/configure.ac
+++ b/configure.ac
@@ -104,7 +104,7 @@ case "${host}" in
                        WIN32="yes"
                else
                        AC_MSG_RESULT([Using cygwin])
-                       CPPFLAGS="${CPPFLAGS} -DCRYPTOKI_FORCE_WIN32"
+                       # CPPFLAGS="${CPPFLAGS} -DCRYPTOKI_FORCE_WIN32"
                        WIN_LIBPREFIX="cyg"
                        AC_DEFINE([USE_CYGWIN], [1], [Define if you are on Cygwin])
                fi

  1. ./bootstrap
  2. mkdir __build; cd __build; ../configure
  3. make -j4 -k
    ...
make[3]: Entering directory '/home/Csaba/workspace/OpenSC/__build/src/libopensc'
  CC       libopensc_la-reader-pcsc.lo
../../../src/libopensc/reader-pcsc.c: In function ‘pcsc_cancel’:
../../../src/libopensc/reader-pcsc.c:719:27: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
  if (gpriv->pcsc_wait_ctx != -1) {
                           ^~
../../../src/libopensc/reader-pcsc.c: In function ‘pcsc_wait_for_event’:
../../../src/libopensc/reader-pcsc.c:1501:27: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
  if (gpriv->pcsc_wait_ctx == -1) {
                           ^~
cc1: all warnings being treated as errors
make[3]: *** [Makefile:1313: libopensc_la-reader-pcsc.lo] Error 1
make[3]: Target 'all' not remade because of errors.
make[3]: Leaving directory '/home/Csaba/workspace/OpenSC/__build/src/libopensc'
Making all in pkcs11
make[3]: Entering directory '/home/Csaba/workspace/OpenSC/__build/src/pkcs11'
make[3]: *** No rule to make target '../../src/libopensc/libopensc.la', needed by 'opensc-pkcs11.la'.
make[3]: Target 'all' not remade because of errors.
make[3]: Leaving directory '/home/Csaba/workspace/OpenSC/__build/src/pkcs11'
Making all in tools
make[3]: Entering directory '/home/Csaba/workspace/OpenSC/__build/src/tools'
  CCLD     opensc-tool.exe
libtool:   error: cannot find the library '../../src/libopensc/libopensc.la' or unhandled argument '../../src/libopensc/libopensc.la'
make[3]: *** [Makefile:855: opensc-tool.exe] Error 1
  CCLD     opensc-explorer.exe
libtool:   error: cannot find the library '../../src/libopensc/libopensc.la' or unhandled argument '../../src/libopensc/libopensc.la'

The fact that it tried to make all in tools after building libopensc failed suggests a problem in the build system itself (libopensc should be a prerequisite of pkcs and tools).

$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-pc-cygwin/7.3.0/lto-wrapper.exe
Target: x86_64-pc-cygwin
Configured with: /cygdrive/i/szsz/tmpp/gcc/gcc-7.3.0-3.x86_64/src/gcc-7.3.0/configure --srcdir=/cygdrive/i/szsz/tmpp/gcc/gcc-7.3.0-3.x86_64/src/gcc-7.3.0 --prefix=/usr --exec-prefix=/usr --localstatedir=/var --sysconfdir=/etc --docdir=/usr/share/doc/gcc --htmldir=/usr/share/doc/gcc/html -C --build=x86_64-pc-cygwin --host=x86_64-pc-cygwin --target=x86_64-pc-cygwin --without-libiconv-prefix --without-libintl-prefix --libexecdir=/usr/lib --enable-shared --enable-shared-libgcc --enable-static --enable-version-specific-runtime-libs --enable-bootstrap --enable-__cxa_atexit --with-dwarf2 --with-tune=generic --enable-languages=ada,c,c++,fortran,lto,objc,obj-c++ --enable-graphite --enable-threads=posix --enable-libatomic --enable-libcilkrts --enable-libgomp --enable-libitm --enable-libquadmath --enable-libquadmath-support --disable-libssp --enable-libada --disable-symvers --with-gnu-ld --with-gnu-as --with-cloog-include=/usr/include/cloog-isl --without-libiconv-prefix --without-libintl-prefix --with-system-zlib --enable-linker-build-id --with-default-libstdcxx-abi=gcc4-compatible --enable-libstdcxx-filesystem-ts
Thread model: posix
gcc version 7.3.0 (GCC)

@frankmorgner
Copy link
Member

Feel free to make a pull request

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants