[native] No tool chain is available failure on windows

I have two separate common build scripts used by multiple different projects that define gcc-specific and msvc-specific platforms and toolchain settings.

The gcc-specific build script has this content:

model {

    platforms {
        linux_x64 {
            architecture 'x86_64'
            operatingSystem 'linux'
        }
    }

    toolChains {
    	gcc(Gcc) {
            target("linux_x64") {
                linker.withArguments { args ->
                    // gcc stuff
                }
            }
        }
    }
}

The msvc script looks like so:

model {
  platforms {
        windows_x86 {
            architecture 'x86'
            operatingSystem 'windows'
        }
  }

  binaries {
      withType(SharedLibraryBinary) {
        if ( toolChain in VisualCpp ) {
          if ( buildType == buildTypes.release ) {
              // msvc stuff
          }
        }
      }
   }
}

And the component build script applies both of these like so:

apply from: '../common/gcc.gradle'
apply from: '../common/msvc.gradle'

buildTypes {
  debug
  release
}

components {
   myComponent(NativeLibrarySpec) {
       targetPlatform 'windows_x86'
       targetPlatform 'linux_x64'
   }
}

This runs without errors on linux.
BUT, when I run ./gradlew build on this component build script on a Windows system, I get this error:

Execution failed for task ':assemble'.
> No buildable binaries found:
    - shared library 'myComponent:linux_x64:debug:sharedLibrary': Disabled by user
    - static library 'myComponent:linux_x64:debug:staticLibrary': No tool chain is available to build for platform 'linux_x64':
        - Tool chain 'gcc' (GNU GCC): Could not find C compiler 'gcc' in system path.
    - shared library 'myComponent:linux_x64:release:sharedLibrary': Disabled by user
    - static library 'myComponent:linux_x64:release:staticLibrary': No tool chain is available to build for platform 'linux_x64':
        - Tool chain 'gcc' (GNU GCC): Could not find C compiler 'gcc' in system path.
    - shared library 'myComponent:windows_x86:debug:sharedLibrary': Disabled by user

    - static library 'myComponent:windows_x86:debug:staticLibrary': No tool chain is available to build for platform 'windows_x86':
        - Tool chain 'gcc' (GNU GCC): Could not find C compiler 'gcc' in system path.
    - shared library 'myComponent:windows_x86:release:sharedLibrary': Disabled by user
    - static library 'myComponent:windows_x86:release:staticLibrary': No tool chain is available to build for platform 'windows_x86':
        - Tool chain 'gcc' (GNU GCC): Could not find C compiler 'gcc' in system path.
    - executable 'test:linux_x64:debug:executable': No tool chain is available to build for platform 'linux_x64':
        - Tool chain 'gcc' (GNU GCC): Could not find C compiler 'gcc' in system path.
    - executable 'test:linux_x64:release:executable': No tool chain is available to build for platform 'linux_x64':
        - Tool chain 'gcc' (GNU GCC): Could not find C compiler 'gcc' in system path.
    - executable 'test:windows_x86:debug:executable': No tool chain is available to build for platform 'windows_x86':
        - Tool chain 'gcc' (GNU GCC): Could not find C compiler 'gcc' in system path.
    - executable 'test:windows_x86:release:executable': No tool chain is available to build for platform 'windows_x86':
        - Tool chain 'gcc' (GNU GCC): Could not find C compiler 'gcc' in system path.

What am I doing wrong?

Simple. For whatever reason, if I define a custom Gcc-derived toolchain, it seems that I MUST also define a custom VisualCpp-defined toolchain.

Not what I was expecting (I don’t need a custom VisualCpp toolchain), but simple enough to accommodate.

1 Like