Skip to content

Conversation

@danil-pavlov
Copy link
Contributor

No description provided.

@danil-pavlov danil-pavlov requested a review from a team as a code owner November 7, 2025 12:09
| macOS (Apple Silicon) | ARM64 platforms | `macosArm64`, `iosArm64`, `tvosArm64`, `watchosArm64` |
| macOS (Intel chips) | x86_64 platforms | `macosX64`, `iosX64`, `tvosX64`, `watchosX64` |
| Linux | x86_64 platforms | `linuxX64` |
| Windows (MinGW toolchain) | x86_64 platforms | `mingwX64` |

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On Linux and Windows we can compile all possible non-Apple targets, even with cinterops. With cross-compilation we can also produce .klib's from every supported host (the only restriction is custom cinterops on Apple targets)

docs/kr.tree Outdated
<toc-element toc-title="Binary options" topic="native-binary-options.md"/>
<toc-element topic="native-debugging.md"/>
<toc-element toc-title="Target support" topic="native-target-support.md"/>
<toc-element toc-title="Targets and hosts" topic="native-target-support.md"/>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not "Target and host support"? That seems clearer to me.

| `androidNativeArm32` | `arm-unknown-linux-androideabi` | | [Android NDK](https://developer.android.com/ndk) on ARM32 platforms |
| `androidNativeArm64` | `aarch64-unknown-linux-android` | | [Android NDK](https://developer.android.com/ndk) on ARM64 platforms |
| `androidNativeX86` | `i686-unknown-linux-android` | | [Android NDK](https://developer.android.com/ndk) on x86 platforms |
| `androidNativeX86` | `i686-unknown-linux-android` | | [Android NDK](https://developer.android.com/ndk) on x86_64 platforms |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the motivation behind this change?


The Kotlin/Native compiler supports the following hosts:

| Host OS | Architecture | Target compilation | `.klib` production |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The header seems confusing to me. It is not clear how "Target compilation" and ".klib production" map to "final binaries" mentioned below and in the cross-compilation documentation.
It makes sense to use the same terms everywhere.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree, let's sync headers and the description below


| Host OS | Architecture | Target compilation | `.klib` production |
|---------------------------|------------------|------------------------------------------------|------------------------------------------------------------------------|
| macOS (Apple Silicon) | ARM64 platforms | Any supported target | Any supported target |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apple Silicon is the same as Architecture = ARM64 platforms. Let's merge this and the next lines and mention both architectures in the second column?

Or the opposite: remove the Architecture column, mention the architecture for any other OS in the first column. This makes sense because that would use the official terms for macOS (i.e. "Apple silicon" is more familiar than "ARM64 platforms").

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I merged the columns, but we use ARM64 with Apple targets everywhere in the targets section above, so I added it in parentheses as well

|---------------------------|------------------|------------------------------------------------|------------------------------------------------------------------------|
| macOS (Apple Silicon) | ARM64 platforms | Any supported target | Any supported target |
| macOS (Intel chips) | x86_64 platforms | Any supported target | Any supported target |
| Linux | x86_64 platforms | Any supported target, except for Apple targets | Any supported target, Apple targets only without cinterop dependencies |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"platforms" is redundant in the second column.
"Architecture" is "x86_64", not "x86_64 platforms".

| Linux | x86_64 platforms | Any supported target, except for Apple targets | Any supported target, Apple targets only without cinterop dependencies |
| Windows (MinGW toolchain) | x86_64 platforms | Any supported target, except for Apple targets | Any supported target, Apple targets only without cinterop dependencies |

* To produce final binaries, you can only compile supported [Kotlin/Native targets](#target-tiers) on supported hosts.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does this mean? This kind of implies that I can produce final binaries for iosArm64 (a supported target) on Linux x86_64 (a supported host).

It is mentioned as not supported below, but this sentence itself suggests that it is, which seems confusing.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, I rephrased it and moved the example closer to highlight that the 1st paragraph is about the fact that you cannot use any host that is not on the list. And the second paragraph here is specifically about Apple targets on Linux and Windows


* To produce final binaries, you can only compile supported [Kotlin/Native targets](#target-tiers) on supported hosts.

For example, target compilation is not possible on the FreeBSD OS or on a Linux machine running on the ARM64 architecture.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Producing a .klib is also not possible.


For example, target compilation is not possible on the FreeBSD OS or on a Linux machine running on the ARM64 architecture.

Compilation for Apple targets on Linux and Windows is also not possible.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not clear how "Compilation for Apple targets" maps to "Target compilation", ".klib production" or "final binaries".

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, let's use the same terms as in the table


Compilation for Apple targets on Linux and Windows is also not possible.

* Generally, Kotlin/Native supports cross-compilation, allowing any supported host to produce the `.klib` artifacts.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added the link to the bottom, but we also have the same information about cinterop-limitations here, so that users don't have to jump to another page.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants