本文共 558 字,大约阅读时间需要 1 分钟。
Mac平台编译demo加-static选项链接静态库报如下错误:
ld: library not found for -lcrt0.oclang: error: linker command failed with exit code 1
gcc -v or clang -v
Apple LLVM version 6.1.0Target:x86_64 -apple-arwin14.3.0Thread model: poxsix
原因:clang编译器不支持静态编译参数-static。
This won’t work. From the man page for gcc: This option will not work on Mac OS X unless all libraries (including libgcc.a) have also been compiled with -static. Since neither a static version of libSystem.dylib nor crt0.o are provided, this option is not useful to most people. 参考自:转载地址:http://ibnof.baihongyu.com/