https://bugs.winehq.org/show_bug.cgi?id=38886
--- Comment #14 from Martin Storsjö martin@martin.st --- (In reply to Patrick from comment #13)
I'm using following configure command, after I've sourced the environment file:
../configure --enable-win64 --with-alsa CC="ccache /opt/tdx-xwayland/2.6.3/sysroots/x86_64-tdxsdk-linux/usr/bin/aarch64-tdx- linux/aarch64-tdx-linux-gcc --sysroot=/opt/tdx-xwayland/2.6.3/sysroots/aarch64-tdx-linux" CXX="ccache /opt/tdx-xwayland/2.6.3/sysroots/x86_64-tdxsdk-linux/usr/bin/aarch64-tdx- linux/aarch64-tdx-linux-gcc --sysroot=/opt/tdx-xwayland/2.6.3/sysroots/aarch64-tdx-linux" LD=/opt/tdx-xwayland/2.6.3/sysroots/x86_64-tdxsdk-linux/usr/bin/aarch64-tdx- linux/aarch64-tdx-linux-ld 'CFLAGS=-Og -gdwarf-4 --sysroot=/opt/tdx-xwayland/2.6.3/sysroots/aarch64-tdx-linux' 'CROSSCFLAGS=-Og -gdwarf-4' 'LDFLAGS=--sysroot=/opt/tdx-xwayland/2.6.3/sysroots/aarch64-tdx-linux -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed' --host=aarch64-tdx-linux --with-wine-tools=../build-g-7.21 FREETYPE_CFLAGS=-I/opt/tdx-xwayland/2.6.3/sysroots/aarch64-tdx-linux/usr/ include/freetype2 --without-gnutls --prefix=/opt/tdx-xwayland/2.6.3/wine --disable-win16 --disable-wow64 --disable-wow64win --disable-wow64cpu
GCC: aarch64-tdx-linux-gcc (GCC) 8.2.0 Clang: clang version 15.0.0 (4ba6a9c9f65bbc8bd06e3652cb20fd4dfc846137)
I've noticed that specifying the "--sysroot" parameter in CROSSCFLAGS as well breaks the build completely in my case. (Binary builds, but can't load DLLs, strings are corrupted. e.g tries to load "n.drv" instead of "winex11.drv")
Currently, the Wine build is done by building some parts with the regular aarch64-linux cross compiler (which can be either GCC or Clang), and some parts with an aarch64-pe targeting compiler (which only is supported by Clang at the moment). For other targets, it's possible to build everything with the linux-targeting compiler, which used to be the traditional way Wine is set up, but for aarch64 this configuration is no longer supported.
For the PE bits, if nothing is specified, iirc the configure script first looks for "aarch64-w64-mingw32-clang" and if not found, it checks if "clang --target=aarch64-windows" works; both run mostly the same code, but there are vague differences for how things are linked.
I presume that if you include that parameter in CROSSCFLAGS, it ends up used for building/linking the PE parts of the build too, and that's probably not desired at all.
So if I understood correctly, using gcc (for CC) AND llvm-mingw's clang through winegcc (for "CROSSCC"), as well as only using clang the build should actually work?
Yes
If that's the case, I would try it again by emulating the target machine, setup a toolchain and try to run the build there. (After all, if clang works for you, it sounds like that's an issue with cross-compiling).
Well - although cross compiling Wine from x86 to aarch64 also is supported. I don't test that quite nightly though, but I do test it semi-regularly manually.
I assume there is a test that is being run to ensure that varargs don't break?
I'm not aware of one specific test for that, but I do test running loads of various binaries that do call vararg functions, so I'm pretty sure that it's covered and working in my builds.
If yes, maybe it only fails under certain circumstances that aren't covered, yet? I would like to run it, to determine if it passes or fails on my build.
(my program runs only: "_snwprintf_s(buffer, _countof(buffer), _countof(buffer) - 1, L"%Ts + %Ts", L"A", L"B");" and crashes)
If you link to a specific binary containing this call, I can double check running that executable with my Wine builds.