liuliu / swift-diffusion

BSD 3-Clause "New" or "Revised" License
423 stars 33 forks source link

dyld error on M1 #12

Open alanf opened 1 year ago

alanf commented 1 year ago
➜  swift-diffusion git:(main) ✗ bazel run examples:txt2img --compilation_mode=opt -- /Users/alan/Documents  "a photograph of an astronaut riding a horse"
INFO: Build option --compilation_mode has changed, discarding analysis cache.
INFO: Analyzed target //examples:txt2img (2 packages loaded, 1289 targets configured).
INFO: Found 1 target...
Target //examples:txt2img up-to-date:
  bazel-bin/examples/txt2img
INFO: Elapsed time: 0.459s, Critical Path: 0.03s
INFO: 1 process: 1 internal.
INFO: Build completed successfully, 1 total action
INFO: Running command line: bazel-bin/examples/txt2img /Users/alan/Documents 'a photograph of an astronaut riding a
INFO: Build completed successfully, 1 total action
dyld[34469]: Symbol not found: (_$s10Foundation11JSONDecoderC6decode_4fromxxm_AA4DataVtKSeRzlFTj)
  Referenced from: '/private/var/tmp/_bazel_alan/3731b9e12e12cbc0629cde4e0e832bb3/execroot/__main__/bazel-out/darwin_arm64-opt/bin/examples/txt2img'
  Expected in: '/System/Library/Frameworks/Foundation.framework/Versions/C/Foundation'

Any suggestions for what to try to get around this error? Thank you!

liuliu commented 1 year ago

Which OS version you are on? And which Xcode? Seems like a mismatch of compiler / macOS.

alanf commented 1 year ago

OS: Monterey 12.6.1 (21G217) Xcode: 14.1 but I also have 13.3.1 installed

liuliu commented 1 year ago

And xcode-select -p is showing the Xcode 14.1 path?

alanf commented 1 year ago

It is: /Applications/Xcode.app/Contents/Developer (the other Xcode is named Xcode-13.3.1)

liuliu commented 1 year ago

Thanks. This error feels like the one I encountered sometime ago for another project, when there is a mismatch in declared macOS compatibility with the available SDK. Need to dig into it to find what's the fix last time. Won't have time until Friday.

alanf commented 1 year ago

Thanks for looking!

jiangdi0924 commented 1 year ago

Same Error +1

swift-diffusion git:(main) ✗ bazel run examples:txt2img --compilation_mode=opt -- /Users/Norton/MyTestProject/swift-diffusion "a photograph of an astronaut riding a horse" INFO: Invocation ID: e58c9a68-8dee-4af6-9143-be0dc7f79a06 INFO: Analyzed target //examples:txt2img (0 packages loaded, 0 targets configured). INFO: Found 1 target... Target //examples:txt2img up-to-date: bazel-bin/examples/txt2img INFO: Elapsed time: 0.100s, Critical Path: 0.00s INFO: 1 process: 1 internal. INFO: Build completed successfully, 1 total action INFO: Build completed successfully, 1 total action dyld[50764]: Symbol not found: (_$s10Foundation11JSONDecoderC6decode_4fromxxm_AA4DataVtKSeRzlFTj) Referenced from: '/private/var/tmp/_bazel_jiangdi/084e5c28a69a5fa4549390fedc56f690/execroot/__main__/bazel-out/darwin_arm64-opt/bin/examples/txt2img' Expected in: '/System/Library/Frameworks/Foundation.framework/Versions/C/Foundation'

liuliu commented 1 year ago

Thanks. I now think this is related to Xcode 14.1, and basically the binaries built with Bazel rules_swift needs to specify its minimal supported macOS version otherwise Xcode 14.1 is going to build with macOS 13's toolchain. Easy solution is to upgrade to macOS 13.0.

jiangdi0924 commented 1 year ago

@liuliu after upgrade macOS version it worked well, Much appreciated !!! Now I have another question,I have no experience with bazel, how should I use the packages generated by bazel integration my macOS or iOS project? 😊Many thanks~~~

liuliu commented 1 year ago

Thanks! Yeah, Bazel is not the easiest to use, to integrate with Xcode project, I recommend to try https://github.com/buildbuddy-io/rules_xcodeproj

I do plan to package this for SPM, but won't get much time until December (need to add new samplers, CLI etc to this repo from draw-things repo). Constantly get distracted because newer models etc etc.