Closed protos-gunzinger closed 5 months ago
A PR addressing this was merged for 8.7, it will be part of 8.7 RC1. You can already test if your use case is fixed by using the nightly release from https://gradle.org/nightly/
If there is anything missing please feel free to reopen and comment here or file a separate issue with the details.
Expected Behavior
Installed gcc (from
gcc-mingw-w64
) should be used succesfully. Either by adding a hardcoded-bypass forminor == 0 && patchlevel == 0
, or by only relying on the major version to be present in the relevant line.Current Behavior
The following output is printed when attempting to use the gcc from the
gcc-mingw-w64
(x86_64-w64-mingw32-gcc
) on Ubuntu or Debian (for cross-compilation to target windows):Context
This is a blocker for our CI pipeline which uses a docker container based on the eclipse-temurin JDK images. We are trying to build our project which contains native code that should be cross-compiled into
.exe
binaries.GCC output using the same flags as gradle calls GCC to identify with (taken from https://github.com/gradle/gradle/blob/master/subprojects/platform-native/src/main/java/org/gradle/nativeplatform/toolchain/internal/gcc/metadata/GccMetadataProvider.java#L81 ):
Gradle uses the defines
__GNUC__
,__GNUC_MINOR__
and__GNUC_PATCHLEVEL__
to determine major, minor and patch level versions: https://github.com/gradle/gradle/blob/master/subprojects/platform-native/src/main/java/org/gradle/nativeplatform/toolchain/internal/gcc/metadata/GccMetadataProvider.java#L229Then it expects the
major.minor
couple to be present in the a version information line in the vendor check: https://github.com/gradle/gradle/blob/master/subprojects/platform-native/src/main/java/org/gradle/nativeplatform/toolchain/internal/gcc/metadata/GccMetadataProvider.java#L97Relevant links to the gcc source code (version printing): https://github.com/gcc-mirror/gcc/blob/master/gcc/gcc.cc#L7558 And the debian patches applied to gcc concerning the version: https://salsa.debian.org/mingw-w64-team/gcc-mingw-w64/-/blob/master/debian/patches/gcc-basever.patch
Steps to Reproduce (for bugs)
Use a recent Ubuntu or Debian OS/container image with gradle and try to use the gcc from the
gcc-mingw-w64
package (x86_64-w64-mingw32-gcc
). Affected versions (at least): Ubuntu 22.04 LTS, Debian Bullseye Probably many more, however no research was done on the package version of other software.Dockerfile to reproduce the version output of mingw gcc for Debian Bullseye, Ubuntu 22.04 LTS:
Focal works as they use GCC 9.3.0 which has a minor patch version -> does not get truncated.
Your Environment
Can not be published.