[Bug 53930] New: Build broken with Clang in MSVC mode due to OpenLDAP import using getopt.h
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(a)winehq.org Reporter: martin(a)martin.st CC: hans(a)meelstraat.net, jacek(a)codeweavers.com, julliard(a)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.) -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
https://bugs.winehq.org/show_bug.cgi?id=53930 Martin Storsjö <martin(a)martin.st> changed: What |Removed |Added ---------------------------------------------------------------------------- Regression SHA1| |02e52db7aa627b980dec3dfd405 | |3e20a380ee555 -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
https://bugs.winehq.org/show_bug.cgi?id=53930 --- Comment #1 from Hans Leidekker <hans(a)meelstraat.net> --- Looks like we don't actually need that header. That is, the fallback to getopt-compat.h to seems to be sufficient here. Does the build succeed if you remove the define? -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
https://bugs.winehq.org/show_bug.cgi?id=53930 --- Comment #2 from Martin Storsjö <martin(a)martin.st> --- (In reply to Hans Leidekker from comment #1)
Looks like we don't actually need that header. That is, the fallback to getopt-compat.h to seems to be sufficient here. Does the build succeed if you remove the define?
I tried that, but getopt-compat.h isn't included among the minimal set of openldap sources imported in the tree. (I didn't try to go find that file yet.) -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
https://bugs.winehq.org/show_bug.cgi?id=53930 --- Comment #3 from Hans Leidekker <hans(a)meelstraat.net> --- Created attachment 73490 --> https://bugs.winehq.org/attachment.cgi?id=73490 getopt-compat.h Here's the header. I can also take a look if you show me how you configure Wine for Clang/MSVC. -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
https://bugs.winehq.org/show_bug.cgi?id=53930 --- Comment #4 from Martin Storsjö <martin(a)martin.st> --- (In reply to Hans Leidekker from comment #3)
Created attachment 73490 [details] getopt-compat.h
Here's the header. I can also take a look if you show me how you configure Wine for Clang/MSVC.
Thanks! With this header, and removing those defines from portable.h, the build proceeds, but then hits another error; libs/ldap/libldap/init.c does a call to atexit() when built in !defined(__GNUC__) mode, and none of the import libs linked here provide atexit. To configure Wine for Clang/MSVC, just configure with --with-mingw=clang, and it will try to execute clang with "-target <arch>-windows" (which implies MSVC mode). If you otherwise have all the Clang/lld/llvm-dlltool executables available, this should work and produce a successful build (I test it daily in aarch64 configurations, but x86_64 should probably work just as well). -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
https://bugs.winehq.org/show_bug.cgi?id=53930 Hans Leidekker <hans(a)meelstraat.net> changed: What |Removed |Added ---------------------------------------------------------------------------- Fixed by SHA1| |07cb943d6a6ca4f7b6cd635a68b | |02e2423c957b0 Status|UNCONFIRMED |RESOLVED Resolution|--- |FIXED --- Comment #5 from Hans Leidekker <hans(a)meelstraat.net> --- Fixed with cd2e3d1f54cc957a624b4186fcb9de2349a33163 and 07cb943d6a6ca4f7b6cd635a68b02e2423c957b0. -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
https://bugs.winehq.org/show_bug.cgi?id=53930 Hans Leidekker <hans(a)meelstraat.net> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |regression -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
https://bugs.winehq.org/show_bug.cgi?id=53930 Alexandre Julliard <julliard(a)winehq.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |CLOSED --- Comment #6 from Alexandre Julliard <julliard(a)winehq.org> --- Closing bugs fixed in 7.22. -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
participants (1)
-
WineHQ Bugzilla