yeatse / opencv-spm

Integrate OpenCV into your project using Swift Package Manager.
Apache License 2.0
69 stars 24 forks source link

Linker errors #23

Open mister-drgn opened 2 months ago

mister-drgn commented 2 months ago

Hi, I appreciate that you're providing this. I wonder if you have any documentation on resolving "Undefined symbol" linker errors, for those of using running on MacOS but using a package.swift file. Someone initially helped me out by suggesting using the following in my package file:

linkerSettings: [ .linkedFramework("Accelerate", .when(platforms: [.macOS])), .linkedFramework("OpenCL", .when(platforms: [.macOS])) ]

This worked great until I tried to use the VideoCapture constructor, at which point I got 50 more "Undefined symbol" errors. I was able to resolve some of these by linking two additional frameworks, AVFoundation and CoreMedia. The final 21 errors all relate to "ob", for example ob::VideoFrame::width(). The same person who had helped me suggested these symbols are defined in the OrbbecSDK library. However, so far I have been unable to find a way to include that library in my package.swift file, even after downloading its latest release onto my machine.

Do you have ideas about this? Any help would be appreciated. Thanks.

Lxrd-AJ commented 1 month ago

My recommendation might be to create a new Xcode project and install opencv-spm as a dependency there.

If it builds fine with no linker errors, then most likely it could be an issue with the Xcode project and it's settings.

I think these kind of linker errors usually pop up for projects created using Xcode 13/14 and are being built in Xcode 15/16-beta