Compiling kontlinconf-app for ios


#1

I’m trying to build kotlinconf-app for ios, installed clion 2017.3 EAP, kotlin modules, cloned the github project, built successfully the android app and trying to compile the ios version. I successfully opened the ios project in CLion and can see three targets there (kotlinconf.compile, kotlinconf.kexe and libs).

When trying to build kontlinconf.* targets, the compilation fails with error saying it cannot find the libs package (and classes from it).

src/main/kotlin/data/FavoritesManager.kt:1:8: error: unresolved reference: libs
import libs.*
       ^
src/main/kotlin/data/FavoritesManager.kt:7:29: error: unresolved reference: KSession
    fun isFavorite(session: KSession) = getFavorite(session) != null
                            ^

When I try to build the libs package, compilation fails with error saying it cannot find Groot/Groot.h:

[100%] Generating CMakeFiles/libs/libs.klib
Exception in thread "main" java.lang.Error: /var/folders/94/c3pxr0kx6nzdmz3q6zp2bn740000gn/T/tmp1325937600661251236.m:1:10: fatal error: 'Groot/Groot.h' file not found
	at org.jetbrains.kotlin.native.interop.indexer.UtilsKt.ensureNoCompileErrors(Utils.kt:135)
	at org.jetbrains.kotlin.native.interop.indexer.IndexerKt.indexDeclarations(Indexer.kt:875)
	at org.jetbrains.kotlin.native.interop.indexer.IndexerKt.buildNativeIndexImpl(Indexer.kt:865)
	at org.jetbrains.kotlin.native.interop.indexer.NativeIndexKt.buildNativeIndex(NativeIndex.kt:55)
	at org.jetbrains.kotlin.native.interop.gen.jvm.MainKt.processLib(main.kt:317)
	at org.jetbrains.kotlin.native.interop.gen.jvm.MainKt.interop(main.kt:33)
	at org.jetbrains.kotlin.cli.utilities.MainKt.invokeCinterop(main.kt:90)
	at org.jetbrains.kotlin.cli.utilities.MainKt.main(main.kt:112)
make[3]: *** [CMakeFiles/libs/libs.klib] Error 1

Any idea what is happening?


#2

Well, you’re missing the Groot library, installing it where it expects it to be is probably the best solution, ditto for other missing libraries.

This is a symptom of a larger problem with interop libs in that there are external dependencies which are not being managed or documented at this point. In my case it was a dependency on a library in the macOS 10.12 SDK.

There needs to be a better solution for managing external dependencies, probably at the project level, but right now I don’t think it’s a priority and you should just cobble together what’s being asked for, or hack the .def files fed to interop if you cannot do that.


#3

Well, the thing is Groot is part of the source code on github and is checked out, so this should work: https://github.com/JetBrains/kotlinconf-app/tree/master/ios/Frameworks/Groot.framework


#4

Then it’s probably in the wrong place or an environment variable or path is missing. There are many ways it can go wrong.

It’s pre-release software, your “should work” is probably a bit hopeful.