链接动态库时,我收到以下链接器错误并回溯:
ld -dylib -o libstx_libbasic.so -install_name @executable_path/libstx_libbasic.so libstx_libbasic.o /usr/lib/bundle1.o -lc -lffi ../librun/librun.so -lz -lbz2 -L/usr/X11/lib -lX11 -lXext
ld: warning: -macosx_version_min not specificed, assuming 10.6
Assertion failed: (_dependentDylibs.size() != 0), function File, file /SourceCache/ld64/ld64-127.2/src/ld/parsers/macho_dylib_file.cpp, line 403.
0 0x100011051 __assert_rtn + 81
1 0x100070195 mach_o::dylib::File<x86_64>::File(unsigned char const*, unsigned long long, char const*, long, unsigned int, bool, bool, bool, ld::MacVersionMin, ld::IOSVersionMin, bool, bool, char const*, bool) + 2181
2 0x100062ce9 mach_o::dylib::Parser<x86_64>::parse(unsigned char const*, unsigned long long, char const*, long, unsigned int, Options const&, bool) + 249
3 0x100061fcb mach_o::dylib::parse(unsigned char const*, unsigned long long, char const*, long, Options const&, unsigned int, bool, bool) + 315
4 0x100073980 ld::tool::InputFiles::makeFile(Options::FileInfo const&, bool) + 768
5 0x10007507b ld::tool::InputFiles::InputFiles(Options&, char const**) + 603
6 0x10001124a main + 282
make[4]: *** [libstx_libbasic.so] Error 1
现在有趣(奇怪)的事情是,我只在带有xcode4.2(用作jenkins构建服务器)的macmini上得到此错误,而不是在我开发的3.2.6 macbook pro上。 两者都安装了相同的10.6和gcc版本: 系统:
Systemversion: Mac OS X 10.6.8 (10K549)
Kernel-Version: Darwin 10.8.0
GCC
i686-apple-darwin10-llvm-gcc-4.2 (GCC) 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.1.00)
然而,失败的机器有XCode4.2,而成功的机器有XCode3.2.6!
坏(macmini):
Version: 4.2 (4C199)
Applications:
Xcode: 4.2 (828)
Instruments: 4.2 (4233)
Dashcode: 3.0.2 (336)
SDKs:
Mac OS X:
10.6: (10K549)
好(macpro):
Version: 3.2 (10M2518)
Applications:
Xcode: 3.2.6 (1761)
Instruments: 2.7 (3017)
Dashcode: 3.0.2 (333)
SDKs:
Mac OS X:
10.5: (9L31a)
10.6: (10M2518)
有没有人知道如何解决这种情况(通过编译器标志/ libs的额外安装?),我是否安装了不正确的东西或者我是否必须在构建机器上恢复到3.2.6?我宁愿让它用4.2编译,迟早,我将不得不使用它。
附加信息:我不需要任何XCode功能,因为这是一个纯C / X11应用程序,它不需要UIbuilder甚至是Objective-C(目前)。目标是x86_64(即不是iphone)
ld版坏了:
@(#)PROGRAM:ld PROJECT:ld64-127.2
llvm version 3.0svn, from Apple Clang 3.0 (build 211.10.1)
ld版本确定:
@(#)PROGRAM:ld PROJECT:ld64-97.17
llvm version 2.9svn, from Apple Clang 1.7 (build 77)