[issue31748] configure fails to detect fchdir() using CFLAGS="-Werror -Wall"

STINNER Victor report at bugs.python.org
Tue Oct 10 17:14:24 EDT 2017


STINNER Victor <victor.stinner at gmail.com> added the comment:

I can reproduce the issue on Fedora 26:

haypo at selma$ ./configure CFLAGS="-Werror -Wall" 2>&1|tee log
haypo at selma$ grep fchdir log
checking for fchdir... no

The problem is not posixmodule.c. The problem is configure which emits a compiler warning.

configure.ac contains:
---
AC_MSG_CHECKING(for fchdir)
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <unistd.h>]], [[void *x=fchdir]])],
  [AC_DEFINE(HAVE_FCHDIR, 1, Define if you have the 'fchdir' function.)
   AC_MSG_RESULT(yes)],
  [AC_MSG_RESULT(no)
])
---

Extract of config.log, without the long confdefs.h part:
---
configure:11258: checking for fchdir
configure:11271: gcc -c -Werror -Wall -Wextra  conftest.c >&5
conftest.c: In function 'main':
conftest.c:256:7: error: unused variable 'x' [-Werror=unused-variable]
 void *x=fchdir
       ^
cc1: all warnings being treated as errors
configure:11271: $? = 1
configure: failed program was:
| /* confdefs.h */
| (...)
| /* end confdefs.h.  */
| #include <unistd.h>
| int
| main ()
| {
| void *x=fchdir
|   ;
|   return 0;
| }
configure:11278: result: no
---

----------
title: Modules/posixmodule.c: skip compiling jka4NaPmmQ37 and posix_fildes_fd -> configure fails to detect fchdir() using CFLAGS="-Werror -Wall"

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue31748>
_______________________________________


More information about the Python-bugs-list mailing list