Skip to content
This repository was archived by the owner on Jun 3, 2025. It is now read-only.
This repository was archived by the owner on Jun 3, 2025. It is now read-only.

Build failing: symbol(s) not found for architecture arm64 #46

@surajsau

Description

@surajsau

I'm trying to create a SPM from a module which contains a simple object file.

object Strings {
    val TitleTalks = "Talks"
    val TabTalks = "Talks"
    val TabChannels = "Channel"
    val TabProfile = "Profile"
}

complete build.gradle looks like this

plugins {
    kotlin("multiplatform")
    id("com.android.library")
    id("com.chromaticnoise.multiplatform-swiftpackage") version "2.0.3"
}

kotlin {
    multiplatformSwiftPackage {
        swiftToolsVersion("5.3")
        targetPlatforms {
            iOS { v("13") }
        }
        packageName("AppStrings")
        outputDirectory(File(projectDir, "spm/strings"))
    }

    android()

    ios {
        binaries {
            framework {
                baseName = "strings"
                isStatic = false
            }
        }
    }

    iosSimulatorArm64 {
        binaries {
            framework {
                baseName = "strings"
                isStatic = false
            }
        }
    }

    sourceSets {
        val commonMain by getting {
            dependencies {
                implementation(libs.moko.resources.core)
            }
        }
        val commonTest by getting {
            dependencies {
                implementation(kotlin("test"))
            }
        }
        val androidMain by getting {
            dependencies {
                implementation(libs.moko.resources.compose)
            }
        }
        val androidTest by getting

        val iosMain by getting
        val iosTest by getting
        val iosSimulatorArm64Main by getting {
            dependsOn(iosMain)
        }
        val iosSimulatorArm64Test by getting {
            dependsOn(iosTest)
        }
    }
}

android {..}

But I always get the following build error whenever I try accessing Strings.xx inside my Swift file

Undefined symbols for architecture arm64:
  "_OBJC_CLASS_$_StringsStrings", referenced from:
      objc-class-ref in ContentView.o
ld: symbol(s) not found for architecture arm64

スクリーンショット 2022-09-07 8 58 21

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions