On AIX 7.3 building gnupg from the master branch using ./configure --sysconfdir=/etc --enable-maintainer-mode && make the test suite causes the build to fail. Here is the error:
gcc -DHAVE_CONFIG_H -I. -I../.. -I../../common -DLOCALEDIR=\"/usr/local/share/locale\" -DGNUPG_BINDIR="\"/usr/local/bin\"" -DGNUPG_LIBEXECDIR="\"/usr/local/libexec\"" -DGNUPG_LIBDIR="\"/usr/local/lib/gnupg\"" -DGNUPG_DATADIR="\"/usr/local/share/gnupg\"" -DGNUPG_SYSCONFDIR="\"/etc/gnupg\"" -DGNUPG_LOCALSTATEDIR="\"/usr/local/var\"" -imacros scheme-config.h -I/home/collinfunk/tmp/include -I/home/collinfunk/tmp/include -I/home/collinfunk/tmp/include -O3 -Wall -Wcast-align -Wshadow -Wstrict-prototypes -Wformat -Wno-format-y2k -Wformat-security -W -Wno-sign-compare -Wno-format-zero-length -Wno-missing-field-initializers -Wdeclaration-after-statement -Wlogical-op -Wvla -Wno-pointer-sign -Wpointer-arith -g -O2 -MT gpgscm-ffi.o -MD -MP -MF .deps/gpgscm-ffi.Tpo -c -o gpgscm-ffi.o `test -f 'ffi.c' || echo './'`ffi.c In file included from ffi.c:54: ffi.c: In function 'ffi_init': ffi-private.h:100:30: error: 'do_open64' undeclared (first use in this function); did you mean 'do_open'? 100 | mk_foreign_func ((SC), (do_##F))); \ | ^~~ ffi-private.h:110:5: note: in expansion of macro 'ffi_define_function_name' 110 | ffi_define_function_name ((SC), _name, F); \ | ^~~~~~~~~~~~~~~~~~~~~~~~ ffi.c:1670:3: note: in expansion of macro 'ffi_define_function' 1670 | ffi_define_function (sc, open); | ^~~~~~~~~~~~~~~~~~~ ffi-private.h:100:30: note: each undeclared identifier is reported only once for each function it appears in 100 | mk_foreign_func ((SC), (do_##F))); \ | ^~~ ffi-private.h:110:5: note: in expansion of macro 'ffi_define_function_name' 110 | ffi_define_function_name ((SC), _name, F); \ | ^~~~~~~~~~~~~~~~~~~~~~~~ ffi.c:1670:3: note: in expansion of macro 'ffi_define_function' 1670 | ffi_define_function (sc, open); | ^~~~~~~~~~~~~~~~~~~ At top level: ffi.c:276:1: warning: 'do_open' defined but not used [-Wunused-function] 276 | do_open (scheme *sc, pointer args) | ^~~~~~~ make[3]: *** [Makefile:615: gpgscm-ffi.o] Error 1
This is because open is defined to open64 on this platform in /usr/include/fcntl.h which causes the macro expansion to be do_open64 instead of do_open. Since ffi_init is at the bottom of this file and the open function is never used again, we can just undefine it.