I'm facing the same bug as reported in

- https://lists.gnu.org/archive/html/bug-make/2020-01/msg00060.html


Mingw 7 comes with its own definitions of fcntl() which conflict with those in 
the windows related files in make.

x86_64-w64-mingw32-gcc -DHAVE_CONFIG_H   -Isrc 
-I/Host/Users/ilg/Work/windows-build-tools-4.3.0-1/win32-x64/sources/make-4.3/src
 -Ilib 
-I/Host/Users/ilg/Work/windows-build-tools-4.3.0-1/win32-x64/sources/make-4.3/lib
 
-DLIBDIR=\"/Host/Users/ilg/Work/windows-build-tools-4.3.0-1/win32-x64/install/make-4.3/lib\"
 
-DINCLUDEDIR=\"/Host/Users/ilg/Work/windows-build-tools-4.3.0-1/win32-x64/install/make-4.3/include\"
 
-DLOCALEDIR=\"/Host/Users/ilg/Work/windows-build-tools-4.3.0-1/win32-x64/install/make-4.3/share/locale\"
 -I 
/Host/Users/ilg/Work/windows-build-tools-4.3.0-1/win32-x64/sources/make-4.3/src/w32/include
   -ffunction-sections -fdata-sections -pipe -m64 -O2 -MT src/arscan.o -MD -MP 
-MF $depbase.Tpo -c -o src/arscan.o 
/Host/Users/ilg/Work/windows-build-tools-4.3.0-1/win32-x64/sources/make-4.3/src/arscan.c
 &&\
mv -f $depbase.Tpo $depbase.Po
In file included from 
/Host/Users/ilg/Work/windows-build-tools-4.3.0-1/win32-x64/sources/make-4.3/src/arscan.c:379:
/Host/Users/ilg/Work/windows-build-tools-4.3.0-1/win32-x64/sources/make-4.3/src/output.h:70:
 warning: "F_GETFD" redefined
   70 | #  define F_GETFD 1
      | 
In file included from 
/Host/Users/ilg/Work/windows-build-tools-4.3.0-1/win32-x64/sources/make-4.3/src/makeint.h:359,
                 from 
/Host/Users/ilg/Work/windows-build-tools-4.3.0-1/win32-x64/sources/make-4.3/src/arscan.c:17:
lib/fcntl.h:684: note: this is the location of the previous definition
  684 | # define F_GETFD 2
      | 
In file included from 
/Host/Users/ilg/Work/windows-build-tools-4.3.0-1/win32-x64/sources/make-4.3/src/arscan.c:379:
/Host/Users/ilg/Work/windows-build-tools-4.3.0-1/win32-x64/sources/make-4.3/src/output.h:92:5:
 error: conflicting types for ‘fcntl’
   92 | int fcntl (intptr_t fd, int cmd, ...);
      |     ^~~~~
In file included from /opt/xbb/usr/x86_64-w64-mingw32/include/io.h:10,
                 from /opt/xbb/usr/x86_64-w64-mingw32/include/sys/stat.h:14,
                 from 
/Host/Users/ilg/Work/windows-build-tools-4.3.0-1/win32-x64/sources/make-4.3/src/makeint.h:72,
                 from 
/Host/Users/ilg/Work/windows-build-tools-4.3.0-1/win32-x64/sources/make-4.3/src/arscan.c:17:
lib/fcntl.h:595:1: note: previous declaration of ‘fcntl’ was here
  595 | _GL_FUNCDECL_SYS (fcntl, int, (int fd, int action, ...));
      | ^~~~~~~~~~~~~~~~
make[1]: *** [Makefile:1356: src/arscan.o] Error 1
make[1]: Leaving directory '/tmp/win32-x64/build/make-4.3'
make: *** [Makefile:1442: all-recursive] Error 1

Removing the conflicting defines in output.h would be easy, but switching to 
the mingw implementation is not that easy, since in POSIX the definition uses 
an int for the file descriptor: 

int
fcntl(int fildes, int cmd, ...);


while make uses an intptr_t:

int fcntl (intptr_t fd, int cmd, ...);



If, for any reasons, make needs it with intptr_t, I think it should not use the 
standard fcntl() name, but a specific one (like x_fcntl()), and when building 
on mingw to keep the current implementation, since the mingw one does not 
provide support for F_SETLKW.


Please let me know if there was any progress on this issue, and perhaps if 
using mingw 8 improved things.


Regards,

Liviu









Reply via email to