Cocoapods: No way to add passing test_spec that doesn't cause build warning "Mapping architecture armv7 to i386. Ensure that this target's Architectures and Valid Architectures build settings are configured correctly for the iOS Simulator platform"

Created on 1 Oct 2019  路  7Comments  路  Source: CocoaPods/CocoaPods

Report

What did you do?

Add test_spec to podspec.

s.test_spec 'Tests' do |test_spec|
  test_spec.source_files = 'Tests/**/*'
end
pod lib lint image_picker.podspec --no-clean --verbose

i386 linker errors

    Undefined symbols for architecture i386:
      "_FlutterMethodNotImplemented", referenced from:
          -[FLTImagePickerPlugin handleMethodCall:result:] in ImagePickerPlugin.o
      "_OBJC_CLASS_$_FlutterError", referenced from:
          objc-class-ref in ImagePickerPlugin.o
      "_OBJC_CLASS_$_FlutterMethodChannel", referenced from:
          objc-class-ref in ImagePickerPlugin.o
    ld: symbol(s) not found for architecture i386
    clang: error: linker command failed with exit code 1 (use -v to see invocation)

From the validator code it looks like the i386 simulator can be excluded by setting a VALID_ARCHS that includes armv7 and x86_64. See https://github.com/CocoaPods/CocoaPods/issues/8129.

Add s.pod_target_xcconfig = { 'VALID_ARCHS' => 'armv7 arm64 x86_64' } to podspec.

What did you expect to happen?

No build warnings or errors.

What happened instead?

Now there's a new warning, though no errors and tests pass:

warning: Mapping architecture armv7 to i386. Ensure that this target's Architectures and Valid Architectures build settings are configured correctly for the iOS Simulator platform. (in target 'image_picker' from project 'Pods')
warning: Mapping architecture arm64 to x86_64. Ensure that this target's Architectures and Valid Architectures build settings are configured correctly for the iOS Simulator platform. (in target 'image_picker' from project 'Pods')

Screen Shot 2019-10-01 at 11 20 04 AM

What's the suggested value of VALID_ARCHS that will prevent the i386 simulator from running but also not cause a build warning?

CocoaPods Environment

$ pod --version                                                               
1.8.1

Project that demonstrates the issue

https://github.com/flutter/plugins/tree/master/packages/image_picker/ios

awaiting input

Most helpful comment

same issue

All 7 comments

This seems to have made the warning go away in the actual Xcode project with any simulator/device selected:

s.pod_target_xcconfig = { 'VALID_ARCHS[sdk=iphonesimulator*]' => 'x86_64' }

But obviously that isn't the key the validator is checking, so in the lint I still get this note because the i386 simulator is still building:

- NOTE  | [iOS] xcodebuild:  ld: warning: ignoring file /Users/m/Library/Developer/Xcode/DerivedData/App-delzxvvvbagvqiamowplxdvtihdi/Build/Products/Release-iphonesimulator/image_picker/image_picker.framework/image_picker, building for iOS Simulator-i386 but attempting to link with file built for iOS Simulator-x86_64
- NOTE  | [iOS] xcodebuild:  ld: warning: ignoring file Flutter/Flutter.framework/Flutter, missing required architecture i386 in file Flutter/Flutter.framework/Flutter (3 slices)

This seems to have made the warning go away in the actual Xcode project

Interestingly this was only true for an Objective-C plugin. With a Swift plugin it fails to compile even though both apps have ONLY_ACTIVE_ARCH=NO for Release:

CompileSwift normal i386 (in target 'App' from project 'App')
    cd /var/folders/mv/qlhc4vsj6tqct166rw3zwmth00mfq2/T/CocoaPods-Lint-20191001-97932-c24o1c-test_swift_plugin
...
/var/folders/mv/qlhc4vsj6tqct166rw3zwmth00mfq2/T/CocoaPods-Lint-20191001-97932-c24o1c-test_swift_plugin/App/main.swift:1:8: error: could not find module 'test_swift_plugin' for target 'i386-apple-ios-simulator'; found: x86_64-apple-ios-simulator, x86_64
import test_swift_plugin

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates.

Same issue

same issue

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates.

This issue will be auto-closed because there hasn't been any activity for a few months. Feel free to open a new one if you still experience this problem :+1:

Was this page helpful?
0 / 5 - 0 ratings

Related issues

evermeer picture evermeer  路  3Comments

k06a picture k06a  路  3Comments

luhui picture luhui  路  3Comments

gerchicov-bp picture gerchicov-bp  路  3Comments

dawnnnnn picture dawnnnnn  路  3Comments