https://bugs.winehq.org/show_bug.cgi?id=53930
Bug ID: 53930 Summary: Build broken with Clang in MSVC mode due to OpenLDAP import using getopt.h Product: Wine Version: unspecified Hardware: x86-64 OS: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: wldap32 Assignee: wine-bugs@winehq.org Reporter: martin@martin.st CC: hans@meelstraat.net, jacek@codeweavers.com, julliard@winehq.org Distribution: ---
Building with Clang in MSVC mode fails since the OpenLDAP code import. Building fails with this error:
clang -c -o libs/ldap/aarch64-windows/liblber/io.o ../src/libs/ldap/liblber/io.c -Ilibs/ldap -I../src/libs/ldap -Iinclude \ -I../src/include -I../src/include/msvcrt -I../src/libs/ldap/include -D_TIMEVAL_DEFINED -D_UCRT \ -D__WINE_PE_BUILD -target aarch64-windows -fno-strict-aliasing -Wno-pragma-pack -Wno-format \ -gdwarf-4 -g -O2 In file included from ../src/libs/ldap/liblber/io.c:41: ../src/libs/ldap/include/ac/unistd.h:44:11: fatal error: 'getopt.h' file not found # include <getopt.h> ^~~~~~~~~~ 1 error generated. make: *** [Makefile:197943: libs/ldap/aarch64-windows/liblber/io.o] Error 1
The bundled libs/ldap/include/portable.h contains "#define HAVE_GETOPT_H 1". For mingw-based PE builds, this succeeds by including getopt.h from the mingw toolchain (which probably isn't intended?), while if building with Clang in MSVC mode, no such header is available.
(Side note: When building with a mingw compiler like this, it would probably be good to avoid having the mingw sysroot includes available, to avoid accidentally using headers from there. But one can't just use -nostdinc, since that also excludes paths like the compiler's own headers, like stdarg.h. Something like --sysroot=dummy might work.)