https://kotlinlang.org logo
#ktor
Title
# ktor
j

Jonathan Lennox

05/18/2022, 5:45 PM
Hi all, I'm trying to build ktor on macOS, and it's not building - it's failing in compilePosixMainKotlinMetadata, it looks like it can't find the kotlinx atomicfu and coroutines. Has anyone seen that?
Copy code
> Task :ktor-io:compilePosixMainKotlinMetadata FAILED
e: /Users/jlennox/Git/ktor/ktor-io/posix/src/io/ktor/utils/io/ByteChannelNative.kt: (11, 16): Unresolved reference: atomicfu
e: /Users/jlennox/Git/ktor/ktor-io/posix/src/io/ktor/utils/io/ByteChannelNative.kt: (13, 16): Unresolved reference: coroutines
e: /Users/jlennox/Git/ktor/ktor-io/posix/src/io/ktor/utils/io/ByteChannelNative.kt: (14, 16): Unresolved reference: coroutines
e: /Users/jlennox/Git/ktor/ktor-io/posix/src/io/ktor/utils/io/ByteChannelNative.kt: (67, 30): Unresolved reference: Job
e: /Users/jlennox/Git/ktor/ktor-io/posix/src/io/ktor/utils/io/ByteChannelNative.kt: (67, 38): Unresolved reference: atomic
e: /Users/jlennox/Git/ktor/ktor-io/posix/src/io/ktor/utils/io/ByteChannelNative.kt: (69, 12): Unresolved reference: InternalCoroutinesApi
e: /Users/jlennox/Git/ktor/ktor-io/posix/src/io/ktor/utils/io/ByteChannelNative.kt: (69, 12): An annotation argument must be a compile-time constant
e: /Users/jlennox/Git/ktor/ktor-io/posix/src/io/ktor/utils/io/ByteChannelNative.kt: (70, 33): Unresolved reference: Job
e: /Users/jlennox/Git/ktor/ktor-io/posix/src/io/ktor/utils/io/ByteChannelNative.kt: (73, 55): Cannot infer a type for this parameter. Please specify it explicitly.
e: /Users/jlennox/Git/ktor/ktor-io/posix/src/io/ktor/utils/io/ByteChannelNative.kt: (212, 34): Unresolved reference: ClosedSendChannelException
e: /Users/jlennox/Git/ktor/ktor-io/posix/src/io/ktor/utils/io/ByteChannelNative.kt: (246, 26): Incompatible types: io.ktor.utils.io.CancellationException /* = kotlinx.coroutines.CancellationException */ and Throwable?
e: /Users/jlennox/Git/ktor/ktor-io/posix/src/io/ktor/utils/io/pool/DefaultPool.kt: (3, 16): Unresolved reference: atomicfu
e: /Users/jlennox/Git/ktor/ktor-io/posix/src/io/ktor/utils/io/pool/DefaultPool.kt: (4, 16): Unresolved reference: atomicfu
e: /Users/jlennox/Git/ktor/ktor-io/posix/src/io/ktor/utils/io/pool/DefaultPool.kt: (9, 25): Unresolved reference: SynchronizedObject
e: /Users/jlennox/Git/ktor/ktor-io/posix/src/io/ktor/utils/io/pool/DefaultPool.kt: (9, 46): Unresolved reference: SynchronizedObject
e: /Users/jlennox/Git/ktor/ktor-io/posix/src/io/ktor/utils/io/pool/DefaultPool.kt: (11, 29): Unresolved reference: atomicArrayOfNulls
e: /Users/jlennox/Git/ktor/ktor-io/posix/src/io/ktor/utils/io/pool/DefaultPool.kt: (12, 25): Unresolved reference: atomic
e: /Users/jlennox/Git/ktor/ktor-io/posix/src/io/ktor/utils/io/pool/DefaultPool.kt: (20, 52): Unresolved reference: synchronized
e: /Users/jlennox/Git/ktor/ktor-io/posix/src/io/ktor/utils/io/pool/DefaultPool.kt: (21, 24): 'return' is not allowed here
e: /Users/jlennox/Git/ktor/ktor-io/posix/src/io/ktor/utils/io/pool/DefaultPool.kt: (26, 24): Variable expected
e: /Users/jlennox/Git/ktor/ktor-io/posix/src/io/ktor/utils/io/pool/DefaultPool.kt: (28, 9): 'return' is not allowed here
e: /Users/jlennox/Git/ktor/ktor-io/posix/src/io/ktor/utils/io/pool/DefaultPool.kt: (32, 9): Unresolved reference: synchronized
e: /Users/jlennox/Git/ktor/ktor-io/posix/src/io/ktor/utils/io/pool/DefaultPool.kt: (37, 35): Variable expected
e: /Users/jlennox/Git/ktor/ktor-io/posix/src/io/ktor/utils/io/pool/DefaultPool.kt: (43, 9): Unresolved reference: synchronized
e: /Users/jlennox/Git/ktor/ktor-io/posix/src/io/ktor/utils/io/pool/DefaultPool.kt: (47, 30): Variable expected
Does anyone know how to fix this, or alternatively how to skip building native? I only care about JVM builds.
h

hfhbd

05/18/2022, 7:21 PM
Which branch/commit and which platform, Intel or M1? I am able to build the latest master on M1, but I needed to use JDK 17
j

Jonathan Lennox

05/18/2022, 7:22 PM
Intel, main, b40f34673.
It looks like if I just build jvmTests in IntelliJ it works though, I guess it's bypasses whatever is trying to build native libs?
a

Aleksei Tirman [JB]

05/18/2022, 9:12 PM
I think there is some problem with caches. I’ve posted a comment in https://youtrack.jetbrains.com/issue/KTOR-4335.
j

Jonathan Lennox

05/18/2022, 9:54 PM
I cleared out
.gradle
and
.konan
and got the same thing - I didn't clear
.m2
though.
7 Views