kpgalligan
11/02/2020, 1:37 PMv79
11/02/2020, 6:20 PMlibcurl.so
because the true library file was libcurl.so.4.5.0
- just a naming problem.Leon K
11/02/2020, 11:51 PMxcb_connection = create_xcb_connection();
xcb_setup = xcb_get_setup(xcb_connection);
xcb_screen_iterator = xcb_setup_roots_iterator(xcb_setup);
xcb_screen = xcb_screen_iterator.data;
xcb_root = xcb_screen->root;
and this is the kotlin counterpart to the c code above, but it unfortunately crashes with a null-pointer,
import kotlinx.cinterop.*
import xcb.*
fun main() {
val connection = xcb_connect(null, null)
val xcb_setup = xcb_get_setup(connection)!!
val xcb_screen_iterator = xcb_setup_roots_iterator(xcb_setup)
// val xcb_screen = xcb_screen_iterator.placeTo(scope).pointed.data!!
// This !! crashes, indicating that the data value here is null. in the equivalent C code shown above,
// This exact same value is _not_ null however, which makes us think
// that we are wrongly using the Kotlin/Native C interop somehow.
val xcb_screen = xcb_screen_iterator.useContents { data }!!
val xcb_root = xcb_screen.pointed.root
println("okidoki")
}
As described in the comment, we're getting a null value on xcb_screen_iterator.useContents { data }
, which - as far as we understand - should be equivalent to the C code given above, which does work.
Any help would be appreciated. LIkely, we're just failing to understand how to use kotlin native's C interopArnaud Vallat
11/03/2020, 12:17 AMElias
11/04/2020, 11:55 AMphisch
11/04/2020, 2:43 PMArnaud Vallat
11/04/2020, 5:01 PMVinod Rai
11/05/2020, 8:53 AM2020-11-05T14:06:50.543+0530 [ERROR] [system.err] e: Compilation failed: null
* Compiler version info: Konan: 1.4.10 / Kotlin: 1.4.10
2020-11-05T14:06:50.543+0530 [ERROR] [system.err] * Output kind: LIBRARY
2020-11-05T14:06:50.543+0530 [ERROR] [system.err]
2020-11-05T14:06:50.544+0530 [ERROR] [system.err] e: java.lang.StackOverflowError
2020-11-05T14:06:50.544+0530 [ERROR] [system.err] at org.jetbrains.kotlin.psi2ir.generators.IrSyntheticDeclarationGenerator.visitCall(IrSyntheticDeclarationGenerator.kt:17)
2020-11-05T14:06:50.544+0530 [ERROR] [system.err] at org.jetbrains.kotlin.ir.expressions.impl.IrCallImpl.accept(IrCallImpl.kt:78)
2020-11-05T14:06:50.544+0530 [ERROR] [system.err] at org.jetbrains.kotlin.ir.expressions.impl.IrMemberAccessExpressionBase.acceptChildren(IrMemberAccessExpressionBase.kt:57)
2020-11-05T14:06:50.544+0530 [ERROR] [system.err] at org.jetbrains.kotlin.ir.expressions.impl.IrCallWithIndexedArgumentsBase.acceptChildren(IrCallWithIndexedArgumentsBase.kt:63)
2020-11-05T14:06:50.544+0530 [ERROR] [system.err] at org.jetbrains.kotlin.ir.visitors.IrElementVisitorVoidKt.acceptChildrenVoid(IrElementVisitorVoid.kt:275)
william
11/06/2020, 12:08 AMatomic(...)
?
i understand that the object in atomic
is frozen, but its unclear to me why it can be mutated.
(also what does fu
stand for / mean?)Jamie Craane
11/06/2020, 8:54 AMCaused by: java.lang.ClassNotFoundException: Greeting
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:602)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
... 1 more
2. (https://github.com/jcraane/kmm-with-jvmmodule/tree/jvm-mp-lib) (inspired by kotlinconf app)
jvmmodule is configured as a multiplatform module with a single jvm target and a project dependency on the shared module. In this scenario
code completion works in IntelliJ but when the Test class is run from the gutter icon the following error occurs:
Error: Could not find or load main class TestKt
Caused by: java.lang.ClassNotFoundException: TestKt
Is this the correct way of using shared code from a plain kotlin (kvm) module?v79
11/07/2020, 8:58 AMtypedef enum
{
BCM2835_GPIO_FSEL_INPT = 0x00,
...
} bcm2835FunctionSelect;
I have added this as a strictEnum to `libbcm.def`:
strictEnums = bcm2835FunctionSelect
Then when I try to use it in Kotlin code, there are two issues. Firstly, I have to use it rather verbosely:
bcm2835_gpio_fsel(pin, bcm2835FunctionSelect.BCM2835_GPIO_FSEL_INPT.value.toUByte());
And secondly it doesn't compile, with the following error:
e: kotlin.UninitializedPropertyAccessException: Parent not initialized: org.jetbrains.kotlin.ir.declarations.impl.IrEnumEntryImpl@31d85176
at org.jetbrains.kotlin.ir.declarations.impl.IrDeclarationBase.getParent(IrDeclarationBase.kt:39)
at org.jetbrains.kotlin.ir.util.IrUtilsKt.getParentAsClass(IrUtils.kt:286)
at org.jetbrains.kotlin.backend.konan.ir.interop.cenum.CEnumCompanionGenerator.generateAliasGetterBody(CEnumCompanionGenerator.kt:84)
It looks like I've found a bug, but maybe I'm doing something wrong?tieskedh
11/08/2020, 5:42 PM(1,9) Module JWTDecode not found.
The project has objc-attributes added: https://github.com/auth0/JWTDecode.swift/pull/55
The top-level pod uses: use_frameworks!
(It also has the JWTDecode-dependency...)
I do have:
// Revert to just ios() when gradle plugin can properly resolve it
val onPhone = System.getenv("SDK_NAME")?.startsWith("iphoneos") ?: false
if (onPhone) {
iosArm64("ios")
} else {
iosX64("ios")
}
which maybe explains the difference? But removing the if and trying first one and then the other also didn't seem to work.
Can anyone help me?Nikky
11/10/2020, 12:31 AMKamilH
11/10/2020, 1:14 PMProvider<T>
interface and Singleton<T>
abstract class (code in thread). It works very well, however when I’m testing it on iOS I’m keep getting Uncaught Kotlin exception: kotlin.native.concurrent.InvalidMutabilityException: mutation attempt of frozen
when trying to get()
on Singleton
. How can I fix it without using object
and ThreadLocal
?max.cruz
11/11/2020, 1:18 AMval scope = CoroutineScope(Dispatchers.Main + SupervisorJob())
...
scope.launch {
val something = withContext(Dispatchers.Default) { suspendCall() }
println(something)
}
Works fine in Andorid but in iOS I get:
Uncaught Kotlin exception: kotlin.native.IncorrectDereferenceException: illegal attempt to access non-shared <object>@3faca88 from other thread
Daniel Gruber
11/13/2020, 9:38 AMv79
11/13/2020, 3:19 PMVaclav Hodek
11/14/2020, 12:54 PMSBNTT
11/16/2020, 12:03 AMAlexander Black
11/17/2020, 6:57 PMsuspend fun HttpClient.downloadFile(
output: File,
downloadUrl: Url,
md5Hash: String
): Flow<DownloadResult> {
return flow {
try {
val response = get<HttpResponse> { url(downloadUrl) }
val data = ByteArray(response.contentLength()?.toInt() ?: 0)
var offset = 0
do {
val progress = (offset.toDouble() / data.size) * 100
emit(DownloadResult.Progress(progress))
val currentRead = response.content.readAvailable(data, offset, data.size)
offset += currentRead
} while (currentRead > 0)
if (response.status.isSuccess()) {
if (data.md5().hex == md5Hash) {
output.write(data)
emit(DownloadResult.Success)
} else {
emit(DownloadResult.ErrorCorruptFile)
}
} else {
emit(DownloadResult.ErrorBadResponseCode(response.status.value))
}
} catch (e: TimeoutCancellationException) {
emit(DownloadResult.ErrorRequestTimeout("Connection timed out", e))
} catch (t: Throwable) {
emit(DownloadResult.Error("Failed to connect", t))
}
}
}
The problem is that the response.content.readAvailable()
method always seems to read the whole file at once without chunking it up, which means my progress emission only gets outputted once. I’m wondering if there’s something I’m doing wrong here? or if that’s normal behaviour? Also as a side note the file I’m testing on is 25MB so it should emit a few times I’d think.Alexander Black
11/18/2020, 5:26 PMUndefined symbols for architecture x86_64:
"_OBJC_CLASS_$_Reachability", referenced from:
objc-class-ref in result.o
ld: symbol(s) not found for architecture x86_64
I’m thinking it has something to do with building from a .m and .h file and it not being a dynamic library, so the binaries are not included, but I’m not sure how to include them
here’s my def in my build.gradle.kts:
iosX64("ios") {
compilations.getByName("main") {
val reachabilityInterop by cinterops.creating {
defFile(project.file("src/nativeInterop/Reachability.def"))
val headerPath = project.file("src/nativeInterop/Reachability/").absoluteFile
compilerOpts("-I${headerPath}", "-L${headerPath}")
}
}
}
v79
11/19/2020, 7:25 AMaleksey.tomin
11/20/2020, 10:28 AMapp.finishLaunching()
while (active.value) {
app.nextEventMatchingMask(NSEventMaskAny, null, NSDefaultRunLoopMode, true)?.let {
app.sendEvent(it)
}
runBlocking {
delay(100.milliseconds)
}
}
But now hotkeys (cmd+Q) and window’s button close
don’t work.
How can I process this events manually in macOS code?
In main cycle? In Controller? In some NSWindow
field?Animesh Sahu
11/20/2020, 5:07 PMbenny.huo
11/23/2020, 8:05 AMdambakk
11/23/2020, 8:47 AMsealed class Response<out T : Any> {
data class Success<out T : Any>(val data: T) : Response<T>()
data class Error(val reason: ErrorReason) : Response<Nothing>()
}
Receiving success in ios is ok. However, we are not able to cast the result to an Response.Error
. When printing the object to console ((lldb) e dump(response)
) we can see that it is an Optional(Error)
object with all the params we are looking for, but we cannot cast it to en Error in any way. Anyone knows what we have to do?Alex Gladkov
11/23/2020, 11:50 AMMichal Klimczak
11/23/2020, 12:25 PMktor
I get an error (i have narrowed it down to an issue with initializing ktor serializer)
. Not specifically asking about the serializer issue right now, but tell me - is this how the error reports are supposed to look (local build, local simulator), or do I need to somehow symbolicate the debug builds as well? It seems that everyone talks about symbolication of kotlin-native reports in crashlytics in release builds, no one mentions how it works during development.Oleg Yukhnevich
11/23/2020, 1:18 PMsteelahhh
11/24/2020, 2:48 PMSymbol with IrSimpleFunctionSymbolImpl is unbound
when running linkDebugFrameworkIos(Arm64, X64)
After some investigation, it turned out that the piece of code causing this exception is this:
lateinit var property: String
private set
Without private set
it builds just fine. Is it a known issue?