FS#71855 - [mingw-w64-gcc] gcc calls wrong assembler

Attached to Project: Community Packages
Opened by Leonard (scrouthtv) - Tuesday, 17 August 2021, 15:02 GMT
Last edited by Toolybird (Toolybird) - Wednesday, 03 May 2023, 05:32 GMT
Task Type Bug Report
Category Packages
Status Closed
Assigned To Felix Yan (felixonmars)
Architecture All
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 1
Private No

Details

Description: I'm currently trying to solve an issue I have when cross-compiling OpenSSL for Windows using mingw.

If I try to make the OpenSSL tree, the compilation crashes with
> /tmp/cczahEXC.s: Assembler messages:
> /tmp/cczahEXC.s:3: Fatal error: bad .section directive: want a,l,w,x,M,S,G,T in string

which hints for gcc calling the wrong linker. Indeed, if I uninstall the `gcc` and `binutils` packages (not mingw variants) I get this error instead:
> x86_64-w64-mingw32-gcc: fatal error: cannot execute ‘as’: execvp: No such file or directory
> compilation terminated.
> make[1]: *** [Makefile:729: apps/app_rand.o] Error 1

The same tree and configure script works fine in a Ubuntu VM with their mingw package.

Manually adding `-B /usr/bin/x86_64-w64-mingw32-` to the CFLAGS as suggested in https://stackoverflow.com/questions/24714228/what-is-wrong-with-my-cross-compiler/24741760#24741760 fixes my issue.

The people at OpenSSL claim that it's not a problem with their build script but rather Arch's mingw build.

Additional info:
* package version(s)
mingw-w64-binutils 2.36.1-1
mingw-w64-crt 9.0.0-1
mingw-w64-gcc 11.2.0-1
mingw-w64-headers 9.0.0-2
make 4.3-3

* config and/or log files etc.
Build log:
/usr/sbin/make depend && /usr/sbin/make _all
make[1]: Entering directory '/home/lenni/git/openvpn-build/generic/tmp/openssl-1.1.1k'
make[1]: Leaving directory '/home/lenni/git/openvpn-build/generic/tmp/openssl-1.1.1k'
make[1]: Entering directory '/home/lenni/git/openvpn-build/generic/tmp/openssl-1.1.1k'
x86_64-w64-mingw32-gcc -I. -Iinclude -m64 -Wall -O3 -DL_ENDIAN -DOPENSSL_PIC -DOPENSSL_CPUID_OBJ -DOPENSSL_IA32_SSE2 ->x86_64-w64-mingw32-gcc: fatal error: cannot execute ‘as’: execvp: No such file or directory
compilation terminated.
make[1]: *** [Makefile:729: apps/app_rand.o] Error 1
make[1]: Leaving directory '/home/lenni/git/openvpn-build/generic/tmp/openssl-1.1.1k'
make: *** [Makefile:188: all] Error 2

* link to upstream bug report, if any
https://github.com/openssl/openssl/issues/16259

Steps to reproduce:
1. Install mingw-w64-binutils mingw-w64-crt mingw-w64-gcc mingw-w64-headers
2. Clone github.com/openssl/openssl
3. Checkout OpenSSL_1_1_1k
4. Execute ./Configure --cross-compile-prefix=x86_64-w64-mingw32- shared mingw64
5. Execute make
This task depends upon

Closed by  Toolybird (Toolybird)
Wednesday, 03 May 2023, 05:32 GMT
Reason for closing:  Works for me
Additional comments about closing:  Just tried with latest repo pkgs and it works fine (mingw-w64-gcc 12.2.0-1)

Loading...