0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Kotlin/NativeでHello World

Last updated at Posted at 2020-06-10

目的

まずはKotlin/Nativeでコードを書いて、raspberrypi上で"Hello World"をしてみる。

準備

mac 上で、kotlin/Nativeを使えるように以下をインストール

  1. JetBrains IntelliJ IDEA CE
  2. XCode 11.5
  3. XCode command line tool
kotlinc-native -list-targets

を実行するも、xcodebuildが見つからないようなエラーが。。。正確なものをメモってなかったけど、MissingXcodeExceptionだった気がします。

https://youtrack.jetbrains.com/issue/KT-34858
https://stackoverflow.com/questions/40743713/command-line-tool-error-xcrun-error-unable-to-find-utility-xcodebuild-n

を参考に、

sudo xcode-select -s /Applications/Xcode.app/Contents/Developer

を実行。再びlist-targetをしてみると、、、

kotlinc-native -list-targets

macos_x64:                    (default) macbook, macos, imac
ios_arm32:                              iphone32
ios_arm64:                              iphone, ipad, ios
ios_x64:                                iphone_sim
watchos_arm32:
watchos_arm64:
watchos_x86:
watchos_x64:
tvos_arm64:
tvos_x64:
linux_x64:                              linux
linux_arm32_hfp:                        raspberrypi
linux_arm64:
android_x86:
android_x64:
android_arm32:
android_arm64:
wasm32:

うまくいったっぽい。

で、Kotlin/Nativeのhello worldは、intelliJで自動生成してmac用のコードは完成。そこにraspberrypi用のコードも追加。
https://github.com/JetBrains/kotlin-native/blob/master/GRADLE_PLUGIN.md を参考

できたコードがこんな感じ
https://gitlab.com/hoso-study/raspberrypi/kotlinnative-helloworld

mac/raspberrypiで実行できるkexeがそれぞれ完成。

mac用はlocalで実行。
raspberrypi用は、scpして実行。
どちらも無事動きました。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?