2

I've written a piece of C code that uses libfftw3 and libaiff external libraries. The code compiles and executes perfectly on my machine which has the required libraries and is running OS X 10.9 Mavericks. I'm using Xcode 5.1 to compile my program and I believe I have linked the required libraries correctly and provided the necessary paths to header files etc. (Everything works as it should on my computer).

In fact, the resulting executable also runs on another computer running OS X Mavericks and which also has the required libraries installed.

Problem: I am trying to compile my code using Xcode 5.1 to create an executable that will run on a computer running OS X 10.8 (Mountain Lion) and which does NOT have both the above libraries installed. I've tried a number of different things so far:

(1) First, I kept the Base SDK as OS X 10.9 and changed the OS X Deployment Target to OS X 10.8 and compiled successfully. But when I execute on a third computer that's running OS X 10.8 and doesn't have either of the libraries installed, I get the following error:

dyld: lazy symbol binding failed: Symbol not found: ___sincos_stret
Referenced from: /Users/ec/Desktop/Auto Designer C Program Testing/Auto Designer
Expected in: /usr/lib/libSystem.B.dylib

dyld: Symbol not found: ___sincos_stret
Referenced from: /Users/ec/Desktop/Auto Designer C Program Testing/Auto Designer
Expected in: /usr/lib/libSystem.B.dylib

Trace/BPT trap: 5

(2) Second, I tried changing the Base SDK also to OS X 10.8 in Xcode while keeping the OS X Deployment Target to OS X 10.8. This time, I couldn't even compile my code. Xcode gave the following errors:

Undefined symbols for architecture x86_64:
"___sincos_stret", referenced from:
   _fftw_mktriggen in libfftw3.a(trig.o)
   _cexpl_sincos in libfftw3.a(trig.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Any help on how I might solve this is much appreciated. Thanks

Rahul
  • 95
  • 1
  • 2
  • 9
  • your problem could be that you are linking the libraries dynamically. Do you have the chance to link them statically into your code? – solick Mar 14 '14 at 05:47
  • I'm not very well versed with C and so I don't have a good answer to your question. I can try linking them statically if you can guide me through how I might do that (preferably through Xcode or alternatively via Terminal). Thanks. – Rahul Mar 14 '14 at 05:49
  • @solick I think I did link them statically. What I did in Xcode was this: For my command line tool Target, under Build Phases->Link Binary with Libraries, I dragged and dropped libaiff.a and libfftw3.a in that order. Aren't those the required static libraries? – Rahul Mar 14 '14 at 06:05
  • Yes, .a files are static libraries. I was just wondering because your example code shows /usr/lib/libSystem.B.dylib. And dylib means dynamically ;) – solick Mar 14 '14 at 07:10
  • However, have you tried to get older versions from libaiff.a and lubfftw3.a? As far as i understand the following website, you need to compile the lib on your own by using the command line tools for the target MAC OS System: http://fink.thetis.ig42.org/download/index.php?phpLang=en – solick Mar 14 '14 at 07:14

0 Answers0