Make Gradle cpp not add platform related arguments to g++

I have a docker image with a g++ installed that compiles for armv7 architecture (not to the architecture of the docker image, which is a x86_64). This is a build system which will upload the result elsewhere.

Anyway, my problem is that gradle is identifying the architecture of my docker image and is calling g++ with the argument ‘-m64’, so I get this error.

g++: error: unrecognized command line option ‘-m64’

How to force gradle to not insert platform related arguments like this? I already joint the shared libraries gradle compiles by hand (not giving any arguments) and it compiles fine, it is really a problem of gradle inserting platform related arguments.

Best Regards, Ernani

I believe the solution is to define your own toolchain and target platform instead of letting Gradle choose them from its built-in defaults.

An example of this can be seen in the cross compiling section of the user guide. https://docs.gradle.org/current/userguide/native_software.html#sec:crosscompiling_with_gcc