You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Aug 10, 2021. It is now read-only.
I just tried using native interop feature since I need native code written in Objective-C to be used in my library.
So first I'm trying to test using simple hello to interop an Objective-C code
gradle :
kotlin {
...
val iosX64 = iosX64("ios") {
compilations.getByName("main) { val myInterop by cinterops.creating { defFile(project.file("src/nativeInterop/cinterop/objective-c-file.def")) } } } val iosArm32 = iosArm32 ("iosArm32 ") { compilations.getByName("main) {
val myInterop by cinterops.creating {
defFile(project.file("src/nativeInterop/cinterop/objective-c-file.def"))
}
}
}
val iosArm64 = iosArm64("iosArm64") {
compilations.getByName("main) { val myInterop by cinterops.creating { defFile(project.file("src/nativeInterop/cinterop/objective-c-file.def")) } } } ...}
my .def configuration :
language = Objective-C
headers = Hello.h Foundation/Foundation.h
package = org.native
compilerOpts = -Isrc/nativeInterop/include
linkerOpts = -framework Foundation "-F/Applications/Xcode 11.3.1.app/Contents/Developer/Platforms/"
after run cinterop task from gradle, the klib generated from that hello class and of course now I can import it to my kotlin project. for example in my iOS module:
Then I'm trying to call it in my unit test to check if I can get the result or I aslo try to build it to framework but I got an error :
> Task :cleanIosTest UP-TO-DATE
> Task :cinteropMyInteropIos UP-TO-DATE
> Task :generateBuildKonfig UP-TO-DATE
> Task :generateIosMainAppDatabaseInterface UP-TO-DATE
> Task :compileKotlinIos UP-TO-DATE
> Task :iosProcessResources UP-TO-DATE
> Task :iosMainKlibrary UP-TO-DATE
> Task :compileTestKotlinIos UP-TO-DATE
> Task :linkDebugTestIos FAILED
e: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld invocation reported errors
Please try to disable compiler caches and rerun the build. To disable compiler caches, add the following line to the gradle.properties file in the project's root directory:
kotlin.native.cacheKind=none
Also, consider filing an issue with full Gradle log here: https://kotl.in/issue
The /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld command returned non-zero exit code: 1.
output:
Undefined symbols for architecture x86_64:
"_OBJC_CLASS_$_Hello", referenced from:
objc-class-ref in result.o
ld: symbol(s) not found for architecture x86_64
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':linkDebugTestIos'.
> Compilation finished with errors
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.6.1/userguide/command_line_interface.html#sec:command_line_warnings
BUILD FAILED in 8s
Anyone know how to resolve this issue or maybe is it impossible to interop in that way? I just needed so it can be used in my iOS app later after I successfully build it to .framework
The text was updated successfully, but these errors were encountered:
unfortunately, when I create this issue that page didn't show up.. When I try it again when you say it, it's already appear.. I don't use custom GitHub, I don't know why that happen
I just tried using native interop feature since I need native code written in Objective-C to be used in my library.
So first I'm trying to test using simple hello to interop an Objective-C code
gradle :
my .def configuration :
this is the project structure look like
my Hello.h
Hello.m
after run cinterop task from gradle, the klib generated from that hello class and of course now I can import it to my kotlin project. for example in my iOS module:
Then I'm trying to call it in my unit test to check if I can get the result or I aslo try to build it to framework but I got an error :
Anyone know how to resolve this issue or maybe is it impossible to interop in that way? I just needed so it can be used in my iOS app later after I successfully build it to .framework
The text was updated successfully, but these errors were encountered: