How to link Canon's EDSDK framework on Mac at compilation?

27 Views Asked by At

Back in 2017, I wrote a short program in C, which I called CanonRemote, to automate my Canon DSLR camera to take images of the total solar eclipse in the US with different exposure times. The program, which used Canon's software development kit EDSDK v3.6, worked beautifully.

Fast-forward 6.5 years, a total solar eclipse is coming again to the US and I am testing whether my program still works after having updated MacOS on my computer a few times (from, I think, v10.12 Sierra back in 2017 to v11.7.10 Big Sur currently), which have included a switch from 32 bit to 64 bit applications that affects the program I coded with EDSDK. I am still using the same computer. I have downloaded the latest version of EDSDK (v13.17.12).

EDSDK includes header files and a framework. When compiling the program, the v13.17.12 EDSDK header (*.h) files are successfully recognized, but the v13.17.12 EDSDK framework isn't.

I have tried compiling in the Eclipse and Xcode developing environments, as well as directly in the Terminal.

In all cases, I get the following errors:

Undefined symbols for architecture x86_64:
  "_EdsCloseSession", referenced from:
      _main in CanonRemote.o
  "_EdsGetCameraList", referenced from:
      _main in CanonRemote.o
  "_EdsGetChildAtIndex", referenced from:
      __main in CanonRemote.o
  "_EdsGetChildCount", referenced from:
      __main in CanonRemote.o
      ...
  "_EdsTerminateSDK", referenced from:
      _main in CanonRemote.o
ld: symbol(s) not found for architecture x86_64

When solely compiling with these instructions:

gcc -I/[Path_to_EDSDK]/EDSDK/Header -I/SDKs/MacOSX12.1.sdk/System/Library/Frameworks/Kernel.framework/Versions/A/Headers/sys/_types -I/usr/local/include -I/usr/local/lib/gcc/x86_64-apple-darwin19/include -I/usr/local/lib/gcc/x86_64-apple-darwin19/include-fixed -O2 -g -Wall -c -fmessage-length=0 -arch x86_64 -o [Path_to_.o_file]/CanonRemote.o [Path_to_.c_file]/CanonRemote.c

this command works and the CanonRemote.o file gets created.

But then I get the symbol(s) not found (Eclipse/Terminal) or Undefined symbol (Xcode) errors when typing linking instructions such as:

gcc -L /[Path_to_EDSDK]/EDSDK -o [executable] [Path_to_.o_file]/CanonRemote.o

or

gcc -framework /[Path_to_EDSDK]/EDSDK/Framework/EDSDK.framework -o [executable] [Path_to_.o_file]/CanonRemote.o

or

gcc -l EDSDK -o CanonRemote [Path_to_.o_file]/CanonRemote.o

or

gcc -l libEDSDK.so -o [executable] [Path_to_.o_file]/CanonRemote.o

or some combination thereof (e.g., listing both a library search path and a library or framework). The last example above was an attempt to find the libEDSDK.so library for Linux mentioned in the EDSDK v13.17.12 API Programming Reference, just in case, but I don't find it in the version of EDSDK I downloaded (for Mac).

Side note: when compiling within Eclipse, the gcc command invokes Apple's clang compiler. When compiling directly in the Terminal, the gcc command invokes the gcc compiler from Free Software Foundation.

In Xcode, I have followed the instruction in the ESDSK v13.17.12 API Programming Reference, section 1.4.2 Linking the Library - Macintosh ("Add EDSDK.framework to Groups&Files"), and accordingly tried the following:

  • Selecting the build target and adding EDSDK.framework or EDSDK.framework/EDSDK as a file in the "Frameworks and Libraries" category, or
  • In the file navigator, clicking "adding files" to add EDSDK.framework or EDSDK.framework/EDSDK to the files nested under the project directory, the subfolder containing the CanonRemote.c source file, or another subfolder called "Frameworks".

What else should I try to ensure that the EDSDK framework is linked at compilation?

0

There are 0 best solutions below