johnno1962 / HotReloading

Hot reloading as a Swift Package

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Undefined symbol _FSEventStream* in FileWatcher

tete1030 opened this issue · comments

commented

I imported the HotReloading target in my project and it complains about these symbols' missing for both simulator and real device.

Undefined symbols for architecture x86_64:
  "_FSEventStreamScheduleWithRunLoop", referenced from:
      HotReloading.FileWatcher.init(root: Swift.String, callback: (__C.NSArray, Swift.String) -> ()) -> HotReloading.FileWatcher in HotReloading.o
  "_FSEventStreamCreate", referenced from:
      HotReloading.FileWatcher.init(root: Swift.String, callback: (__C.NSArray, Swift.String) -> ()) -> HotReloading.FileWatcher in HotReloading.o
  "_FSEventStreamStart", referenced from:
      HotReloading.FileWatcher.init(root: Swift.String, callback: (__C.NSArray, Swift.String) -> ()) -> HotReloading.FileWatcher in HotReloading.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
commented

My project has some objc code, so I added the following to other linker flags. It worked

-Xlinker -undefined -Xlinker dynamic_lookup

if this is not an issue, please close this.

Hi, Good fix! What version of Xcode was this?

commented

xcode 13.3 (13E113)

And it's working OK. Strange you got the error and were able to fix it. This "standalone" injection is quite new.

commented

I found the fix from your advice here. Not sure if the same cause

-Xlinker -undefined -Xlinker dynamic_lookup is always a good fallback even if it gives you a warning. Thanks for reporting this, closing now.

I've updated the project README with your fix. Thanks!

commented

Thank you for your help and this great tool