Skip to content

Conversation

@bbugdigger
Copy link

YouTrack link: https://youtrack.jetbrains.com/issue/KT-56569/Kotlin-Native-add-convenient-scripts-for-C-C-cross-compilation

Introduced convenient clang/clang++ wrapper scripts that use standard target triple naming conventions, making it easier to cross-compile C/C++ code against Kotlin/Native's sysroots.

New targets covered:

  • linux_x64: x86_64-linux-gnu-clang[++]
  • linux_arm64: aarch64-linux-gnu-clang[++]
  • linux_arm32_hfp: arm-linux-gnueabihf-clang[++]
  • mingw_x64: x86_64-w64-mingw32-clang[++]
  • android_arm64: aarch64-linux-android-clang[++]
  • android_arm32: arm-linux-androideabi-clang[++]
  • android_x64: x86_64-linux-android-clang[++]
  • android_x86: i686-linux-android-clang[++]

Each target includes Unix shell scripts and Windows .bat variants.
Apple targets (macOS, iOS, tvOS, watchOS) are not included as they require a macOS host for testing.

@bbugdigger bbugdigger requested a review from a team as a code owner January 30, 2026 09:00
@bbugdigger bbugdigger requested a review from projedi January 30, 2026 09:00
Copy link
Contributor

@haitaka haitaka left a comment

Choose a reason for hiding this comment

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

Hi! Thanks for the contribution! I'm thinking maybe it would be possible to generate these scripts automatically when building the distribution. This way we won't miss anything when we add or remove K/N targets.

@bbugdigger bbugdigger requested a review from a team as a code owner January 31, 2026 10:40
@bbugdigger
Copy link
Author

Now instead of manually maintaining 32 wrapper scripts in kotlin-native/cmd/, generate them automatically during the distribution build by parsing targetTriple.* entries from konan.properties.

This ensures scripts stay in sync when targets are added or removed, and now includes wrappers for all targets (including Apple targets).

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants