PeopleInSpace: Can not run the watchOS app on the emulator

Reproduction steps:

  1. clone the repository
  2. open .xcworkspace in Xcode
  3. change signing to local team
  4. attempt to run on the local emulator

This is the output I get:

ld: warning: ignoring file /Volumes/macApps/fhswf/S5/Projekt/PeopleInSpace/common/build/cocoapods/framework/common.framework/common, building for watchOS Simulator-x86_64 but attempting to link with file built for watchOS Simulator-i386
Undefined symbols for architecture x86_64:
  "_OBJC_CLASS_$_CommonKoinKt", referenced from:
      objc-class-ref in ExtensionDelegate.o
  "_OBJC_CLASS_$_CommonAssignment", referenced from:
      objc-class-ref in ViewModel.o
  "_OBJC_CLASS_$_CommonPeopleInSpaceRepository", referenced from:
      objc-class-ref in ContentView.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

I guess the warning

watchOS Simulator-x86_64 but attempting to link with file built for watchOS Simulator-i386

already tells a lot but I am not sure how to change that

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 3
  • Comments: 22 (18 by maintainers)

Most upvoted comments

@joreilly Seems to be succesfull! I tested with Gradle 7.0.0 and Ktor 1.6.2 and SQLdelight 1.5.1 ✅

I still have to setup my project, so that I can create PR’s. Will do asap

Correct @joreilly . I opened issues on all the dependencies that were not yet supporting it. Some have implemented it, but it is still only in the master branch, not into a release. I guess it’ll will need some time or you have to rely on unstable ‘releases’. which is not really a good option I think.

Thanks, this did fix it! Just wanted to also leave a screenshot here for anyone facing the same issue with the steps you described.

Screenshot 2020-10-07 at 10 30 28

Really not sure how to make this work for both simulator and real hardware devices without having to edit these.

That means this cannot be fixed for everyone by changing the code in the repository?

Okay, that took a few hours, messing around to try and get a minimal change that will allow compiling for the watchos simulator. It seems to be compiling for ARM64 simulators by default, and that really doesn’t work at all, since the KMP module (common) gets compiled for i386 and then it’ll skip linking it.

What did I do to get it working?

  1. Click on PeopleInSpaceWatch in the left nav in xcode.
  2. Tap build settings
  3. Tap the PeopleInSpace Watchkit Extension target
  4. Find the ‘Architectures’ and notice that it is defaulting to ‘Standard Architectures’.
  5. Click and edit that row, and choose Other…
  6. Click $(ARCHS_STANDARD) and tap the - button on the bottom to remove it.
  7. Hit the + button, and add ‘i386’. I’ve tried ‘x86_64’ but that doesn’t work for me. i386 will produce a warning about that architecture being deprecated, but it will run on the simulator.

Now a build should finish and install.

Really not sure how to make this work for both simulator and real hardware devices without having to edit these. Absolutely no idea. Maybe someone more familiar can fill me in on how things should be done.

Hope this helps.