Xcode 12.5 (and 13 as well) Running a project with a local package, linking error Undefined symbols for architecture arm64:

Trying to run a newly created in Xcode Version 13.0 beta (13A5154h) application, with a created in the same Xcode local package.
Build error:

Undefined symbols for architecture arm64:
  "MainApp.MainApp.text.unsafeMutableAddressor : Swift.String", referenced from:
      Modules.ContentView.body.getter : some in ContentView.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Example proj: GitHub - MaximBazarov/Modules: A test project for a bug

Reproduce:

  1. Run Xcode Version 13.0 beta (13A5154h)
  2. Create a new project, File -> New -> Project -> App, gibe it a name “Modules”
  3. Open your Xcode project and create a local Swift package as part of your project by selecting File > New > Swift Package. Give it a name “MainApp”
  4. Choose a project and a group, but don’t create a new Git repository if your app is already under version control; then create the new Swift package.
  5. Select your project in the Project navigator, then select your app target and navigate to its General pane.
  6. Click the + button in the “Frameworks, Libraries, and Embedded Content” section, select the local package’s library product, and add it as a dependency.
  7. Import your package in the ContentView by writing import MainApp
  8. Select any iOS device or simulator and try to build.

ER:
App builds and runs on the device or simulator.

AR:
Build error:

Undefined symbols for architecture arm64:
  "MainApp.MainApp.text.unsafeMutableAddressor : Swift.String", referenced from:
      Modules.ContentView.body.getter : some in ContentView.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

I suggest you submit a bug to Apple through feedbackassistant.apple.com, unless you're just lookin for discussion here.

yeah, I also did that, was just curious may be there's a workaround

Feedback ID: FB9206466

Terms of Service

Privacy Policy

Cookie Policy