Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CP] Copy XCFrameworks script fails if the project path includes the name of a desired processor architecture #10430

Closed
scotthmccoy opened this issue Feb 13, 2021 · 3 comments
Labels
r:xcframeworks Related to the support for XCFrameworks s2:confirmed Issues that have been confirmed by a CocoaPods contributor s7:workaround available A workaround for the issue is available t2:defect These are known bugs. The issue should also contain steps to reproduce. PRs welcome!
Milestone

Comments

@scotthmccoy
Copy link

Report

What did you do?

Attempted to build a project for an iPhone 11 device in a directory with "arm64" in the path using a cocoapod that uses an XCFramework (GoogleAppMeasurement in this case).

What did you expect to happen?

The project to build.

What happened instead?

The select_slice function in PODNAME-xcframeworks.sh appears to evaluate the paths array for possible matches for architecture slices. Unfortunately, the array contains the full path to the xcframework as its first element. I'm guessing this is a mistake, or that the array should be iterated over starting from index 1 instead of 0. Normally this is probably not an issue as target_arch_regex will filter out any elements that don't match the desired architectures and the target_variant check will futher filter out elements that don't have "simulator" in them (if you are building for simulator). But, if that first element does pass all the checks, it will be stored in SELECT_SLICE_RETVAL which then gets handed to the copy_dir function whereupon rsync fails with "No such file or directory" causing the build to fail:

Showing Recent Messages
rsync --delete -av --filter P .*.?????? --links --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" "/Users/scottmccoy/.jenkins/workspace/ios-sdk_-_iPhone_8_OCMock_arm64/VrtcalSDK/Pods/GoogleAppMeasurement/Frameworks/GoogleAppMeasurement.xcframework//Users/scottmccoy/.jenkins/workspace/ios-sdk_-_iPhone_8_OCMock_arm64/VrtcalSDK/Pods/GoogleAppMeasurement/Frameworks/GoogleAppMeasurement.xcframework/" "/Users/scottmccoy/Library/Developer/Xcode/DerivedData/VrtcalSDK-eknzkgfvojhkdsayoiisbmbxnicq/Build/Products/Debug-iphoneos/XCFrameworkIntermediates/GoogleAppMeasurement"

building file list ... rsync: link_stat "/Users/scottmccoy/.jenkins/workspace/ios-sdk_-_iPhone_8_OCMock_arm64/VrtcalSDK/Pods/GoogleAppMeasurement/Frameworks/GoogleAppMeasurement.xcframework//Users/scottmccoy/.jenkins/workspace/ios-sdk_-_iPhone_8_OCMock_arm64/VrtcalSDK/Pods/GoogleAppMeasurement/Frameworks/GoogleAppMeasurement.xcframework/." failed: No such file or directory (2)

As a temporary fix I moved the project workspace to a directory that doesn't contain the word "arm64".

CocoaPods Environment

Stack

   CocoaPods : 1.10.1
        Ruby : ruby 2.6.3p62 (2019-04-16 revision 67580) [universal.arm64e-darwin20]
    RubyGems : 3.0.3
        Host : macOS 11.2 (20D64)
       Xcode : 12.4 (12D4e)
         Git : git version 2.24.3 (Apple Git-128)
Ruby lib dir : /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib
Repositories : trunk - CDN - https://cdn.cocoapods.org/

Installation Source

Executable Path: /usr/local/bin/pod

Plugins

cocoapods-deintegrate : 1.0.4
cocoapods-plugins     : 1.0.0
cocoapods-search      : 1.0.0
cocoapods-trunk       : 1.5.0
cocoapods-try         : 1.2.0

Podfile

platform :ios, '10.0'

workspace 'VrtcalSDK.xcworkspace'

target 'VrtcalSDKTests' do
    project 'VrtcalSDK/VrtcalSDK.xcodeproj'
    pod 'OCMock'
end

target 'VrtcalSDKInternalTestApp' do
    project 'VrtcalSDKInternalTestApp/VrtcalSDKInternalTestApp.xcodeproj'
    pod 'mopub-ios-sdk'
    pod 'Google-Mobile-Ads-SDK'
    pod 'InMobiSDK'
    pod 'FBAudienceNetwork'
end


post_install do |installer|
    installer.pods_project.targets.each do |target|
        puts
        puts "target.name: " + target.name
        if target.name != "OCMock" && target.name != "Pods-VrtcalSDKTests"
            puts "Changing build settings..."
            target.build_configurations.each do |config|
                config.build_settings['ARCHS'] = 'armv7 arm64 x86_64'
                config.build_settings['EXCLUDED_ARCHS[sdk=iphonesimulator*]'] = 'arm64'
                config.build_settings['EXCLUDED_ARCHS[sdk=iphoneos*]'] = 'x86_64'
            end
        end
    end
end

Project that demonstrates the issue

https://github.com/scotthmccoy/CocoapodsRegexIssue

To reproduce the issue, move the project to a directory that matches the architecture/platform you are building for. For example, "x86_64_simulator". By default the project is in "arm_64_simulator" as that is how the issue was discovered.

@dnkoutso
Copy link
Contributor

dnkoutso commented Aug 5, 2021

Nice thanks for this report!

@dnkoutso dnkoutso added this to the 1.11.0 milestone Aug 5, 2021
@dnkoutso dnkoutso added r:xcframeworks Related to the support for XCFrameworks s2:confirmed Issues that have been confirmed by a CocoaPods contributor t2:defect These are known bugs. The issue should also contain steps to reproduce. PRs welcome! s7:workaround available A workaround for the issue is available labels Aug 5, 2021
@dnkoutso
Copy link
Contributor

Fixed by #10858

@dnkoutso
Copy link
Contributor

Verified sample project submitted here correctly builds with #10858

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
r:xcframeworks Related to the support for XCFrameworks s2:confirmed Issues that have been confirmed by a CocoaPods contributor s7:workaround available A workaround for the issue is available t2:defect These are known bugs. The issue should also contain steps to reproduce. PRs welcome!
Projects
None yet
Development

No branches or pull requests

2 participants