0

I have built my framework (mixed Swift and Objective-C) and its dependencies (Alamofire) for macOS; no compiler errors arise. The build products happily resides in /Users/myuser/Library/Developer/Xcode/DerivedData/myproject-hash/Build/Products/Debug/. The project was originally created as Cocoa Touch Framework; I added a macOS target manually (which took some wrangling).

Now I try to apply this answer, calling

swift -F /Users/myuser/Library/Developer/Xcode/DerivedData/myproject-hash/Build/Products/Debug/

When I try import Alamofire, I get a whole slew of errors like this:

error: Alamofire debug map object file '/Users/myuser/Library/Developer/Xcode/DerivedData/myproject-hash/Build/Intermediates/Alamofire.build/Debug/Alamofire macOS.build/Objects-normal/x86_64/Timeline.o' has changed (actual time is 0x58ef7cfd, debug map time is 0x58ef6d81) since this executable was linked, file will be ignored

This is confusing since I just built the framework. Also, why is the framework linking into Intermediates?

Finally:

error: Couldn't lookup symbols:
  __swift_FORCE_LOAD_$_swiftCoreGraphics
  __swift_FORCE_LOAD_$_swiftDispatch

This one also appears if I try import MyProject after the (failed?) import Alamofire.

If I directly import MyProject (in a fresh session), all of the debug map object file... errors happen, but not the lookup symbols one. When I try to instantiate a struct from MyProject, I do get the Couldn't lookup symbols error, this time on symbols from MyProject.

What is going on here? What am I doing wrong, and how can I fix or work around the issue?

When I use the release build, the errors are gone -- provided I do import Alamofire; import MyProject. Apparently the dependencies are not imported recursively.

Community
  • 1
  • 1
Raphael
  • 9,779
  • 5
  • 63
  • 94

1 Answers1

0

The above was with Swift 3.0.2. I can not reproduce it with Swift 3.1.

Nota bene: It seems important to really do

import Alamofire
import MyProject

If you skip the first import, the import of MyProject won't fail but weird lookup errors (that do not mention Alamofire stuff at all) will happen.

Raphael
  • 9,779
  • 5
  • 63
  • 94