Stan van der Bend
10/30/2024, 7:05 AMmake-xcframework.sh
script (from the repo I linked), which generated the following dirs:
GLTFKit2/archives/iOS/GLTFKit2.xcarchive/Products/Library/Frameworks/GLTFKit2.framework
GLTFKit2/archives/iOS_Simulator/GLTFKit2.xcarchive/Products/Library/Frameworks/GLTFKit2.framework
Now I am trying to include these frameworks as follows:
in GLTFKit.def
package = GLTFKit
language = Objective-C
modules = GLTFKit2
in build.gradle.kts
fun KotlinNativeTarget.configure(depName: String) {
val myFrameworkDefFilePath = "src/nativeInterop/cinterop/GLTFKit.def"
val myFrameworkCompilerLinkerOpts = listOf("-framework", "GLTFKit2",
"-F/GLTFKit2/archives/$depName/GLTFKit2.xcarchive/Products/Library/Frameworks"
)
compilations.getByName("main") {
val gltf by cinterops.creating {
defFile(myFrameworkDefFilePath)
compilerOpts(myFrameworkCompilerLinkerOpts)
}
}
binaries.all {
linkerOpts(myFrameworkCompilerLinkerOpts)
}
}
iosX64().configure("iOS_Simulator")
iosArm64().configure("iOS")
iosSimulatorArm64().configure("iOS_Simulator")
After I try and build the kotlin project, I am getting:
> Task :library:iosSimulatorArm64Test
dyld[70559]: Library not loaded: @rpath/GLTFKit2.framework/GLTFKit2
Referenced from: <4017322B-EF43-3665-AD50-A5707DD2BECC> /IdeaProjects/Test/scarlett-character-builder/library/build/bin/iosSimulatorArm64/debugTest/test.kexe
Reason: tried: '/IdeaProjects/Test/library/build/bin/iosSimulatorArm64/debugTest/Frameworks/GLTFKit2.framework/GLTFKit2' (no such file), '/IdeaProjects/Test/library/build/bin/iosSimulatorArm64/debugTest/Frameworks/GLTFKit2.framework/GLTFKit2' (no such file), '/Library/Developer/CoreSimulator/Volumes/iOS_21F79/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 17.5.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/GLTFKit2.framework/GLTFKit2' (no such file)
Child process terminated with signal 6: Abort trap
This confuses me, I don’t understand why it is looking here for the framework: IdeaProjects/Test/library/build/bin/iosSimulatorArm64/debugTest/Frameworks
François
10/30/2024, 7:27 PMStan van der Bend
10/30/2024, 8:19 PMCalculating task graph as no cached configuration is available for tasks: :library:cleanIosSimulatorArm64Test :library:iosSimulatorArm64Test
> Task :library:checkKotlinGradlePluginConfigurationErrors SKIPPED
> Task :library:cleanIosSimulatorArm64Test UP-TO-DATE
> Task :library:iosSimulatorArm64ProcessResources NO-SOURCE
> Task :library:cinteropGLTFKit2IosSimulatorArm64 UP-TO-DATE
> Task :library:compileKotlinIosSimulatorArm64
> Task :library:iosSimulatorArm64MainKlibrary
> Task :library:xcodeVersion
w: Kotlin <-> Xcode compatibility issue:
The selected Xcode version (15.4) is higher than the maximum known to the Kotlin Gradle Plugin.
Stability in such configuration hasn't been tested, please report encountered issues to <https://kotl.in/issue>
Maximum tested Xcode version: 15.3
To suppress this message add 'kotlin.apple.xcodeCompatibility.nowarn=true' to your gradle.properties
> Task :library:compileTestKotlinIosSimulatorArm64
> Task :library:linkDebugTestIosSimulatorArm64 FAILED
e: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld invocation reported errors
The /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld command returned non-zero exit code: 1.
output:
ld: warning: Could not find or use auto-linked framework 'GLTFKit2': framework 'GLTFKit2' not found
Undefined symbols for architecture arm64:
"_OBJC_CLASS_$_GLTFAsset", referenced from:
in test.kexe.o
ld: symbol(s) not found for architecture arm64
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':library:linkDebugTestIosSimulatorArm64'.
> 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>.
BUILD FAILED in 10s
I put a minimal reproducible example over here:
https://github.com/dosier/kotlin-gltfkit-exampleStan van der Bend
10/30/2024, 8:23 PMbinaries.all {
linkerOpts("-F$path")
}
But if I do that I am getting:
> Task :library:iosSimulatorArm64Test FAILED
dyld[50249]: Library not loaded: @rpath/GLTFKit2.framework/GLTFKit2
Referenced from: <CA5575AE-DDAD-374C-BEE7-9C8C26A0E87E> /Users/stanvanderbend/IdeaProjects/multiplatform-library-template-main/library/build/bin/iosSimulatorArm64/debugTest/test.kexe
Reason: tried: '/Users/stanvanderbend/IdeaProjects/multiplatform-library-template-main/library/build/bin/iosSimulatorArm64/debugTest/Frameworks/GLTFKit2.framework/GLTFKit2' (no such file), '/Users/stanvanderbend/IdeaProjects/multiplatform-library-template-main/library/build/bin/iosSimulatorArm64/debugTest/Frameworks/GLTFKit2.framework/GLTFKit2' (no such file), '/Library/Developer/CoreSimulator/Volumes/iOS_21F79/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 17.5.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/GLTFKit2.framework/GLTFKit2' (no such file)
Child process terminated with signal 6: Abort trap
Execution failed for task ':library:iosSimulatorArm64Test'.
> command '/usr/bin/xcrun' exited with errors (exit code: 134)
* 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>.
BUILD FAILED in 6s
6 actionable tasks: 2 executed, 4 up-to-date
Configuration cache entry stored.
Stan van der Bend
10/30/2024, 8:24 PMStan van der Bend
10/30/2024, 8:29 PMStan van der Bend
10/30/2024, 8:30 PMbinaries.all {
linkerOpts("-F$path", "-rpath", path)
}
Stan van der Bend
10/30/2024, 8:49 PMld: warning: object file (/private/var/folders/tv/swp8bxz5579bfcq0t8p3jvj80000gn/T/included8954744631975629192/libskunicode_core.a[arm64][2](libskunicode_core.SkUnicode.o)) was built for newer 'iOS-simulator' version (15.0) than being linked (14.0)
ld: warning: Could not find or use auto-linked framework 'GLTFKit2': framework 'GLTFKit2' not found
Undefined symbols for architecture arm64:
"_OBJC_CLASS_$_GLTFAsset", referenced from:
in composeApp.framework.o
ld: symbol(s) not found for architecture arm64
Stan van der Bend
10/30/2024, 8:49 PMMikolaj
10/31/2024, 1:05 PM.o
files but not for .framework
Please update if you figure this one out, I would love to know the solution 🙌Mikolaj
10/31/2024, 1:11 PM0.0.1 -> 0.0.2
. IDK why - probably some gradle caching issues