Error: Building for iOS Simulator-arm64 but attempting to link with file built for iOS Simulator-x86_64 (M1)
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 35/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- ios, kotlin
- Lĩnh vực
- build-system, mobile
Hướng nghiên cứu
Bắt đầu với việc chọn target trong SharedCode build.gradle.kts và ví dụ ViewController, sau đó tái hiện bước link trong dự án Xcode mẫu trên trình mô phỏng M1. So sánh kiến trúc của Multiplatform.framework được tạo ra với kiến trúc trình mô phỏng hiển thị trong lỗi linker; hoàn tất khi lệnh gọi Greeting được link và chạy thành công.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Hi, I am trying to integrate KMM project as a pod to my sample Xcode Project. I can link the KMM Pod to my Xcode project. However if I try to call one of the function, below error yielded. If I do not call any of the KMM function, it can run the app in my simulator.
ViewController
import UIKit
import Multiplatform
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
let a = Greeting()
a.greeting()
}
}
ld: warning: ignoring file /Users/avjiang/Developments/Multiplatform/SharedCode/build/cocoapods/framework/Multiplatform.framework/Multiplatform, building for iOS Simulator-arm64 but attempting to link with file built for iOS Simulator-x86_64
Undefined symbols for architecture arm64:
"_OBJC_CLASS_$_MultiplatformGreeting", referenced from:
objc-class-ref in ViewController.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
The KMM application is just a simple app. There is a Greeting class inside SharedCode -> commonMain -> kotlin -> Greeting
Below is my configuration for build.gradle.kts
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget
plugins {
kotlin("multiplatform")
kotlin("native.cocoapods")
id("com.android.library")
}
version = "1.0"
kotlin {
android()
cocoapods {
// Configure fields required by CocoaPods.
summary = "Some description for a Kotlin/Native module"
homepage = "Link to a Kotlin/Native module homepage"
frameworkName = "Multiplatform"
ios.deploymentTarget = "13.5"
podfile = project.file("/Users/avjiang/Developments/TestKotlinMultiplatformPod/Podfile")
}
val iosTarget: (String, KotlinNativeTarget.() -> Unit) -> KotlinNativeTarget =
if (System.getenv("SDK_NAME")?.startsWith("iphoneos") == true)
::iosArm64
else
::iosX64
iosTarget("ios") { }
sourceSets {
val commonMain by getting
val commonTest by getting {
dependencies {
implementation(kotlin("test-common"))
implementation(kotlin("test-annotations-common"))
}
}
val androidMain by getting
val androidTest by getting {
dependencies {
implementation(kotlin("test-junit"))
implementation("junit:junit:4.13.2")
}
}
val iosMain by getting
val iosTest by getting
}
}
android {
compileSdkVersion(30)
sourceSets["main"].manifest.srcFile("src/androidMain/AndroidManifest.xml")
defaultConfig {
minSdkVersion(19)
targetSdkVersion(30)
}
}
And this is my project build.gradle.kts
buildscript {
repositories {
gradlePluginPortal()
google()
mavenCentral()
}
dependencies {
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.20")
classpath("com.android.tools.build:gradle:4.2.2")
}
}
allprojects {
repositories {
google()
mavenCentral()
}
}
tasks.register("clean", Delete::class) {
delete(rootProject.buildDir)
}
Basically I am just following the tutorial from https://kotlinlang.org/docs/mobile/create-first-app.html. Nothing complex yet. Is there anything I missed out?
My machine configuration:
Mac mini M1
Xcode 13 beta 2
MacOS 11.4
Thank you
- Ngôn ngữ chính
- Kotlin
- Star
- 1.1k
- Fork
- 203
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Chuẩn bị môi trường
Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của Kotlin/kmp-basic-sample
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 35/100
Kotlin/kmp-basic-sample#84 ·
-
Support for webĐang mở
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 25/100
Kotlin/kmp-basic-sample#82 ·
-
Memory Issue on iOS platform.Đang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 25/100
Kotlin/kmp-basic-sample#81 ·
-
ERROR when build in iosĐang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 25/100
Kotlin/kmp-basic-sample#75 ·
-
Start using version catalogsĐang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 25/100
Kotlin/kmp-basic-sample#71 ·
Tất cả issue của Kotlin/kmp-basic-sample
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
mobile-dev-inc/Maestro#3646 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
-
enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
GetStream/stream-chat-android#6762 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
SimonHalvdansson/Harmonic-HN#363 ·