DEV Community

Andrey
Andrey

Posted on

Gandalf Vision

Hey! So I spent yesterday diving into that Gandalf Vision library you mentioned—the computer vision framework for macOS. Wanted to share a weird linking issue I hit in Xcode, because it's the kind of thing that'll make you pull your hair out if you're just trying to test the object detection examples.

First impressions: this thing is fast. Like, genuinely impressive. I threw a 4K video at one of the sample projects, and it was doing real-time edge detection with basically no frame drop. The Metal acceleration is no joke—it's using your GPU directly through Apple's framework, so it feels buttery smooth compared to OpenCV on Mac.

But getting to that point was annoyingly tricky. Here's what happened: I downloaded the framework, dragged it into my Xcode project, added it to "Frameworks, Libraries, and Embedded Content" like the docs said, and hit Build. Got a bunch of linker errors—"Symbol not found," "Undefined symbols for architecture arm64." Classic.

My first dumb move: I figured it was a Rosetta thing or I downloaded the wrong version. Checked the architecture, redownloaded, even restarted Xcode. Same errors. Then I thought maybe it needed to be in a specific location, so I moved it to /Library/Frameworks/ and added that path to "Framework Search Paths." Still nothing.

What I eventually realized after way too much Googling: it was the "Embed & Sign" setting. Gandalf Vision uses some dynamic linking features that require the framework to be properly signed and embedded, not just linked. I had it set to "Do Not Embed" because that's what I usually do for system frameworks. Changing it to "Embed & Sign" fixed everything immediately.

Here's Apple's official docs on how this works: Embedding Frameworks in an App. Basically, if a framework isn't in a standard system location, you need to embed it in your app bundle so the dynamic linker can find it at runtime. Gandalf Vision isn't a system framework, so "Do Not Embed" = linker errors.

What actually fixed it:

  1. First, in Xcode, select your target, go to General tab, find "Frameworks, Libraries, and Embedded Content"
  2. Second, change Gandalf Vision from "Do Not Embed" to "Embed & Sign"
  3. Third, clean build folder (Product > Clean Build Folder, then Build)

After that? Compiled perfectly, and the sample apps ran without issues.

For next time you (or anyone) starts a project with this, here's the quick checklist I'm keeping:

  • ✅ After adding the framework to your project, always check the Embed setting—it should be "Embed & Sign"
  • ✅ If you get linker errors about missing symbols, this is almost always the cause
  • ✅ Make sure you're using the correct architecture version (Universal2 works for both Intel and Apple Silicon)
  • ✅ If you're using Swift Package Manager instead, check that the package manifest includes the framework correctly
  • ✅ The official Gandalf Vision documentation has a "First Project" guide that covers this

I also found this page with the download and system requirements—they provide SHA-256 checksums, which is nice for verifying the download. The library is also available through CocoaPods (pod 'GandalfVision') and the official website has more examples.

Once I got past the linking thing, the library is genuinely great. The Swift API is clean—way nicer than wrapping C++ libraries. Their real-time object detection sample runs at like 30fps on my M1 MacBook Air, which is honestly wild. The n-dimensional array stuff (their NumPy-like module) is also useful for general numerical work, not just vision.

One other thing: if you're planning to use this with camera input, you'll need to add the camera usage description to your Info.plist and request permission at runtime. Apple's docs cover that here: Requesting Authorization for Media Capture. Gandalf Vision's camera helpers handle the actual requesting, but you still need the plist entry.

Anyway, if you're doing anything with computer vision on macOS, this is worth a serious look. Just remember that Embed & Sign setting, or you'll waste an hour wondering why the linker hates you. Let me know if you hit any other weirdness—especially if you're trying to use it with SwiftUI previews (that's next on my list to figure out).

Catch you later!

Top comments (0)