将静态库转换为动态库dylib

比如我要将libGoogleAdmobAds.a转换为相应的dylib
首先要将fat格式的静态库转换为i386的瘦库(Thin library)
http://stackoverflow.com/questions/5352113/how-do-i-turn-a-fat-library-i...

lipo libx.a -thin armv6 -output libx-armv6.a
lipo libx.a -thin armv7 -output libx-armv7.a

然后,执行下面的命令
mkdir obj
cd obj
ar x ../libGoogleAdmobAds-i386.a
cc="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc"
gcc -fpic -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator6.1.sdk -dynamiclib -arch i386 -framework AudioToolbox -framework UIKit -framework Foundation -framework CoreGraphics -framework AdSupport -framework MessageUI -framework StoreKit -framework SystemConfiguration -o libGoogleAdMobAds.dylib *.o

注意要设置isysroot,否则找不到对应的Framework

libSDL2生成dylib的命令行
gcc -fpic -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator6.1.sdk -dynamiclib -arch i386 -framework AudioToolbox -framework QuartzCore -framework UIKit -framework CoreFoundation -framework OpenGLES -framework Foundation -framework CoreGraphics -o libSDL2.dylib *.o

libSDL2_mixer的生成命令
gcc -fpic -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator6.1.sdk -dynamiclib -arch i386 -L./ -l SDL2 -o libSDL2_mixer.dylib *.o