question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Creating a static library on Kotlin Native crashes with "have the same architectures (arm64) and can't be in the same fat output file"

See original GitHub issue

project: https://github.com/realm/realm-kotlin-samples/tree/main/Intro

I want to package it as a static library instead of dynamic, so I add the following in build.gradle.kts

targets.withType<org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget> {
        // use static
        binaries.withType<org.jetbrains.kotlin.gradle.plugin.mpp.Framework> {
            isStatic = true
        }
    }

task: ./gradlew assemble

failed: 截屏2022-03-10 下午6 09 50

folder: 截屏2022-03-10 下午6 13 29

I guess that the executable file generated in the iosX64 folder contains the arm64 architecture, so the execution of linkDebugFrameworkIosFat fails. The error is as follows have the same architectures (arm64) and can't be in the same fat output file

Please reply as soon as possible, I need your help!

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:9

github_iconTop GitHub Comments

1reaction
DeftMKJcommented, Mar 14, 2022

I use your official Demo. https://github.com/realm/realm-kotlin-samples/tree/main/Intro just add as below:

targets.withType<org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget> {
        // use static
        binaries.withType<org.jetbrains.kotlin.gradle.plugin.mpp.Framework> {
            isStatic = true
        }
    }

I didn’t change any Xcode buildSettings,just run ./gradlew assemble

I also tried to modify it according to the link you gave, but it didn’t work either. I try to use sqldelight, and then package the static library, it works fine.

You can use your own official Demo to compile it into a static library,maybe my settings are wrong.

Looking forward to your reply. @cmelchior

0reactions
DeftMKJcommented, Mar 25, 2022

Great! It works fine. 👏 👏 👏

Read more comments on GitHub >

github_iconTop Results From Across the Web

Build final native binaries - Kotlin
In this case, you can use the resulting universal framework on both 32-bit and 64-bit devices. The fat framework must have the same...
Read more >
iOS app with framework crashed on device, dyld: Library not ...
I have tried to build on iOS 7.1 and 8.0 devices, they both have the same crash. However, I can build an app...
Read more >
react-native/CHANGELOG.md at main - GitHub
A framework for building native applications using React ... Bugfix for multiple shadow threads rendered at the same time, small probability crash.
Read more >
Java Development on an Apple M1 (ARM64) - rieckpil
Rule one: Whenever there's a native arm64 build of any development ... (fat file, but missing compatible architecture (have 'i386,x86_64', ...
Read more >
Ask HN: How are you dealing with the M1/ARM migration?
You can build multiplatform images for x86 and ARM (e.g. M1 Mac) like so: docker buildx build --platform linux/amd64,linux/arm64 . I constantly use...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found