Ian Botsford
04/29/2025, 4:21 PMlinux_arm64
on a linux_x64
host. The cinterop task fails with UnsatisfiedLinkError
looking for some newer version of glibc than exists on my host (full error in 🧵). I don't understand why it would be trying to use my host OS libs instead of the corresponding libs from the Konan distribution. 🤔 Anyone have experience debugging cinterops?lauraldo
05/02/2025, 2:31 PMkotlinc-native
, the java
process is launched.
I tested it on linux_x64
and macos_arm64
targets.
So does Kotlin/Native compiler use Java under the hood by default?Jaiden Siu
05/07/2025, 12:41 AMenum class BananaAge {
NEW_BANANA,
OLD_BANANA
}
Which generates the following in the header file.
@property (class, readonly) LibraryNameBananaAge *theNewContact __attribute__((swift_name("theNewBanana")));
@property (class, readonly) LibraryNameBananaAge *oldBanana __attribute__((swift_name("oldBanana")));
I get the same result in the header file when using the ObjCName annotation. Anyone have any ideas why or what is happening under the hood?Raphael TEYSSANDIER
05/07/2025, 3:11 PMlib.a
to my project with cinterop
. And I cannot make it work, is there any example on github to follow ?Matt Nelson
05/17/2025, 2:17 PMXinzhengZhang
05/19/2025, 5:28 PMJeffrey Bush
05/20/2025, 2:56 AMweak
, `unowned`/`unowned(safe)`, or unowned(unsafe)
. However, these specifications are not propagated into Kotlin in any way which means you can easily end up with memory access errors randomly if you don't save instances of the fields to other variables that you have more control over. Is there any way support for these could be added to the wrappers created by cinterop
and thus allow us to get warnings to greatly assist in tracking down these random and confusing issues?Nitesh Singh
05/20/2025, 12:23 PMXinzhengZhang
05/22/2025, 4:07 AMkonanc
for incremental compilation of the compiler frontend (Kotlin Ir klib)? I saw -Xuse-fir-ic
and -Xuse-fir-lt
in konanc -X
, which seem to be only effective for JVM and only for Maven compiler.dhia chemingui
05/24/2025, 2:33 PMloke
05/25/2025, 5:40 PMplatform.posix
. However, I'm trying to use pthread_cleanup_push
and it doesn't seem to exist in this package. In fact, I can't see it anywhere. Is this a bug? Should I report it?jQrgen
05/26/2025, 2:03 PM./gradlew iosSimulatorArm64Test
Maybe there is some sub-dependency that is misaligned such as described here? https://kotlinlang.org/docs/whatsnew19.html#library-linkage-in-kotlin-native
Logs:
kotlin.native.internal.IrLinkageError: Function 'CanvasLayersComposeScene' can not be called: No function found for symbol 'androidx.compose.ui.scene/CanvasLayersComposeScene|CanvasLayersComposeScene(androidx.compose.ui.unit.Density;androidx.compose.ui.unit.LayoutDirection;androidx.compose.ui.unit.IntSize?;kotlin.coroutines.CoroutineContext;androidx.compose.ui.scene.ComposeSceneContext;kotlin.Function0<kotlin.Unit>){}[0]'
kotlin.native.internal.IrLinkageError: Function 'CanvasLayersComposeScene' can not be called: No function found for symbol 'androidx.compose.ui.scene/CanvasLayersComposeScene|CanvasLayersComposeScene(androidx.compose.ui.unit.Density;androidx.compose.ui.unit.LayoutDirection;androidx.compose.ui.unit.IntSize?;kotlin.coroutines.CoroutineContext;androidx.compose.ui.scene.ComposeSceneContext;kotlin.Function0<kotlin.Unit>){}[0]'
at kotlin.Throwable#<init>(/opt/buildAgent/work/7377bd4dc65e1c03/kotlin/kotlin-native/runtime/src/main/kotlin/kotlin/Throwable.kt:30)
at kotlin.Error#<init>(/opt/buildAgent/work/7377bd4dc65e1c03/kotlin/kotlin-native/runtime/src/main/kotlin/kotlin/Exceptions.kt:12)
at kotlin.native.internal.IrLinkageError#<init>(/opt/buildAgent/work/7377bd4dc65e1c03/kotlin/kotlin-native/runtime/src/main/kotlin/kotlin/native/internal/RuntimeUtils.kt:133)
at kotlin.native.internal#ThrowIrLinkageError(/opt/buildAgent/work/7377bd4dc65e1c03/kotlin/kotlin-native/runtime/src/main/kotlin/kotlin/native/internal/RuntimeUtils.kt:137)
at androidx.compose.ui.test.SkikoComposeUiTest.createUi#internal(/opt/buildAgent/work/8a20760945d0aeba/compose/ui/ui-test/src/skikoMain/kotlin/androidx/compose/ui/test/ComposeUiTest.skikoMain.kt:221)
at androidx.compose.ui.test.SkikoComposeUiTest.SkikoComposeUiTest$withScene$$FUNCTION_REFERENCE_FOR$createUi$1.invoke#internal(/opt/buildAgent/work/8a20760945d0aeba/compose/ui/ui-test/src/skikoMain/kotlin/androidx/compose/ui/test/ComposeUiTest.skikoMain.kt:194)
at kotlin.Function0#invoke(/Users/teamcity/.gradle/daemon/8.11.1/[K][Suspend]Functions:1)
//...
Mikolaj
05/29/2025, 8:17 AMStefan Oltmann
06/04/2025, 4:36 AMhugo
06/04/2025, 3:25 PMrkechols
06/06/2025, 5:09 AMsergey.bogolepov
06/09/2025, 9:24 AMStefan Oltmann
06/10/2025, 7:35 AMAdolfo Ochagavía
06/13/2025, 1:55 AMzt
06/16/2025, 11:39 AMheaders = libavutil/avutil.h libavutil/pixfmt.h libavutil/pixdesc.h libavutil/dict.h libavutil/crc.h libavutil/hwcontext.h \
libavutil/imgutils.h libavutil/rational.h libavutil/log.h libavcodec/avcodec.h libavformat/avformat.h
headerFilter = libavutil/** libavcodec/** libavformat/**
package = ffmpeg
compilerOpts.linux = -I/usr/include -I/usr/include/x86_64-linux-gnu -I/usr/include/ffmpeg
linkerOpts.osx = -L/opt/local/lib -L/usr/local/opt/curl/lib -lavutil -lavcodec -lavformat
linkerOpts.linux = -L/usr/lib/x86_64-linux-gnu -L/usr/lib -lavutil -lavcodec -lavformat
nonStrictEnums = AVCRCId AVHWDeviceType
---
struct AVDictionary {
int count;
AVDictionaryEntry *elems;
};
typedef void (*simple_log_callback_t)(void*, int, const char*, void*);
static inline simple_log_callback_t av_log_default_callback2() {
return (simple_log_callback_t)av_log_default_callback;
}
static inline void av_log_set_callback2(simple_log_callback_t callback) {
av_log_set_callback((void (*)(void*, int, const char*, va_list))callback);
}
Distractic
06/21/2025, 7:01 AMSkolson5903
06/22/2025, 7:25 PM#include "getrandom_wrapper.h"
ssize_t call_getrandom(void *buf, size_t buflen, unsigned int flags) {
return getrandom(buf, buflen, flags);
}
and the header is this:
#include <sys/random.h>
// Wrapper function to call getrandom()
ssize_t wrapper_getrandom(void *buf, size_t buflen, unsigned int flags);
This compiles and links fine using gcc and produces a small static library. The .def file looks like this:
headers = getrandom_wrapper.h
package = com.oldguy.crypto
linkerOpts = -L.,/usr/include/x86_64-linux-gnu/ -lgetrandom_wrapper
The gradle setup for linuxX64 cinterop is this:
compilations.getByName("main") {
val path = "${project.rootDir}/KmpCrypto/src/linuxMain/cinterop"
cinterops {
val myLibraryCinterop by creating {
defFile(project.file("$path/getrandom_wrapper.def"))
includeDirs(path, "/usr/include/x86_64-linux-gnu") // Ubuntu location of sys/random.h
}
}
}
At cinterop (gradle sync) time, this error pops:
/usr/include/x86_64-linux-gnu/sys/cdefs.h:153:34: error: function-like macro '__glibc_clang_prereq' is not defined
Has anyone else seen this and knows what causes it? This macro should be defined by the sys/features.h that gets pulled in by sys/random.h. The code snippet from features.h that isn't working looks like this:
/* Similarly for clang. Features added to GCC after version 4.2 may
or may not also be available in clang, and clang's definitions of
__GNUC(_MINOR)__ are fixed at 4 and 2 respectively. Not all such
features can be queried via __has_extension/__has_feature. */
#if defined __clang_major__ && defined __clang_minor__
# define __glibc_clang_prereq(maj, min) \
((__clang_major__ << 16) + __clang_minor__ >= ((maj) << 16) + (min))
#else
# define __glibc_clang_prereq(maj, min) 0
#endif
Thanks in advance for any ideas on how to diagnose/fix this.rkechols
06/23/2025, 2:51 AMJimmy Nelle
06/25/2025, 1:58 PMSkolson5903
06/28/2025, 12:03 AMld.lld: error: undefined symbol: fcntl64
I think fcntl
was renamed to fcntl64
in glibc 2.28, and I'm afraid this is newer than the native konan stack is handling. I tried this line in the .def:
linkerOpts.linux = --allow-shlib-undefined -L/usr/lib/x86_64-linux-gnu -licui18n -licuuc -licudata -lz -llzma -lpthread
hoping that the --allow option would tell the linker to ignore the missing symbol, but no help. Libxml2 required all those other libs. Has anyone seen this issue with the fcntl64 undefined symbol and have a fix/workaround?CLOVIS
06/29/2025, 6:18 PMHamid
06/30/2025, 1:35 PMinternal fun LogMessage.detail(data: NSData?, operation: Operation) {
detail(data?.toByteArray(), operation)
}
internal fun LogMessage.detail(error: NSError?) {
if (error != null) detail("error", error.toString())
}
internal fun LogMessage.detail(service: CBService? = null) {
detail("service", service?.UUID?.UUIDString ?: "Unknown UUID")
}
internal fun LogMessage.detail(characteristic: CBCharacteristic) {
val serviceUuid = characteristic.service
?.UUID
?.toUuid()
if (serviceUuid == null) {
detail("service", "Unknown (null value)")
return
}
detail(serviceUuid, characteristic.UUID.toUuid())
}
internal fun LogMessage.detail(descriptor: CBDescriptor) {
val characteristic = descriptor.characteristic
if (characteristic == null) {
detail("characteristic", "Unknown (null value)")
return
}
val serviceUuid = characteristic.service
?.UUID
?.toUuid()
if (serviceUuid == null) {
detail("service", "Unknown (null value)")
return
}
detail(
serviceUuid,
characteristic.UUID.toUuid(),
descriptor.UUID.toUuid(),
)
}
and this is the error I got.
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[CBDescriptor service]: unrecognized selector sent to instance 0x1086a94d0'
*** First throw call stack:
(0x193fff21c 0x191499abc 0x194069614 0x193f13a1c 0x193f13aa0 0x10dddacf0 0x10ddd1a98 0x10ddd4538 0x1bd7cad94 0x1bd7caec4 0x1bd7c7a18 0x1bd786a40 0x1bd78422c 0x1bd784114 0x1034a8584 0x1034c2064 0x1034b091c 0x1034b15d8 0x1034b0758 0x1034b15a4 0x1034bd894 0x1034bceb0 0x21e5f4a0c 0x21e5f4aac)
libc++abi: terminating due to uncaught exception of type NSException
and I also attached the XCode error. Anyone has any idea how to fix it? please let me know if more information is needed.
Thread in Slack Conversationאליהו הדס
07/01/2025, 2:33 AMVaibhav Jaiswal
07/01/2025, 11:19 AMkotlin.native.cocoapods
plugin and by using this
pod("...") { ..... }
Mats-Hjalmar
07/02/2025, 8:02 AMdyld[4166]: Symbol not found: __ZTINSt3__117bad_function_callE
Referenced from:
/private/var/containers/Bundle/Application/[my app].debug.dylib
Expected in: /usr/lib/libc++.1.dylib
It was working before then i upgraded a few libraries.
My current versions:
kotlin = "2.2.0"
agp = "8.5.2"
compose = "1.8.2"
composeCompiler = "1.5.15"
However, when i build the app for iPhone XS it works.
And if i revert to these versions
kotlin = "2.0.20"
agp = "8.5.0"
compose = "1.7.0"
composeCompiler = "1.5.14"
It works on both iPad and iPhone.