# Custom gcc executable

**URL:** https://discuss.gradle.org/t/custom-gcc-executable/35789
**Category:** Help/Discuss
**Created:** [April 22, 2020, 2:18pm UTC](https://discuss.gradle.org/t/custom-gcc-executable/35789 "2020-04-22T14:18:26Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![iharh](https://avatars.discourse-cdn.com/v4/letter/i/d78d45/32.png) [@iharh](https://discuss.gradle.org/u/iharh)
#### Post date: [April 22, 2020, 2:18pm UTC](https://discuss.gradle.org/t/custom-gcc-executable/35789/1 "2020-04-22T14:18:26Z")

</div>

I’m using a new native plugins (cpp-library, cpp-application) without old software model.

- [https://docs.gradle.org/current/userguide/building\_cpp\_projects.html](https://docs.gradle.org/current/userguide/building_cpp_projects.html)

My question is: how can I customize gcc compiler (from compat-gcc-44-c++ package) executable for them???

I don’t see any sample of customizing toolChain object - just selection other options based on the value of toolChain

UPDATE: managed to find this sample, but it does not work as exected:

```gradle
application {
    toolChains {
        withType<Gcc> {
            eachPlatform {
                // this: GccPlatformToolChain
                cppCompiler.setExecutable("compat-g++")
                println("cppCompiler.executable: ${cppCompiler.executable}")
            }
       }
    }
    ...
}

```

Effectively, cppCompiler executable is still “g++”.

---

<div class="post-metadata">

### Author: ![nicolas06](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/nicolas06/32/7230_2.png) [@nicolas06](https://discuss.gradle.org/u/nicolas06)
#### Post date: [June 23, 2020, 12:49pm UTC](https://discuss.gradle.org/t/custom-gcc-executable/35789/2 "2020-06-23T12:49:07Z")

</div>

Hi Iharh,

I have a similar problem. Did you find a solution?

---

<div class="post-metadata">

### Author: ![iharh](https://avatars.discourse-cdn.com/v4/letter/i/d78d45/32.png) [@iharh](https://discuss.gradle.org/u/iharh)
#### Post date: [June 23, 2020, 4:57pm UTC](https://discuss.gradle.org/t/custom-gcc-executable/35789/3 "2020-06-23T16:57:02Z")

</div>

Hell, Nicolas.  
Actually - No. I decided to slowly upgrade the whole big project to the recent gcc instead of customizing gradle scripts.
