https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79771

            Bug ID: 79771
           Summary: in-tree zlib breaks build
           Product: gcc
           Version: 7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: regression
          Assignee: unassigned at gcc dot gnu.org
          Reporter: daniel.santos at pobox dot com
  Target Milestone: ---

Built from the head on Windows 7 using cywgin64.

Configured with:
/home/daniel/proj/sys/gcc/work0/configure --host=x86_64-pc-cygwin
--build=x86_64-pc-cygwin --target=x86_64-pc-cygwin
--prefix=/home/daniel/local/gcc-head-test-unpatched-cygwin64
--enable-stage1-checking=yes,rtl --enable-libssp --enable-libada --enable-lto
--enable-gold=yes --enable-ld=yes --enable-bootstrap



make[3]: Entering directory
'/home/daniel/proj/sys/gcc/work0/build/head-test-unpatched-cygwin64/gcc'
/home/daniel/proj/sys/gcc/work0/build/head-test-unpatched-cygwin64/./prev-gcc/xg++
-B/home/daniel/proj/sys/gcc/work0/build/head-test-unpatched-cygwin64/./prev-gcc/
-B/home/daniel/local/gcc-head-test-unpatched-cygwin64/x86_64-pc-cygwin/bin/
-nostdinc++
-B/home/daniel/proj/sys/gcc/work0/build/head-test-unpatched-cygwin64/prev-x86_64-pc-cygwin/libstdc++-v3/src/.libs
-B/home/daniel/proj/sys/gcc/work0/build/head-test-unpatched-cygwin64/prev-x86_64-pc-cygwin/libstdc++-v3/libsupc++/.libs

-I/home/daniel/proj/sys/gcc/work0/build/head-test-unpatched-cygwin64/prev-x86_64-pc-cygwin/libstdc++-v3/include/x86_64-pc-cygwin

-I/home/daniel/proj/sys/gcc/work0/build/head-test-unpatched-cygwin64/prev-x86_64-pc-cygwin/libstdc++-v3/include
 -I/home/daniel/proj/sys/gcc/work0/libstdc++-v3/libsupc++
-L/home/daniel/proj/sys/gcc/work0/build/head-test-unpatched-cygwin64/prev-x86_64-pc-cygwin/libstdc++-v3/src/.libs
-L/home/daniel/proj/sys/gcc/work0/build/head-test-unpatched-cygwin64/prev-x86_64-pc-cygwin/libstdc++-v3/libsupc++/.libs
-no-pie   -g -O2 -gtoggle -DIN_GCC     -fno-exceptions -fno-rtti
-fasynchronous-unwind-tables -W -Wall -Wno-narrowing -Wwrite-strings
-Wcast-qual -Wmissing-format-attribute -Woverloaded-virtual -pedantic
-Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -Werror -fno-common
 -DHAVE_CONFIG_H -static-libstdc++ -static-libgcc -Wl,--stack,12582912 -o
f951.exe \
        fortran/arith.o fortran/array.o fortran/bbt.o fortran/check.o
fortran/class.o fortran/constructor.o fortran/cpp.o fortran/data.o
fortran/decl.o fortran/dump-parse-tree.o fortran/error.o fortran/expr.o
fortran/interface.o fortran/intrinsic.o fortran/io.o fortran/iresolve.o
fortran/match.o fortran/matchexp.o fortran/misc.o fortran/module.o
fortran/openmp.o fortran/options.o fortran/parse.o fortran/primary.o
fortran/resolve.o fortran/scanner.o fortran/simplify.o fortran/st.o
fortran/symbol.o fortran/target-memory.o  fortran/convert.o
fortran/dependency.o fortran/f95-lang.o fortran/trans.o fortran/trans-array.o
fortran/trans-common.o fortran/trans-const.o fortran/trans-decl.o
fortran/trans-expr.o fortran/trans-intrinsic.o fortran/trans-io.o
fortran/trans-openmp.o fortran/trans-stmt.o fortran/trans-types.o
fortran/frontend-passes.o libbackend.a main.o libcommon-target.a libcommon.a
../libcpp/libcpp.a ../libdecnumber/libdecnumber.a -L./../zlib -lz libcommon.a
../libcpp/libcpp.a -lintl  ../libbacktrace/.libs/libbacktrace.a
../libiberty/libiberty.a ../libdecnumber/libdecnumber.a  attribs.o \
         -lmpc -lmpfr -lgmp   -L./../zlib -lz
./../zlib/libz.a(libz_a-gzlib.o):gzlib.c:(.text+0x646): undefined reference to
`_wopen'
./../zlib/libz.a(libz_a-gzlib.o):gzlib.c:(.text+0x646): relocation truncated to
fit: R_X86_64_PC32 against undefined symbol `_wopen'
collect2: error: ld returned 1 exit status
make[3]: *** [/home/daniel/proj/sys/gcc/work0/gcc/fortran/Make-lang.in:97:
f951.exe] Error 1
make[3]: Leaving directory
'/home/daniel/proj/sys/gcc/work0/build/head-test-unpatched-cygwin64/gcc'
make[2]: *** [Makefile:4585: all-stage2-gcc] Error 2
make[2]: Leaving directory
'/home/daniel/proj/sys/gcc/work0/build/head-test-unpatched-cygwin64'
make[1]: *** [Makefile:21590: stage2-bubble] Error 2
make[1]: Leaving directory
'/home/daniel/proj/sys/gcc/work0/build/head-test-unpatched-cygwin64'
make: *** [Makefile:21802: bootstrap] Error 2

This appears to be due to 1e5dce21ca754450ca2bb1481aed0f5ee62560b8 (in the git
mirror) committed on 2017-01-13.  I think the problem caused by this chunk:

@@ -239,7 +239,7 @@ local gzFile gz_open(path, fd, mode)

     /* open the file with the appropriate flags (or just use fd) */
     state->fd = fd > -1 ? fd : (
-#ifdef _WIN32
+#ifdef WIDECHAR
         fd == -2 ? _wopen(path, oflag, 0666) :
 #endif
         open((const char *)path, oflag, 0666));

WIDECHAR defined in gzguts.h as follows:

@@ -35,6 +39,10 @@
 #  include <io.h>
 #endif

+#if defined(_WIN32) || defined(__CYGWIN__)
+#  define WIDECHAR
+#endif
+
 #ifdef WINAPI_FAMILY
 #  define open _open
 #  define read _read


I don't know Cygwin's architecture well, but I'm guessing that we don't have
_wopen when __CYGWIN__ is defined?  I'm guessing that --with-system-zlib will
get me around this problem for now.

Reply via email to