4

I'm trying to create a cocoa pod out of my Cocoa Touch Framework project. The project is not intended to support iOS simulator, only devices. It doesn't even compile for simulator. And it becomes a problem, because cocoapods tries (at least I think so) to build it for simulator and fails.

When I run the following command:

pod spec lint --verbose

it fails and the part of the output is the following:

The following build commands failed:
CompileC /var/folders/_w/9b4kyb8x2lzb9hvpn94jtrh00000gp/T/CocoaPods/Lint/build/Pods.build/Release-iphonesimulator/jsoncpp.build/Objects-normal/i386/jsoncpp.o jsoncpp/dist/jsoncpp.cpp normal i386 c++ com.apple.compilers.llvm.clang.1_0.compiler
(1 failure)
-> RevSDK (0.1.0)
- ERROR | [iOS] xcodebuild: Returned an unsuccessful exit code.
- NOTE  | xcodebuild:  Headers/Public/RevSDK/time.h:62:10: fatal error: 'base/base_export.h' file not found

Analyzed 1 podspec.

[!] The spec did not pass validation, due to 1 error.

I'm not really good at understanding how the whole process goes and what exactly is wrong, but this line in the output:

CompileC /var/folders/_w/9b4kyb8x2lzb9hvpn94jtrh00000gp/T/CocoaPods/Lint/build/Pods.build/Release-iphonesimulator/jsoncpp.build/Objects-normal/i386/jsoncpp.o jsoncpp/dist/jsoncpp.cpp normal i386 c++ com.apple.compilers.llvm.clang.1_0.compiler

makes me think that cocoapods is trying to compile my project for the simulator. So I need to exclude it somehow. I need to let it know that it should compile for device only. What I tried was adding the following into my .podspec file:

s.xcconfig     = {
'VALID_ARCHS' => ['armv7', 'armv7s', 'arm64']
}

but unfortunately it produced no effect. What can I try next?

halfer
  • 19,824
  • 17
  • 99
  • 186
Andrey Chernukha
  • 21,488
  • 17
  • 97
  • 161

2 Answers2

2

This is probably the same or similar issue around VALID_ARCHS being deprecated in Xcode 12 and EXCLUDED_ARCHS needed.

s.pod_target_xcconfig = { 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'arm64' }
Dipesh Pokhrel
  • 386
  • 5
  • 20
0

Try this:

s.pod_target_xcconfig = { 'VALID_ARCHS' => 'armv7', 'armv7s', 'arm64' }
Dharman
  • 30,962
  • 25
  • 85
  • 135
guozqzzu
  • 839
  • 10
  • 12