Matthew Murray
08/04/2022, 9:26 PMnatario1
08/05/2022, 2:47 PMbrabo-hi
08/05/2022, 7:09 PM*Calling Kotlin suspend functions from Swift/Objective-C is currently supported only on main thread*
any cluenapperley
08/08/2022, 2:57 AMp4czyk
08/08/2022, 7:03 PMkotlinx
library like kotlinx-datetime
for LinuxArm64 and use it in my project? 🤔Joakim Forslund
08/09/2022, 3:59 PMpacman -S mingw-w64-x86_64-headers-git
directx.def
=======================
package = directx
headers = windows.h windowsx.h stdint.h d3dcommon.h d3d11.h winuser.h dxgi.h
headerFilter = windows.h windowsx.h stdint.h d3dcommon.h d3d11.h winuser.h dxgi.h
libraryPaths = C:/msys64/mingw64/x86_64-w64-mingw32/lib C:/msys64/mingw64/lib
linkerOpts = -LC:/msys64/mingw64/lib -LC:/msys64/mingw64/x86_64-w64-mingw32/lib -ldxguid -ld3d11 -ldxgi -lstdc++ -DUNICODE
compilerOpts = -LC:/msys64/mingw64/lib -LC:/msys64/mingw64/x86_64-w64-mingw32/lib -ldxguid -ld3d11 -ldxgi -lstdc++ -DUNICODE
---
Problematic code:
val dxgiDevice: IDXGIDevice = alloc()
println("Device instance: ${D3DDevice.ptr}")
val vtable = D3DDevice.lpVtbl?.pointed
println("Trying to make use of virtual table... P: $vtable")
hr = vtable?.QueryInterface?.invoke(D3DDevice.ptr, IID_IDXGIDevice.ptr, dxgiDevice.ptr.pointed.reinterpret()) ?: 0
println("3")
if(FAILED(hr)){
MessageBoxA(null ,"D3DDevice->QueryInterface failed", null, 0)
}else{
println("D3DDevice->QueryInterface success!")
}
We never reach println("3"), and I'm not getting any exception reasons or missing importsGoth
08/09/2022, 7:08 PMspierce7
08/10/2022, 1:46 AMLei Lei
08/10/2022, 11:46 PMcstubs.bc
file insider, can not find any kotlin bindings, does anyone know how to get kotlin bindings for those platform libraries?Landry Norris
08/11/2022, 4:46 PMTim Ortel
08/14/2022, 1:10 PMDidier Villevalois
08/14/2022, 2:06 PMnull
and line numbers are `-1`:
DealerRouterTests.base (cio, cio) FAILED
kotlinx.coroutines.TimeoutCancellationException at null:-1
The said stacktrace is produced while running native tests of Kzmq. Note that this project consists of multiple sub-projects (:kzmq-core
, :kzmq-cio
, ...) and the tests are located in their own sub-project (:kzmq-tests
).Nikky
08/16/2022, 11:10 PMkotlin.native.binary.sourceInfoType=libbacktrace
and it seems to work locally fine on macosArm64
, but when crosscompiling to mingw64
as usual.. stuff starts to break down, both on my macbook and ubuntu CI runner
i get
e: /Users/nikky/.konan/dependencies/apple-llvm-20200714-macos-aarch64-essentials/bin/clang++ invocation reported errors
The /Users/nikky/.konan/dependencies/apple-llvm-20200714-macos-aarch64-essentials/bin/clang++ command returned non-zero exit code: 1.
output:
lld-link: error: undefined symbol: Kotlin_getSourceInfo_libbacktrace
>>> referenced by /var/folders/wp/xphwwgsj3zg4w61bkrh4sdvm0000gn/T/konan_temp18158004099953611372/result.o:(Kotlin_getSourceInfo_Function)
clang-11: error: linker command failed with exit code 1 (use -v to see invocation)
FAILURE: Build failed with an exception.
does anyone know what package i might need to install ?
or how to configure libbacktrace only for linux and macos targets ?ankushg
08/19/2022, 7:33 AMCrashed: GC thread
0 QuizletSharedKotlin 0x919294 std::__1::invoke_result<kotlin::gc::ConcurrentMarkAndSweep::ConcurrentMarkAndSweep(kotlin::mm::ObjectFactory<kotlin::gc::ConcurrentMarkAndSweep>&, kotlin::gc::GCScheduler&)::$_2>::type kotlin::ScopedThread::Run<kotlin::gc::ConcurrentMarkAndSweep::ConcurrentMarkAndSweep(kotlin::mm::ObjectFactory<kotlin::gc::ConcurrentMarkAndSweep>&, kotlin::gc::GCScheduler&)::$_2>(kotlin::ScopedThread::attributes, kotlin::gc::ConcurrentMarkAndSweep::ConcurrentMarkAndSweep(kotlin::mm::ObjectFactory<kotlin::gc::ConcurrentMarkAndSweep>&, kotlin::gc::GCScheduler&)::$_2&&) + 1292
1 QuizletSharedKotlin 0x91a214 void* std::__1::__thread_proxy<std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, void (*)(kotlin::ScopedThread::attributes, kotlin::gc::ConcurrentMarkAndSweep::ConcurrentMarkAndSweep(kotlin::mm::ObjectFactory<kotlin::gc::ConcurrentMarkAndSweep>&, kotlin::gc::GCScheduler&)::$_2&&), kotlin::ScopedThread::attributes, kotlin::gc::ConcurrentMarkAndSweep::ConcurrentMarkAndSweep(kotlin::mm::ObjectFactory<kotlin::gc::ConcurrentMarkAndSweep>&, kotlin::gc::GCScheduler&)::$_2> >(void*) + 112
2 libsystem_pthread.dylib 0x19ac _pthread_start + 148
3 libsystem_pthread.dylib 0xe68 thread_start + 8
It’s super hard for us to create a minimal reproduction of this, but in case it’s relevant, we’ve been able to repro this with:
• Kotlin 1.7.10 and 1.7.20-Beta
• SqlDelight 1.5.3 and 2.0.0-alpha03
• kotlinx.coroutines 1.6.4 (without the -native-mt
suffix)
• KMP-NativeCoroutines 0.12.6-new-mm
Any tips on how to narrow this down?Benjamin Charais
08/19/2022, 5:48 PMframework {
baseName = "RedShirt"
isStatic = true
embedBitcode(BITCODE)
}
pod("xxxxx") {
moduleName = "xxxx"
}
useLibraries()
Using Kotlin 1.7.10
currently, the build goes swimmingly, and it very much seems that everything is in place, removing the pod, drastically impacts the output file size. I am running my output via podPublishReleaseXCFramework
incase that has any bearing.
The issue comes in when importing in XCode. It imports and references everything as expected, but when trying to build it will rarely, and intermittently work. The most common experience is the build failing with arm64
errors around:
Undefined symbols for architecture arm64:
"_OBJC_CLASS_$_UIDevice", referenced from:
objc-class-ref in RedShirt(result.o)
Showing Recent Messages
Undefined symbol: _OBJC_CLASS_$_UIDevice
This error is not specific to arm, based on the build target.
I haven't been able to track down any source on this kind of issue, everything is a brand new empty, and simple project. I don't believe I am missing anything, but this inconsistency is making things difficult.eTristan
08/20/2022, 1:08 AMCompiler version info: Konan: 1.7.0 / Kotlin: 1.7.20
I am getting these kind of errors
api.cpp:14475:871: error: unknown type name 'libnative_kref_kotlin_UInt'; did you mean 'libnative_kref_kotlin_Int'?
api.cpp:14412:1533: error: unknown type name 'libnative_kref_kotlin_ULong'; did you mean 'libnative_kref_kotlin_Long'?
The documentation seems to say it should be supported.Mahmoud Ahmed
08/20/2022, 4:42 AMTim Ortel
08/20/2022, 9:19 PMUncaught Kotlin exception: kotlin.native.concurrent.InvalidMutabilityException: mutation attempt of frozen kotlinx.coroutines.internal.DispatchedContinuation
runBlocking {
withContext(Dispatchers.Main) {
suspendCoroutine { c ->
//handler is called from another thread.
val handler = { x -> c.resume(x) }
//Internally, schedules the work on another thread.
//Therefore, c.resume() fails, as c is frozen.
some_api_that_schedules_another_thread(handler)
}
}
}
Is there any way around of this. Changing the internal API is not possible.Alexandre Gressier
08/21/2022, 1:11 PMxcodebuild -workspace MyLibInterop.xcworkspace -scheme MyLibInterop -sdk $sdk -configuration Release build SYMROOT=$PWD/build OBJROOT=$PWD/build
, and finally creating a cinterop configuration via Gradle and a .def file. It works quite well. My setup is very similar to the one explained here: https://medium.com/kodein-koders/create-a-kotlin-multiplatform-library-with-swift-1a818b2dc1b0 (the ChachaPoly one). However I encounter a problem as soon as I start to add dependencies to this static library: I don’t know how to tell cinterop where to look for the dependency frameworks used by the static library. I used Cocoapods (without Gradle) to define the dependencies. The previous xcodebuild
command then outputs several .framework directories that represent the dependencies in addition to the existing .h and .a files. My exact issue is ``ld: warning: Could not find or use auto-linked framework 'Amplify'` which is one of the .framework directories when running the task shared:linkPodDebugFrameworkIosArm64
. I suppose that I have to define a recursive framework search path within my Kotlin cinterop configuration (i.e., the .def file). I came across the -F
and -framework
linker & compiler options but used them without any success. Thank you in anticipation for any kind of help you will be able to provide me with. I can provide any info or piece of code you need.Sterling Albury
08/22/2022, 1:34 AMembedAndSignAppleFrameworkForXcode
task, but I don't think the task is getting executed from xcode. I've added a run script to the build phases to run the task for my module, but when i build the xcode project, it's failing when trying to link the framework - the path doesn't exist. I can confirm that there's no build folder for the xcode framework in my kmp module. not sure what I'm doing wrongSterling Albury
08/22/2022, 5:17 PMkevin.cianfarini
08/23/2022, 2:04 AMDidier Villevalois
08/23/2022, 7:56 PMSeikoDes
08/24/2022, 5:53 AM.h
.a
is working, but currently in KMP it prompts:
Undefined symbols for architecture x86_64:
"_CTFontGetXHeight", referenced from:
SkScalerContext_Mac::generateFontMetrics(SkFontMetrics*) in libskia.a(fontmgr_mac_ct.SkScalerContext_mac_ct.o)
"_CTFontGetUnderlineThickness", referenced from:
SkScalerContext_Mac::generateFontMetrics(SkFontMetrics*) in libskia.a(fontmgr_mac_ct.SkScalerContext_mac_ct.o)
"_CTFontGetUnderlinePosition", referenced from:
SkScalerContext_Mac::generateFontMetrics(SkFontMetrics*) in libskia.a(fontmgr_mac_ct.SkScalerContext_mac_ct.o)
"_CTFontGetAdvancesForGlyphs", referenced from:
SkScalerContext_Mac::generateMetrics(SkGlyph*, SkArenaAlloc*) in libskia.a(fontmgr_mac_ct.SkScalerContext_mac_ct.o)
"_CTFontCreatePathForGlyph", referenced from:
SkScalerContext_Mac::generateMetrics(SkGlyph*, SkArenaAlloc*) in libskia.a(fontmgr_mac_ct.SkScalerContext_mac_ct.o)
SkScalerContext_Mac::generatePath(SkGlyph const&, SkPath*) in libskia.a(fontmgr_mac_ct.SkScalerContext_mac_ct.o)
"_CTFontDrawGlyphs", referenced from:
SkCTFontGetSmoothBehavior() in libskia.a(libskia.SkCTFont.o)
SkScalerContext_Mac::Offscreen::getCG(SkScalerContext_Mac const&, SkGlyph const&, unsigned short, unsigned long*, bool) in libskia.a(fontmgr_mac_ct.SkScalerContext_mac_ct.o)
"_kCTFontVariationAxisMinimumValueKey", referenced from:
SkCTVariationFromSkFontArguments(__CTFont const*, SkFontArguments const&) in libskia.a(fontmgr_mac_ct.SkTypeface_mac_ct.o)
SkTypeface_Mac::onGetVariationDesignParameters(SkFontParameters::Variation::Axis*, int) const in libskia.a(fontmgr_mac_ct.SkTypeface_mac_ct.o)
"_CTFontGetSize", referenced from:
...
"_CTFontGetSymbolicTraits", referenced from:
create_from_name(char const*, SkFontStyle const&) in libskia.a(fontmgr_mac_ct.SkFontMgr_mac_ct.o)
SkTypeface_Mac::Make(std::__1::unique_ptr<__CTFont const, SkFunctionWrapper<void (void const*), &(CFRelease)> >, OpszVariation, std::__1::unique_ptr<SkStreamAsset, std::__1::default_delete<SkStreamAsset> >)::$_0::operator()() const in libskia.a(fontmgr_mac_ct.SkTypeface_mac_ct.o)
SkTypeface_Mac::onGetAdvancedMetrics() const in libskia.a(fontmgr_mac_ct.SkTypeface_mac_ct.o)
"_kCTFontFamilyNameKey", referenced from:
SkTypeface_Mac::onCreateFamilyNameIterator() const in libskia.a(fontmgr_mac_ct.SkTypeface_mac_ct.o)
"_CTFontCollectionCreateMatchingFontDescriptors", referenced from:
(anonymous namespace)::SkCopyAvailableFontFamilyNames(__CTFontCollection const*) in libskia.a(fontmgr_mac_ct.SkFontMgr_mac_ct.o)
"_CTFontCopyAttribute", referenced from:
SkCTFontCreateExactCopy(__CTFont const*, double, OpszVariation) in libskia.a(fontmgr_mac_ct.SkTypeface_mac_ct.o)
SkTypeface_Mac::onOpenStream(int*) const in libskia.a(fontmgr_mac_ct.SkTypeface_mac_ct.o)
"_CTFontCreateForString", referenced from:
SkFontMgr_Mac::onMatchFamilyStyleCharacter(char const*, SkFontStyle const&, char const**, int, int) const in libskia.a(fontmgr_mac_ct.SkFontMgr_mac_ct.o)
ld: symbol(s) not found for architecture x86_64
demo: https://github.com/qdsfdhvh/compose-hellorustkevin.cianfarini
08/25/2022, 1:31 PMWhen applied, the CocoaPods plugin does the following:
• Creates aWithout the support of swift package manager as part of the gradle build process, we’re left to use cocoapods or manually install the SDK. We’d prefer not to do this manually if we can avoid it.task which generates a Podspec file for the project.podspec
Tristan
08/31/2022, 3:20 AM/common
I have nativeMain
, so /common/nativeMain
and I’d like this folder to be use for macosX64 and linuxX64.
I tried something like this, but it does seem to be it (I am getting KotlinSourceSet not found)
val nativeMain by creating {
dependsOn(commonMain)
dependencies {
implementation(Deps.Ktor.clientCurl)
}
}
val nativeTest by creating {
dependsOn(commonTest)
}
val macosX64 by getting {
dependsOn(nativeMain)
}
Adam Cooper
08/31/2022, 4:20 AMtry ... finally
pattern, but I would prefer to not have to create an additional scope to accomplish what I am trying to do.Adam Cooper
08/31/2022, 4:29 AMchar **
to write to, but what would be the best way to pass, say, an int *
or any other primitive pointer? I can use alloc
within memScoped
, but is there any way to use a variable on the stack rather than the heap?msink
09/01/2022, 11:00 AMmingw
target and using extra precompiled libs from MSYS2 distribution - adding -Ldir -lfoo
does not work, but adding dir/libfoo.a
(full path to .a file) - works?K Merle
09/02/2022, 6:46 AMK Merle
09/02/2022, 6:46 AMArkadii Ivanov
09/02/2022, 2:54 PMAlex Acosta
09/02/2022, 2:55 PM