我有一个带Windows 7的64位系统。我通过gradlew dist distPlatformLibs
构建了kotlin-native,然后进入了msys2终端,并通过pacman安装了mingw sdl2 lib。通过winpty,我执行Tetris示例应用程序的build.bat
并获得以下编译异常:
$ winpty ./build.bat
Exception in thread "main" java.lang.Error: C:\Users\me\AppData\Local\Temp\tmp4397933690362265283.c:1:10: fatal error: 'SDL.h' file not found
at org.jetbrains.kotlin.native.interop.indexer.UtilsKt.ensureNoCompileErrors(Utils.kt:137)
at org.jetbrains.kotlin.native.interop.indexer.IndexerKt.indexDeclarations(Indexer.kt:902)
at org.jetbrains.kotlin.native.interop.indexer.IndexerKt.buildNativeIndexImpl(Indexer.kt:892)
at org.jetbrains.kotlin.native.interop.indexer.NativeIndexKt.buildNativeIndex(NativeIndex.kt:56)
at org.jetbrains.kotlin.native.interop.gen.jvm.MainKt.processCLib(main.kt:284)
at org.jetbrains.kotlin.native.interop.gen.jvm.MainKt.interop(main.kt:38)
at org.jetbrains.kotlin.cli.utilities.InteropCompilerKt.invokeInterop(InteropCompiler.kt:97)
at org.jetbrains.kotlin.cli.utilities.MainKt.main(main.kt:29)
在脚本中禁用@echo off
,我可以看到上述异常发生在调用call cinterop -def ".\src\main\c_interop\sdl.def" -compilerOpts "-I\msys64\mingw64\include\SDL2" -target "mingw" -o sdl || exit /b
的过程中