merge static libraries into single

后端 未结 3 871
南笙
南笙 2020-12-01 14:20

How to merge the static libraries into single one?

I do have three static libraries libSignatureLibary_armv6.a , libSignatureLibary_armv7.a and libSignatureLibary_i

相关标签:
3条回答
  • 2020-12-01 14:50

    Open terminal and go to folder with your libs. Then use command:

    lipo -create libSignatureLibary_armv6.a libSignatureLibary_armv7.a libSignatureLibary_i368.a -output libSignatureLibary.a
    
    0 讨论(0)
  • 2020-12-01 14:52

    lipo command

    Create or operate on a universal file: convert a universal binary to a single architecture file, or vice versa.

    lipo from the liposuction. As you know when you build a project Xcode generate binary for different CPU architectures.

    • When a developer wants to share a producer binary as a closed-sorce he should take into account that a client should have a possibility to run/debug a project with this binary on a real device and a simulator. This simple example shows that the developer has to have a tool to merge binary for different arch into a single file - fat binary.
    • Another example is when you publish an app to AppStore you can remove unnecessary arch using -remove option.

    • If you try to build a project with a binary without necessary arch you get an error[Could not find module for architecture]

    Architectures:

    • Simulator - x86_64, i386
    • Device - armv7, armv7s, arm64

    If you try run this command for binaries with the same arch you will get

    fatal error: <binary_list> have the same architectures (<arch>) and can't be in the same fat output file
    

    Please note that -create option do not have parameters

    lipo libMy_armv6.a libMy_armv7.a libMy_i368.a -create -output libMy.a
    

    To check existing architectures

    lipo -info <binary_path>
    //or
    file <binary_path>
    

    [Vocabulary]

    0 讨论(0)
  • 2020-12-01 14:57
    lipo -create libSignatureLibary_armv6.a libSignatureLibary_armv7.a libSignatureLibary_i368.a -output libSignatureLibary.a
    
    0 讨论(0)
提交回复
热议问题