[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
flockfile undefined on Mingw64 platform
From: |
Daniel P. Berrange |
Subject: |
flockfile undefined on Mingw64 platform |
Date: |
Thu, 11 May 2017 16:18:00 +0100 |
User-agent: |
Mutt/1.8.0 (2017-02-23) |
I'm trying to build libvirt with the latest GNULIB git master, on Mingw64
platform (Fedora 25 based).
I get compile warnings:
getopt.c: In function 'process_long_option':
getopt.c:281:5: warning: implicit declaration of function 'flockfile'
[-Wimplicit-function-declaration]
flockfile (stderr);
^~~~~~~~~
getopt.c:295:5: warning: implicit declaration of function 'funlockfile'
[-Wimplicit-function-declaration]
funlockfile (stderr);
^~~~~~~~~~~
gettimeofday.c:42:1: warning: 'initialize' defined but not used
[-Wunused-function]
initialize (void)
^~~~~~~~~~
and then link failures
../gnulib/lib/.libs/libgnu.a(getopt.o): In function `process_long_option':
/home/berrange/src/virt/libvirt/gnulib/lib/getopt.c:281: undefined reference to
`flockfile'
/home/berrange/src/virt/libvirt/gnulib/lib/getopt.c:295: undefined reference to
`funlockfile'
collect2: error: ld returned 1 exit status
Makefile:6361: recipe for target 'libvirt.la' failed
Looks like this is probably caused by this:
commit dcfe5a0e9cae998ae4e6480f357ff4af5e60fdf8
Author: Zack Weinberg <address@hidden>
Date: Thu Apr 6 11:14:14 2017 -0700
getopt: clean up error reporting
getopt can print a whole bunch of error messages, and when used
standalone (from gnulib) it uses fprintf to do that. But fprintf is a
cancellation point and getopt isn't, and also applying fprintf to a
stream in wide-character mode is not allowed. So every single error
reporting case has an #ifdef _LIBC block in which it calls internal
libc functions instead. The counterpart patch series in glibc makes
it possible to simplify all of that down to a set of #defines at the
top of the file; core code is written as if it is safe to just call
fprintf, flockfile, and funlockfile. (One caveat: it's *not* safe to
call any *other* stdio functions.)
* lib/getopt.c: When _LIBC is defined, define fprintf to
__fxprintf_nocancel, flockfile to _IO_flockfile, and funlockfile
to _IO_funlockfile. When neither _LIBC nor
_POSIX_THREAD_SAFE_FUNCTIONS is defined, define flockfile and
funlockfile as no-ops.
(_getopt_internal_r): Remove all internal #ifdef _LIBC blocks; the
standalone error-printing code can now be used for libc as well.
Add an flockfile/funlockfile pair around one case where the error
message is printed in several chunks. Don't use fputc.
That code defines flockfile/funlockfile to no-ops, when
_POSIX_THREAD_SAFE_FUNCTIONS is *not* defined.
Unfortunately Mingw defines it in time.h and pthread_unistd.h, but does
*not* provide flockfile afaict.
Regards,
Daniel
--
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o- https://fstop138.berrange.com :|
|: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
- flockfile undefined on Mingw64 platform,
Daniel P. Berrange <=