On my project I'm depending on the artifacts produ...
# kotlin-native
j
On my project I'm depending on the artifacts produced by another Kotlin Multiplatform library - it also produces native artifacts etc (in this case the ones for iOS):
Copy code
val commonMain by getting {
    dependencies {
       //....
       api("dependency-group:dependency:version")
    }
}
When I'm trying to run the
linkDebugTestIosX64
gradle task I'm getting this error:
Copy code
e: Compilation failed: Cyclic dependency in library graph for: /Users/boni/Documents/Programmieren/Kotlin/StihlBusiness/StihlBusiness/build/classes/kotlin/iosX64/main/Library

 * Source files: StoreTest2.kt
 * Compiler version info: Konan: 1.3.1 / Kotlin: 1.3.40
 * Output kind: PROGRAM
Is there a way to debug this to get better information?
🤝 1
s
Maybe add --debug or --info to your command line?
a
The most direct way is to check out the
manifest
file in your
Library.klib
.
.klib
-files are just zips. Look for
depends=
in
manifest
. It seems like you've got a library dependent on a library with the same name. So if your library is called
foo
and it has
depends=foo
in
manifest
then you get that message. The cycle can be longer, though, spanning several libraries.
r
Make sure you’re using the same Kotlin version as the library. There’s no compatibility guarantees in Kotlin/Native yet
j
@alexander.gorshenev thanks a bunch for this tip, it got me to the right path! In the end the culprit has been the
-module-name
extraopts (it was visible in the depends line in the manifest). It was the same prefix that I added to the dependency - once I used another prefix it worked just fine!
p
@Jonas Bark I'm running into same prob. The manifest of my dep has "depends=stdlib lib". lib is the module name from the artifact that is published on maven. What was your solution?
j
@Patrick Jackson I wrote my solution just above your answer
p
the unique name is also "lib"...
literally changing the gradle module name?
j
I just had to change the extraopts -module-name parameter:
compilations["main"].extraOpts.addAll(listOf("-module-name", "SC"))
SC was already used by a dependency, so I changed it to something else
p
in the dependency, or the project?
j
both will work 😉 just don't use the same one
p
is this in the targets block?
Copy code
`
kotlin {
    targets {
        fromPreset(iOSTarget, 'ios') {
             compilations["main"].extraOpts.addAll(["-module-name", "MyName"])
        }
    }
`
j
I guess that should work as well
p
where did you put it? sorry to keep pestering. this is a bit unclear as to what is happening and why.
you can also search for "extraOpts" here in this slack workspace
p
works, thanks so much. is there a issue filed for this? this will be a common problem