Vlad Balan
02/13/2020, 1:07 PMkotlin{
linuxArm64()
}
I am interested in creating a custom target for arm64 where I can specify what compiler/linker options I want to use.
Thanks in advance!andreasmattsson
02/14/2020, 1:39 PM-kotlin_version=1.3.50
-kotlin_coroutines_version=1.3.0
-kotlin_serialization_version=0.12.0
+kotlin_version=1.3.61
+kotlin_coroutines_version=1.3.3
+kotlin_serialization_version=0.14.0
I'm getting this error:
> Task :Common:generateDefFlutter UP-TO-DATE
> Task :Common:cinteropFlutterIOS
> Task :Common:generateDefReactiveObjC
> Task :Common:cinteropReactiveObjCIOS FAILED
Exception in thread "Thread-3" java.lang.AssertionError: Assertion failed
at org.jetbrains.kotlin.native.interop.indexer.NativeIndexImpl.convertFunctionType(Indexer.kt:654)
at org.jetbrains.kotlin.native.interop.indexer.NativeIndexImpl.convertBlockPointerType(Indexer.kt:691)
at org.jetbrains.kotlin.native.interop.indexer.NativeIndexImpl.convertType(Indexer.kt:610)
at org.jetbrains.kotlin.native.interop.indexer.NativeIndexImpl.convertType$default(Indexer.kt:507)
at org.jetbrains.kotlin.native.interop.indexer.NativeIndexImpl.getTypedef(Indexer.kt:420)
at org.jetbrains.kotlin.native.interop.indexer.NativeIndexImpl.indexDeclaration(Indexer.kt:772)
at org.jetbrains.kotlin.native.interop.indexer.IndexerKt$indexDeclarations$$inlined$withIndex$lambda$1.indexDeclaration(Indexer.kt:985)
at org.jetbrains.kotlin.native.interop.indexer.UtilsKt$indexTranslationUnit$1$indexerCallbacks$1$4.invoke(Utils.kt:428)
at org.jetbrains.kotlin.native.interop.indexer.UtilsKt$indexTranslationUnit$1$indexerCallbacks$1$4.invoke(Utils.kt)
at kotlinx.cinterop.JvmCallbacksKt$createStaticCFunctionImpl$$inlined$ffiClosureImpl$3.invoke(JvmCallbacks.kt:489)
at kotlinx.cinterop.JvmCallbacksKt$createStaticCFunctionImpl$$inlined$ffiClosureImpl$3.invoke(JvmCallbacks.kt)
at kotlinx.cinterop.JvmCallbacksKt.ffiFunImpl(JvmCallbacks.kt:448)
at kotlinx.cinterop.JvmCallbacksKt.ffiFunImpl0(JvmCallbacks.kt:435)
FAILURE: Build failed with an exception.
I'm using two Pods defined in my cocoapods
-block:
cocoapods {
pod('Flutter', library_version)
pod('ReactiveObjC', "~> $reactive_objc_version")
}
(reactive_objc_version is 3.1)msink
02/16/2020, 8:47 AMursus
02/16/2020, 1:37 PMkpgalligan
02/16/2020, 7:26 PMval
properties with @SharedImmutable
work as expected, but if you use a var
, the @SharedImmutable
doesn’t apply. Logically that makes sense, but it seems like that may be confusing in situations where people try it. I think it would be better to have it frozen, or maybe a compiler failure, but right now it seems like the annotation is simply ignored. Thoughts?Nikita Khlebushkin
02/17/2020, 1:22 AM:podspec
and then I plug it to Podfile like this:
# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'
target 'AnalyticsDemo' do
# Comment the next line if you don't want to use dynamic frameworks
use_frameworks!
# Pods for AnalyticsDemo
pod "analytics", :path => "../analytics-root/analytics"
end
When I try to run it in Xcode, it successfully runs several Gradle tasks and then it fails with
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -target x86_64-apple-ios13.2-simulator -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.2.sdk -L/Users/xlebnick/Library/Developer/Xcode/DerivedData/AnalyticsDemo-cvvffnvreniysughwjnehpslgvqy/Build/Products/Debug-iphonesimulator -L/ -L/Users/xlebnick/Library/Developer/Xcode/DerivedData/AnalyticsDemo-cvvffnvreniysughwjnehpslgvqy/Build/Products/Debug-iphonesimulator/Analytics -F/Users/xlebnick/Library/Developer/Xcode/DerivedData/AnalyticsDemo-cvvffnvreniysughwjnehpslgvqy/Build/Products/Debug-iphonesimulator -FPods -FPods/Headers -FPods/Local\ Podspecs -FPods/Target\ Support\ Files -FPods/Target\ Support\ Files/Pods-AnalyticsDemo -FPods/Target\ Support\ Files/analytics -filelist /Users/xlebnick/Library/Developer/Xcode/DerivedData/AnalyticsDemo-cvvffnvreniysughwjnehpslgvqy/Build/Intermediates.noindex/AnalyticsDemo.build/Debug-iphonesimulator/AnalyticsDemo.build/Objects-normal/x86_64/AnalyticsDemo.LinkFileList -Xlinker -rpath -Xlinker @executable_path/Frameworks -dead_strip -Xlinker -object_path_lto -Xlinker /Users/xlebnick/Library/Developer/Xcode/DerivedData/AnalyticsDemo-cvvffnvreniysughwjnehpslgvqy/Build/Intermediates.noindex/AnalyticsDemo.build/Debug-iphonesimulator/AnalyticsDemo.build/Objects-normal/x86_64/AnalyticsDemo_lto.o -Xlinker -export_dynamic -Xlinker -no_deduplicate -Xlinker -objc_abi_version -Xlinker 2 -fobjc-link-runtime -L/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator -L/usr/lib/swift -Xlinker -add_ast_path -Xlinker /Users/xlebnick/Library/Developer/Xcode/DerivedData/AnalyticsDemo-cvvffnvreniysughwjnehpslgvqy/Build/Intermediates.noindex/AnalyticsDemo.build/Debug-iphonesimulator/AnalyticsDemo.build/Objects-normal/x86_64/AnalyticsDemo.swiftmodule -ObjC -lc++ -framework analytics -Xlinker -sectcreate -Xlinker __TEXT -Xlinker __entitlements -Xlinker /Users/xlebnick/Library/Developer/Xcode/DerivedData/AnalyticsDemo-cvvffnvreniysughwjnehpslgvqy/Build/Intermediates.noindex/AnalyticsDemo.build/Debug-iphonesimulator/AnalyticsDemo.build/AnalyticsDemo.app-Simulated.xcent -framework Pods_AnalyticsDemo -Xlinker -dependency_info -Xlinker /Users/xlebnick/Library/Developer/Xcode/DerivedData/AnalyticsDemo-cvvffnvreniysughwjnehpslgvqy/Build/Intermediates.noindex/AnalyticsDemo.build/Debug-iphonesimulator/AnalyticsDemo.build/Objects-normal/x86_64/AnalyticsDemo_dependency_info.dat -o /Users/xlebnick/Library/Developer/Xcode/DerivedData/AnalyticsDemo-cvvffnvreniysughwjnehpslgvqy/Build/Products/Debug-iphonesimulator/AnalyticsDemo.app/AnalyticsDemo
ld: framework not found analytics
clang: error: linker command failed with exit code 1 (use -v to see invocation)
My multiplatform module has name analytics
.
Why doesn't Xcode see my framework?napperley
02/17/2020, 5:02 AMVlad Balan
02/17/2020, 11:34 AM-Xoverride-clang-options
option is going to be available?
I am trying to compile for a custom arm64 target. My build.gradle.kts
contains the following section:
linuxArm64("arm64"){
binaries {
executable {
entryPoint = <entry_point>
freeCompilerArgs += listOf("-Xoverride-clang-options=-target-cpu=cortex-a53")
}
}
}
and it produces the following warning:
w: Flag is not supported by this version of the compiler: -Xoverride-clang-options=-target-cpu=cortex-a53
.
Did anybody succeed in compiling for a custom target?
Thanks in advance!Jaxon Du
02/17/2020, 10:06 PMpackage sample
import kotlinx.coroutines.runBlocking
fun hello(): String = "Hello, Kotlin/Native!"
fun main() {
runBlocking {
println(hello())
}
}
The error is “unresolved references” to coroutines and runBlocking. Heres the build.gradle file, which just adds the coroutine dependencies. What did I do wrong?
plugins {
id 'org.jetbrains.kotlin.multiplatform' version '1.3.61'
}
repositories {
mavenCentral()
}
kotlin {
macosX64("macos") {
binaries {
executable {
entryPoint = 'sample.main'
runTask?.args('')
}
}
}
sourceSets {
macosMain {
dependencies {
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.3'
}
}
macosTest {
}
}
}
Nikita Khlebushkin
02/18/2020, 12:43 AMcocoapods
plugin, specify cocoapods dependency and run :analytics:podspec
(where analytics
is my KMP module)
☑️ podspec is generated and I'm using the project from Podfile
☑️ import analytics
works in Xcode
☑️ iOS project with the aforementioned Podfile builds successfully
❌ import cocoapods.Analytics
is highlighted in red in Intellij Idea and causes compile errors such as Packages cannot be imported
How do I make the frameworks appear in Kotlin project? Many thanks in advance
Configuration files are attached to the threadmadhead
02/18/2020, 4:07 PMclass Node(prev: Node?, value: Char)
class Stack(tail: Node?)
Redis provides a specific API for memory allocation: void *RedisModule_Alloc(size_t bytes)
. They say it should be preferred over malloc
because “memory allocated with this function is reported in Redis INFO memory, used for keys eviction according to maxmemory settings and in general is taken into account as memory allocated by Redis”.
So, I want to use this API to allocate memory for my nodes. My plan was to reinterpret that pointers to my types later.
The problem is that I cannot find a way to know the size needed by my claasses, like sizeOf<Node>
. How do I know it?napperley
02/19/2020, 10:23 PMcamkadev
02/20/2020, 10:15 AMcurrent time in millis
?camkadev
02/20/2020, 10:18 AMschedule worker
that run continuously with fixed rate time (millis) before repeatJaxon Du
02/20/2020, 6:38 PMcamkadev
02/21/2020, 10:28 AMCould not resolve org.jetbrains.kotlinx:kotlinx-coroutines-core-native:1.3.3
in Kotlin MPP project, what should i do?
Kotlin 1.3.61
Gradle: 6.1.1
Kotlin DSL scriptPiet Bronders
02/22/2020, 2:57 PMSylvain Patenaude
02/24/2020, 4:18 PMEtienne
02/24/2020, 7:13 PMktor-client-curl
in their project? I’m running into linker issues, and would like to compare notes / build scripts.
(Keeping it short since I posted a long description in the #ktor channel, with no answers for now.)z3ntu
02/24/2020, 10:10 PMwchar_t *
in C that I try to convert to a kotlin string with kotlin native. I've used .toKStringFromUtf32()
which works well but it seems that the string has a trailing null byte which is not so pretty 🙂 Is that expected behavior? The documentation states Returns: the [kotlin.String] decoded from given zero-terminated UTF-32-encoded C string.
so my interpretation would be that this is a bug?Sylvain Patenaude
02/25/2020, 3:29 PMSander Saelmans
02/26/2020, 8:55 AMAppCenter
, AppCenterCrashes
, AppCenterAnalytics
, `KeychainWrapper`; And this seems to work well at this point.
However when I try to run the iOS application after interopting this framework: https://github.com/CAAPIM/iOS-MAS-Foundation (which works after modifying the imports in the header files slightly @import SomeFramework;
-> #import <SomeFramework/SomeFramework.h>
, #import <MASFoundation/SomeHeader.h>
-> #import "SomeHeader.h
), I get the following error when trying to boot up the application:
dyld: Library not loaded: /Library/Frameworks/MASFoundation.framework/MASFoundation
Referenced from: /Users/sandersaelmans/Library/Developer/Xcode/DerivedData/iosApp-dbelcoqoqidymygwatjnbtxoifby/Build/Products/Debug-iphonesimulator/app.framework/app
Reason: image not foundThe
.def
file I'm using looks like this:
language = Objective-C
package = com.mas
headers = MASFoundation.h
compilerOpts = \
-Isrc/nativeInterop/cinterop/MASFoundation.framework/Headers \
linkerOpts = \
-Fsrc/nativeInterop/cinterop \
-framework MASFoundation \
-framework Foundation \
-framework UIKit
Can someone spot what I'm doing wrong here? As my other interops work perfectly...Jan Stoltman
02/27/2020, 1:46 PMfunc isVPNConnected() -> Bool {
let cfDict = CFNetworkCopySystemProxySettings()
let nsDict = cfDict!.takeRetainedValue() as NSDictionary
let keys = nsDict["__SCOPED__"] as! NSDictionary
for key: String in keys.allKeys as! [String] {
if (key == "tap" || key == "tun" || key == "ppp" || key == "ipsec" || key == "ipsec0") {
return true
}
}
return false
}
Kotlin:
fun isVPNConnected(): Boolean {
val cfDict = CFNetworkCopySystemProxySettings()
val nsDifct = cfDict as? NSDictionary //It fails here
val keys = nsDifct?.valueForKey("__SCOPED__") as NSDictionary?
return keys?.allKeys?.any { key ->
key == "tap" || key == "tun" || key == "ppp" || key == "ipsec" || key == "ipsec0" || key == "utun1"
} ?: false
}
Could anybody help me to understand how takeRetainedValue
should be mapped into kotlin?Joan Colmenero
02/27/2020, 8:54 PMArkadii Ivanov
03/01/2020, 11:02 PMfun myViewController(): UIViewController = MyViewControllerImpl()
private class MyViewControllerImpl : UIViewController(nibName = null, bundle = null) {
private val button = UIButton()
override fun viewDidLoad() {
super.viewDidLoad()
button.addTarget(target = this, action = sel_registerName("onClick"), forControlEvents = UIControlEventTouchUpInside)
view.addSubview(button)
}
@ObjCAction
private fun onClick() {
}
}
Mike
03/02/2020, 5:44 PMVlad Balan
03/03/2020, 4:08 PMkotlin
) behavior when running the following example:
object Test {
private var test: String? = null
fun changeVar() {
test = "test"
println("val changed")
}
}
fun main(args: Array<String>) {
Test.changeVar()
}
This works in Kotlin
but in kotlin-native
it throws the following exception:
Uncaught Kotlin exception: kotlin.native.concurrent.InvalidMutabilityException: mutation attempt of frozen test.Test@e1d7d8
at kfun:kotlin.Throwable.<init>(kotlin.String?)kotlin.Throwable (0x22fc57)
at kfun:kotlin.Exception.<init>(kotlin.String?)kotlin.Exception (0x22a7b5)
at kfun:kotlin.RuntimeException.<init>(kotlin.String?)kotlin.RuntimeException (0x22a535)
at kfun:kotlin.native.concurrent.InvalidMutabilityException.<init>(kotlin.String)kotlin.native.concurrent.InvalidMutabilityException (0x232ee5)
at ThrowInvalidMutabilityException (0x233263)
at MutationCheck (0x26367e)
at kfun:cairo.Test.<set-test>#internal (0x242b50)
at kfun:cairo.Test.changeVar() (0x242bbe)
at kfun:cairo.main(kotlin.Array<kotlin.String>) (0x242c67)
at Konan_start (0x242d6b)
at Init_and_run_start (0x245f7b)
at __libc_start_main (0x7fb745f461e3)
at (0x217029)
at ((nil))
If the object Test
is changed to class Test
:
class Test {
private var test: String? = null
fun changeVar() {
test = "test"
println("val changed")
}
}
fun main(args: Array<String>) {
Test().changeVar()
}
then it works as expected.
Did somebody encounter this behavior? Is this intended? Is yes, can somebody please explain why?
Thanks in advance!SrSouza
03/03/2020, 4:21 PMnapperley
03/03/2020, 11:00 PMasad.awadia
03/04/2020, 1:11 AMasad.awadia
03/04/2020, 1:11 AMSean Keane
03/04/2020, 1:25 AMKtor : Netowrking
Multiplatform Settings: Persistance
kpgalligan
03/04/2020, 1:56 AMnapperley
03/04/2020, 3:43 AMThanhhai08sk
03/04/2020, 7:06 AM