Troubleshooting
cargo not found
Ensure the Rust toolchain is installed and cargo is available on your PATH. On macOS, Kreate looks at ~/.cargo/bin/cargo; if you installed Rust through a custom path, verify that location exists or ensure cargo is on your PATH.
Unsupported Rust Target
If a target triple in rustTargets does not match any of the supported patterns, Kreate throws:
Supported patterns and their Kotlin/Native equivalents:
Pattern | Kotlin/Native Target |
|---|---|
|
|
|
|
|
|
|
|
If you need a target not listed here, it is not yet supported by the Kreate C-Interop pipeline.
Missing Cross-Compilation Target
If cargo build fails with a message like:
The required Rust target has not been installed. Add it with:
For example, to add the Linux x86_64 target:
Failed to Create Root Directory
If the projectDirectory cannot be created (e.g. due to filesystem permissions), Kreate throws:
Ensure the parent directory is writable by the process running the Gradle daemon. Check filesystem permissions and that you are not building inside a read-only location.
Failed to Create C-Interop Directory or Definition File
If the defs/ directory or the .def file cannot be created, Kreate throws:
Verify that the Rust project directory is writable and that no conflicting file or directory already exists at those paths.
Definition File Not Updated After Config Changes
The kreate-c-interop-definitions task always rewrites the .def file on execution. However, Gradle's incremental build cache may prevent the task from re-running if its declared inputs have not changed. If you change rustTargets, defFileName, dirName, or directory settings and the .def file appears stale, run a clean build:
Compilation Fails for a Specific Target
If kreate-c-interop-compile fails with a GradleException for a specific target, the full Cargo error output is printed to the Gradle build log. Run with --info or --debug for more detail:
Common causes are missing target toolchains, incorrect Cargo.toml configuration, or Rust source code compilation errors.