[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug-diffutils] bug#64811: Win-version now broken
From: |
Bruno Haible |
Subject: |
[bug-diffutils] bug#64811: Win-version now broken |
Date: |
Tue, 25 Jul 2023 15:45:16 +0200 |
Paul Eggert wrote:
> I don't use MS-Windows and won't be of much help on that platform.
> ...
> A few minutes ago I also installed a patch that causes diff -r to use
> readlinkat instead of readlink
I took a stab at it and attempted to compile diffutils with mingw 10.0.0
and with MSVC 14.30. Here are the compilation errors and link errors that
I encountered. I'm attaching a fix for all issues. With it, the build
succeeds, and there are
- 13 test failures on mingw,
- 14 test failures on MSVC.
1) A compilation error (both mingw and MSVC):
../../lib/cmpbuf.c: In function 'block_read':
../../lib/cmpbuf.c:87:17: error: 'SA_RESTART' undeclared (first use in this
function)
87 | if (! SA_RESTART && errno == EINTR)
| ^~~~~~~~~~
This is fixed by adding 'sigaction' to the list of gnulib modules.
2) A compilation error (both mingw and MSVC):
../../src/util.c: In function 'process_signals':
../../src/util.c:277:17: error: 'SIGSTOP' undeclared (first use in this
function)
277 | sig = SIGSTOP;
| ^~~~~~~
This is fixed by adding the same '#ifdef SIGTSTP' in the stop signal processing
as elsewhere in the file.
3) A compilation error (both mingw and MSVC):
../../src/util.c:308:5: error: 'SIGHUP' undeclared here (not in a function)
308 | SIGHUP, SIGINT, SIGPIPE,
| ^~~~~~
../../src/util.c:308:21: error: 'SIGPIPE' undeclared here (not in a function);
did you mean 'SIGFPE'?
308 | SIGHUP, SIGINT, SIGPIPE,
| ^~~~~~~
| SIGFPE
This is fixed by adding #ifdefs for the use of these signal names.
For SIGPIPE, an alternative would be to use the gnulib module 'signal-h',
but that feels like overkill here.
4) A compilation error (mingw) or link error (MSVC):
../../src/diff.c: In function 'compare_files':
../../src/diff.c:1412:58: error: 'readlinkat' undeclared (first use in this
function); did you mean 'careadlinkat'?
1412 | nullptr, readlinkat);
| ^~~~~~~~~~
| careadlinkat
This is fixed by adding 'readlinkat' to the list of gnulib modules.
5) Link errors (on MSVC):
diff3.obj : error LNK2019: unresolved external symbol popen referenced in
function read_diff
diff3.obj : error LNK2019: unresolved external symbol pclose referenced in
function read_diff
sdiff.obj : error LNK2019: unresolved external symbol popen referenced in
function main
sdiff.obj : error LNK2019: unresolved external symbol pclose referenced in
function main
This is fixed by adding 'popen' and 'pclose' to the list of gnulib modules.
6) A link error (on MSVC) regarding readdir.
This is fixed by adding 'readdir' to the list of gnulib modules.
7) A link error (on mingw):
/usr/lib/gcc/x86_64-w64-mingw32/11/../../../../x86_64-w64-mingw32/bin/ld:
../lib/libdiffutils.a(libdiffutils_a-strerror.o): in function `memcpy':
/usr/x86_64-w64-mingw32/sys-root/mingw/include/string.h:202: undefined
reference to `__memcpy_chk'
/usr/lib/gcc/x86_64-w64-mingw32/11/../../../../x86_64-w64-mingw32/bin/ld:
../lib/libdiffutils.a(libdiffutils_a-strerror.o): in function `sprintf':
/usr/x86_64-w64-mingw32/sys-root/mingw/include/stdio.h:386: undefined reference
to `__chk_fail'
/usr/lib/gcc/x86_64-w64-mingw32/11/../../../../x86_64-w64-mingw32/bin/ld:
../lib/libdiffutils.a(libdiffutils_a-localcharset.o): in function `strcpy':
/usr/x86_64-w64-mingw32/sys-root/mingw/include/string.h:228: undefined
reference to `__strcpy_chk'
/usr/lib/gcc/x86_64-w64-mingw32/11/../../../../x86_64-w64-mingw32/bin/ld:
../lib/libdiffutils.a(libdiffutils_a-localcharset.o): in function `sprintf':
/usr/x86_64-w64-mingw32/sys-root/mingw/include/stdio.h:386: undefined reference
to `__chk_fail'
collect2: error: ld returned 1 exit status
make[2]: *** [Makefile:2013: cmp.exe] Error 1
Apparently the _FORTIFY_SOURCE support in mingw is experimental. Other
people have noticed it as well:
https://github.com/msys2/MINGW-packages/issues/5868
The fix is to not define _FORTIFY_SOURCE on this platform. Done in
configure.ac.
Bruno
0001-maint-Fix-build-failures-mingw-10-and-MSVC-14.30.patch
Description: Text Data