https://bugs.winehq.org/show_bug.cgi?id=51849
Bug ID: 51849 Summary: Debian packaging: When building debian packages, HARDENING flags will be passed to cross-compiler Product: Packaging Version: unspecified Hardware: x86-64 OS: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: wine-packages Assignee: wine-bugs@winehq.org Reporter: cybermax@dexter.no CC: dimesio@earthlink.net Distribution: ---
When packages are built on debian, the default "hardening" flags will be passed to wine/configure. The result from this is that wine/configure tries to do checks for cross-compiler (mingw-w64) with flags meant to be used for ELF binaries.
The flags are -Wl,-z,relro
This causes configure to fail several checks for cross-compiler.
The logs from WineHQ official OBS builds here for Debian 11: https://build.opensuse.org/public/build/Emulators:Wine:Debian/Debian_11/x86_...
Failing these checks will cause mingw-w64 to create loads of warnings like: [ 1042s] In file included from dlls/cabinet/fdi.c:72: [ 1042s] dlls/cabinet/fdi.c: In function 'FDI_read_string': [ 1042s] dlls/cabinet/fdi.c:485:9: warning: format '%ld' expects argument of type 'long int', but argument 6 has type 'INT_PTR' {aka 'long long int'} [-Wformat=] [ 1042s] 485 | TRACE("(fdi == %p, hf == %ld, cabsize == %ld)\n", fdi, hf, cabsize); [ 1042s] | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~ [ 1042s] | | [ 1042s] | INT_PTR {aka long long int}
If you however build without passing -Wl,-z,relro to mingw-w64, configure will pass a lot more tests, and the compile is quite a lot less noisy: https://build.opensuse.org/build/home:SveSop/Debian_11/x86_64/wine-devel/_lo...
Is there a possibility to avoid passing this flag to the cross-compiler in wine/configure? From what i gather, the -Wl,-z,relro flag is meant for ELF binaries, but afaik wine mostly (if not only) uses mingw-w64 to build PE libs, and thus these flags fail.
You can add export DEB_LDFLAGS_MAINT_STRIP = -Wl,-z,relro to debian/rules, but that ofc means the ELF binaries built by gcc will not get these hardening flags.