[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Gnulib's getopt.c fails to compile with MinGW
From: |
Christian Egli |
Subject: |
Gnulib's getopt.c fails to compile with MinGW |
Date: |
Fri, 28 Apr 2017 15:51:11 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) |
Building the an updated version of liblouis with Ubuntu 16.10 LTS
i686-w64-mingw32-gcc fails:
i686-w64-mingw32-gcc -DHAVE_CONFIG_H -I. -I../liblouis -I../liblouis
-I../tools/gnulib -I../tools/gnulib -g -O2 -Wl,--add-stdcall-alias -MT
lou_allround.o -MD -MP -MF .deps/lou_allround.Tpo -c -o lou_allround.o
lou_allround.c
mv -f .deps/lou_allround.Tpo .deps/lou_allround.Po
/bin/bash ../libtool --tag=CC --mode=link i686-w64-mingw32-gcc -g -O2
-Wl,--add-stdcall-alias -avoid-version -Xcompiler -static-libgcc -o
lou_allround.exe lou_allround.o ../liblouis/liblouis.la
../tools/gnulib/libgnutools.la ../tools/libbrlcheck.la
libtool: link: i686-w64-mingw32-gcc -g -O2 -Wl,--add-stdcall-alias
-static-libgcc -o .libs/lou_allround.exe lou_allround.o
../liblouis/.libs/liblouis.dll.a ../tools/gnulib/.libs/libgnutools.a
../tools/.libs/libbrlcheck.a
/home/eglic/src/liblouis/liblouis/.libs/liblouis.dll.a
-L/tmp/liblouis-mingw32/lib
../tools/gnulib/.libs/libgnutools.a(getopt.o): In function
`process_long_option':
/home/eglic/src/liblouis/tools/gnulib/getopt.c:281: undefined reference to
`flockfile'
/home/eglic/src/liblouis/tools/gnulib/getopt.c:295: undefined reference to
`funlockfile'
collect2: error: ld returned 1 exit status
Makefile:1091: recipe for target 'lou_allround.exe' failed
This happens because gnulib/lib/getopt.c does this:
/* When used standalone, flockfile and funlockfile might not be
available. */
# ifndef _POSIX_THREAD_SAFE_FUNCTIONS
# define flockfile(fp) /* nop */
# define funlockfile(fp) /* nop */
# endif
But Ubuntu's mingw-w64-common package defines
_POSIX_THREAD_SAFE_FUNCTIONS in
/usr/share/mingw-w64/include/pthread_unistd.h (line:150). Unfortunately
flockfile itself is not defined.
I propose the following to fix this similar to how it is done in
getdelim.c:
diff --git a/lib/getopt.c b/lib/getopt.c
index 543c8e7..84f80d3 100644
--- a/lib/getopt.c
+++ b/lib/getopt.c
@@ -45,7 +45,7 @@
# define _(msgid) gettext (msgid)
/* When used standalone, flockfile and funlockfile might not be
available. */
-# ifndef _POSIX_THREAD_SAFE_FUNCTIONS
+# if !HAVE_FLOCKFILE || !HAVE_FUNLOCKFILE
# define flockfile(fp) /* nop */
# define funlockfile(fp) /* nop */
# endif
--
Christian Egli
Swiss Library for the Blind, Visually Impaired and Print Disabled
Grubenstrasse 12, CH-8045 Zürich, Switzerland
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Gnulib's getopt.c fails to compile with MinGW,
Christian Egli <=