如何在XCode中构建dylib?

时间:2012-12-29 21:09:45

标签: xcode dylib libtool-xcode

我在源代码中有一个库,它在.a静态库中构建,但我需要.dylib。因此,我在“Build Settings”中选择Mach-O-Type作为“Dynamic Library”,但得到错误:

  

/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool -static -arch_only x86_64 -syslibroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer /SDKs/MacOSX10.8.sdk -L / Users / abc / Library / Developer / Xcode / DerivedData / mylib -fwducbhnvcuzuzaopjfimtlylztm / Build / Products / Debug -filelist / Users / abc / Library / Developer / Xcode / DerivedData / mylib-fwducbhnvcuzuzaopjfimtlylztm /Build/Intermediates/mylib.build/Debug/mylib-osx.build/Objects-normal/x86_64/mylib-osx.LinkFileList -fobjc-link-runtime -framework Foundation -o / Users / abc / Library / Developer / Xcode / DerivedData / MYLIB-fwducbhnvcuzuzaopjfimtlylztm /建造/产品/调试/的libmylib-osx.a

     

/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool:未知选项字符`f': - fobjc-link-runtime

libtool由于某种原因使用“-static”而不是“-dynamic”标志...我已经设置了兼容性版本。您认为可能出错?

1 个答案:

答案 0 :(得分:0)

目标文件(.o)可以从存档文件(.a)中提取,然后用libtool或gcc打包在.dylib中