How do i compile a static library (fat) for armv6, armv7 and i386

后端 未结 4 1372
后悔当初
后悔当初 2020-12-01 02:23

I know this question has been posed several times, but my goal is slightly different with regard to what I have found searching the web. Specifically, I am already able to b

4条回答
  •  余生分开走
    2020-12-01 03:09

    There doesn't seem to be a need to extract from the fat library before rejoining any more (as described in jamie's answer). I'm using the final 4.0 SDK from apple, which appear to create the fat armv6/armv7 libraries by default.

    I was previously specifying the architecture for the input lib like so:

    $DEVROOT/usr/bin/lipo -arch arm $PROJECT_DIR/buildlib/Release-iphoneos/lib.a -arch i386 $PROJECT_DIR/buildlib/Release-iphonesimulator/lib.a -create -output $PROJECT_DIR/buildlib/lib.a
    

    This fails on the later SDKs, but removing the architecture from the (now fat) arm lib works fine:

    $DEVROOT/usr/bin/lipo $PROJECT_DIR/buildlib/Release-iphoneos/lib.a -arch i386 $PROJECT_DIR/buildlib/Release-iphonesimulator/lib.a -create -output $PROJECT_DIR/buildlib/lib.a
    

    Lipo must now be able to detect the architectures in the fat libraries.

提交回复
热议问题