Compiling a C program for previous OS X Version

跟風遠走 提交于 2019-12-11 00:30:03

问题


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

来源:https://stackoverflow.com/questions/22391848/compiling-a-c-program-for-previous-os-x-version

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!