The problem background

Private Cocoapods is packaged and the class library is packaged

sudo gem install cocoapods-packager
Copy the code

Use after Installation

pod package xxx.podspec --library --force
Copy the code

The following error is reported, the command cannot be used

$ pod COMMAND

  CocoaPods, the Cocoa library package manager.
Copy the code

To solve the path

Reference: github.com/CocoaPods/c… The big guy said it was the environment, my path is not quite the same. Update gem, Ruby, etc. Install Cocoapods

Gem files will remain installed in xxx for inspection.
Results logged to xxx/gem_make.out
Copy the code

The xcode-select problem needs to be installed, but I have already installed the xcode-select problem, I have deleted RVM, Cocoapods, gem, etc., but I cannot install it again, and I cannot lower the Ruby version either

error: implicit declaration of function 'ffi_prep_closure_loc' is invalid in C99 [-Werror,-Wimplicit-function-declaration] ffiStatus = ffi_prep_closure_loc(code, &fnInfo->ffi_cif, callback_invoke, closure, code); ^ Function.c:852:17: note: did you mean 'ffi_prep_closure'? / Library/Developer/CommandLineTools/SDKs/MacOSX10.14 SDK/usr/include/block/ffi. H: 269:1: note: 'ffi_prep_closure' declared here ffi_prep_closure(Copy the code

Find the

gem install ffi -- --enable-system-libffi
Copy the code

After installing the pod package, continue to install cocoapods

xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer
Copy the code

Reference solutions:

Input: the xcode - select - print - path output: / Library/Developer/CommandLineTools input: Sudo xcode - select - switch/Applications/xcode. The app/Contents/Developer/input: xcode - select - print - path output: /Applications/Xcode.app/Contents/DeveloperCopy the code

4, continue pod package error

fatal error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/lipo: Pods/build/package.a and Pods/build-sim/package.a have the same architectures (arm64) and can't be in the same fat output file
Copy the code

See cocoapod-Packager’s official: github.com/CocoaPods/c… S. usser_target_xcconfig is not recommended

s.pod_target_xcconfig = {'EXCLUDED_ARCHS [sdk = iphonesimulator *]'=>'arm64'}
s.user_target_xcconfig = {'EXCLUDED_ARCHS [sdk = iphonesimulator *]'=>'arm64'}
Copy the code

Some change local cocoapods – pod_utils packager ruby source code. Rb solved the problem, find cocoapods – packager source path reference: www.jianshu.com/p/2df0bd221…

 config.build_settings['EXCLUDED_ARCHS[sdk=iphonesimulator*]'] = 'arm64'
Copy the code

I solved it by replacing the source code. There is another way: github.com/TyrantDante…

reference

Brew, macos install RVM, ruby and gem, initialization cocoaPods and its Active Admin gem ffi won ‘t the compile on macos iOS automated build xcode – select: error: tool ‘xcodebuild’ requires Xcode, but active developer directory ‘/Library/D… Xcode12 Cocoapods-package failed to Package the Framework