CMOS Camera SDK on macOS -- Trouble with My First SDK Integration

Hello, I usually get along pretty well with oF but I am finding myself out of my depth in this case.

Camera SDK

I am trying to use the SDK for a CMOS camera made by ZWO. The SDK comes from the ZWO website and (spoiler alert) the contents are:

	ASICamera2 Software Development Kit.pdf

My Attempts

There might be some holes in this because I worked on a bulk of it last week. I’ve also looked through the SDK examples, etc., but I’m still writing this post so the docs weren’t that helpful for me. I took some guidance from a few places but this is the only source I still have around.

Add Directly to Project

I brought ASICamera2.h into my project, imported that header file into a CPP file, and code completion seems to work as expected. In my target settings I added the macos folder from the SDK to Link Binary With Libraries list. I have also tried other variations like adding a higher-lever folder, adding each of the system folders with the *.a and *.so files, and just adding the *.a file(s).

As Addon

I also tried doing approximately the same process by modifying an empty add-on template, adding it with projectGenerator.


Add Directly to Project

When I Build for My Mac (an M1) the main issue seems to be ld: symbol(s) not found for architecture x86_64. When I Build for My Mac (Rosetta) I am currently getting the same error but I thought that last week it showed just ...x86 (or was it ...x64? I know I should know, but, ugh).

As Addon

I don’t recall what happened and I have so little faith in my work there that I won’t bother re-creating unless this seems like this is where the answer lies.


Based on that file list the only file you would want to add to your project is:

Add the relative path of the file from your xcodeproj file location to the libASICamera2.a to the Debug and Release section here ( add a line with the + symbol below $(LIB_OF_DEBUG) ):

If you are having issues figuring out if the path is correct you could even add the absolute file path.

Also if you need to check the architecture of the file ( to make sure it is x86_64 ) you can do:
lipo -i libASICamera2.a

Hope that helps!

Seems like I was trying to take the long way around the mountain! But it’s not fixed yet… Following your directions:

The mac version of libASICamera2.a shows it’s for i386 x86_64 while running lipo on any of the others returns archive with no architecture specification. When I build now the error has changed to ld: symbol(s) not found for architecture arm64.

When I build for Rosetta (thinking it might get away from arm64) it has the original ld: symbol(s) not found for architecture x86_64 and messages like Object file (libASICamera2.a(Camera.o)) was built for newer macOS version (10.13) than being linked (10.9).

Should I be trying to limit the architectures it builds for or am I hosed? I have my 2015 MBP around somewhere if I need to get back to Intel.

That makes sense. ( the arm64 part ).
I think maybe start in Rosetta mode. Check you have build active architectures only set to YES for both Debug and Release ( in build settings ).

Then either add the file path to the other linker flags for Debug and Release.

Or you could also drag and drop the file into the sidebar ( where your source files are listed ) and it should automatically link the file in the link binary with libraries build phase.

It should definitely link as long as you are not trying to build for arm64 natively.

Edit: the warning was built for newer macOS version (10.13) than being linked (10.9). can be ignored as long as it is not an error.

This seemed to have fixed some things. The only errors I see now are about Undefined symbols for x86_64 related to libusb.

Things I know or did:

  • libusb is already installed with Homebrew
  • I unlinked and linked with homebrew
  • I tried (maybe recklessly) /bin/launchctl setenv LIBRARY_PATH /usr/local/lib
  • I tried (maybe recklessly) gcc -L/usr/local/Cellar/libusb/1.0.24/lib -o "libusb_example" ./src/libusb_example.o -lusb1.0 but the file was not found

Thank you SO much for the help!

You could grab and link the libusb from ofxKinect which I think should be pretty compatibile.
Just use the PG to add ofxKinect to your project ( maybe a clean project as it will trash your other settings ) or just manually add the .a like you did for the camera library.

If that libusb is missing 3.0 stuff
the one here should be good:

It’s building!! Now to figure out the API, but it seems like we’re in business.

I did have to grab the newer libusb that you linked to