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

ARCHS[@]: unbound variable #8035

Closed
wanqingrongruo opened this issue Aug 22, 2018 · 36 comments
Closed

ARCHS[@]: unbound variable #8035

wanqingrongruo opened this issue Aug 22, 2018 · 36 comments
Labels
s1:awaiting input Waiting for input from the original author s6:need sample Needs a sample project that reproduces the issue

Comments

@wanqingrongruo
Copy link

wanqingrongruo commented Aug 22, 2018

Report

What did you do?

Compile my project in xcode_10_beta_5

What did you expect to happen?

Bulid succeeded

What happened instead?

xxx/Pods/Target Support Files/Pods-xxx/Pods-xxx-frameworks.sh: line 128: ARCHS[@]: unbound variable
Command PhaseScriptExecution failed with a nonzero exit code

It is similar to 7708
I've seen the discussion about issue 7708, but i can't understand what should I do about my question.
I have tried to shield function strip_invalid_archs() implementation, then xcode show error blow:

Build input file cannot be found: '/Users/xxx/Library/Developer/Xcode/DerivedData/xxx-bxsyiukyiugqxobnrgskhrgynsbb/Build/Products/Debug-iphoneos/xxx.app/xxx

CocoaPods Environment

CocoaPods : 1.6.0.beta.1
Podfile:

workspace 'xxx.xcworkspace'

source 'xxx/SpecsSwift4.git'

platform :ios, '8.0'
use_frameworks!
use_modular_headers!
inhibit_all_warnings!

def xxx_pods
    pod 'AFNetworking', :path => 'submodules/AFNetworking/'
    pod 'MLeaksFinder', :path =>'submodules/MLeaksFinder/'
    pod 'IQKeyboardManager', :path =>'submodules/IQKeyboardManager/'
    pod 'WebViewJavascriptBridge', :path => 'submodules/WebViewJavascriptBridge'
    pod 'Zip'
    pod 'MBProgressHUD', :path =>'submodules/MBProgressHUD/'
    pod 'JDStatusBarNotification', :path =>'submodules/JDStatusBarNotification/'
    pod 'WEPopover', :path =>'submodules/WEPopover/'
    pod 'Pinyin4Swift', :path =>'submodules/Pinyin4Swift/'
    pod 'SwiftyJSON', :path =>'submodules/SwiftyJSON/'
    pod 'Mesh', :path =>'submodules/Mesh/'
    pod 'Album', :path =>'submodules/Album/'
    pod 'HUD', :path =>'submodules/HUD/'
    pod 'MediaEditorKit', :path =>'submodules/MediaEditorKit/'
    pod 'VideoPlayer', :path =>'submodules/VideoPlayer/'
    pod 'AlertController', :path =>'submodules/AlertController/'
    pod 'Core', :path =>'submodules/Core/'
    pod 'ImageSlideshow', :path =>'submodules/ImageSlideshow/'
    pod 'SnapKit', :path =>'submodules/SnapKit/'
    pod 'FDFullscreenPopGesture', :path =>'submodules/FDFullscreenPopGesture/'
    pod 'XCGLogger', :path =>'submodules/XCGLogger/'
    pod 'ActionSheet', :path =>'submodules/ActionSheet/'
    pod 'Eureka', :path =>'submodules/Eureka/'
    pod 'PopoverImagePicker', :path =>'submodules/PopoverImagePicker/'
    pod 'DZNEmptyDataSet', :path =>'submodules/DZNEmptyDataSet/'
    pod 'OpusAudio'
    pod 'FileBrowser', :path =>'submodules/FileBrowser/'
    pod 'ESTabBarController', :path =>'submodules/ESTabBarController/'
    pod 'AwesomeCollection', :path =>'submodules/AwesomeCollection/'
    pod 'DeepDiff', :path =>'submodules/DeepDiff/'
    pod 'ObjcExceptionBridging', :path =>'submodules/ObjcExceptionBridging/'
    pod 'Bugly'
    pod 'PinLayout', :path =>'submodules/PinLayout/'
    pod 'AnimatedCollectionViewLayout', :path =>'submodules/AnimatedCollectionViewLayout/'
    pod 'FSCalendar', :path => 'submodules/FSCalendar'
    pod 'HappyDNS', :path => 'submodules/HappyDNS'
    pod 'IGListKit', :path => 'submodules/IGListKit'
    pod 'MJExtension', :path => 'submodules/MJExtension'
    pod 'PhotoBrowser', :path => 'submodules/PhotoBrowser'
    pod 'PNChart', :path => 'submodules/PNChart'
    pod 'pop'

    pod 'UJCloudHttpRequestClient', :path =>'submodules/UJCloudHttpRequestClient/'
    pod 'UJBaseKit', :path =>'submodules/UJBaseKit/'
    pod 'UJAddressBook', :path =>'submodules/UJAddressBook/'
    pod 'UJDocument', :path =>'submodules/UJDocument/'
    pod 'UJClockIn', :path =>'submodules/UJClockIn/'
    pod 'UJForwardService', :path =>'submodules/UJForwardService/'
    pod 'UJTransfer', :path =>'submodules/UJTransfer/'
    pod 'UJMessage', :path =>'submodules/UJMessage/'

    pod 'ReactiveSwift', :path =>'submodules/ReactiveSwift/'
    pod 'ReactiveObjC', :path =>'submodules/ReactiveObjC/'
    pod 'ReactiveCocoa', :path =>'submodules/ReactiveCocoa/'
    pod 'Result', :path =>'submodules/Result/'
    
    pod 'Qiniu', :path => 'submodules/Qiniu'
    pod 'YTKNetwork', :path => 'submodules/YTKNetwork'
    pod 'YYCache', :path => 'submodules/YYCache'
    pod 'YYImage', :path => 'submodules/YYImage'
    pod 'YYWebImage', :path => 'submodules/YYWebImage'
    pod 'SVProgressHUD', :path => 'submodules/SVProgressHUD'
    pod 'TZImagePickerController', :path => 'submodules/TZImagePickerController'
    pod 'UICountingLabel', :path => 'submodules/UICountingLabel'
    
end

def xxxExtension_pods
    pod 'MBProgressHUD', :path =>'submodules/MBProgressHUD/'
    pod 'Masonry', :path =>'submodules/Masonry/'
    pod 'MJRefresh', :path => 'submodules/MJRefresh'
end

target 'xxx' do
    xxx_pods
end

target 'xxx_Develop' do
    xxx_pods
end

target 'BagExtension' do
    xxxExtension_pods
end

target 'BagExtension_Dev' do
    xxxExtension_pods
end

target 'Deprecated' do
platform :ios, '8.0'
     xxxExtension_pods
     xcodeproj 'Deprecated/Deprecated/Deprecated.xcodeproj'
end

target 'TodayExtensionDev' do
    pod 'SnapKit', :path =>'submodules/SnapKit/'
end

target 'TodayExtension' do
    pod 'SnapKit', :path =>'submodules/SnapKit/'
end

post_install do |installer|
    installer.pods_project.targets.each do |target|
        target.build_configurations.each do |config|
            config.build_settings['GCC_WARN_INHIBIT_ALL_WARNINGS'] = "YES"
        end
    end
end

Project that demonstrates the issue

sorry, our project is complicated, it is difficult to provide a sample for you

My English is so poor, I wish you can understand me, looking forward to your reply,thx.

@dnkoutso
Copy link
Contributor

is ARCHS specified in all targets? Sorry this is very difficult to diagnose without a sample app.

@dnkoutso dnkoutso added s6:need sample Needs a sample project that reproduces the issue s1:awaiting input Waiting for input from the original author labels Aug 22, 2018
@stale stale bot removed the s1:awaiting input Waiting for input from the original author label Aug 22, 2018
@dnkoutso dnkoutso added the s1:awaiting input Waiting for input from the original author label Aug 22, 2018
@wanqingrongruo
Copy link
Author

@dnkoutso thank you for your reply. My problem solved. Because I delete the arm64 in Build setting -> Valid Architectures.
I will close this issue.
Thank you very much.

@contisadmin
Copy link

line 144: ARCHS[@]: unbound variable
Command PhaseScriptExecution failed with a nonzero exit code

Please help

@fllaryora
Copy link

I am getting the same error like contisadmin in Nativescript

"tns-ios": {
"version": "6.5.2"
}

sent 3717339 bytes received 98 bytes 7434874.00 bytes/sec
total size is 3716539 speedup is 1.00
/Users/XXXXXXX/platforms/ios/Pods/Target Support Files/Pods-XXX/Pods-XXX-frameworks.sh: line 144: ARCHS[@]: unbound variable
Command PhaseScriptExecution failed with a nonzero exit code

@JeroenJK
Copy link

Is there any solution for this?
It seems to be a problem in Xcode 12.x.

First when building for the simulator, I got errors. That is fixed by changing arm64 to x86_64 in VALID_ARCHS.

Now when trying to deploy my app (with fastlane) this error is thrown by CocoaPods.

@niclaughter
Copy link

Yep, same problem here. On Xcode 12.0.1.

@JeroenJK
Copy link

JeroenJK commented Oct 15, 2020

Solution: https://stackoverflow.com/a/64150387/2399348

So, set VALID_ARCHS to $(ARCHS_STANDARD). This works for device AND simulator builds.

@fllaryora
Copy link

JeroenJK, first really thank you for share your thoughts or the solution that work in your project.

With hybrid word i mean Nativescript, flutter, and so on.

I am hybrid man in the hybrid world, and... it is not fantastic XD, therefore there is no solution for me today.

@Serge-SDL
Copy link

I am getting the same error like contisadmin in Nativescript

"tns-ios": {
"version": "6.5.2"
}

sent 3717339 bytes received 98 bytes 7434874.00 bytes/sec
total size is 3716539 speedup is 1.00
/Users/XXXXXXX/platforms/ios/Pods/Target Support Files/Pods-XXX/Pods-XXX-frameworks.sh: line 144: ARCHS[@]: unbound variable
Command PhaseScriptExecution failed with a nonzero exit code

For Nativescript users trying to build with xcode11, just comment the following lines on platforms/ios/internal/nativescript-build.xcconfig:

// Xcode 12
EXCLUDED_ARCHS_x86_64 = arm64 arm64e
EXCLUDED_ARCHS[sdk=iphonesimulator*] = i386 armv6 armv7 armv7s armv8 $(EXCLUDED_ARCHS_$(NATIVE_ARCH_64_BIT))
EXCLUDED_ARCHS[sdk=iphoneos*] = i386 armv6 armv7 armv7s armv8 x86_64

@itali43
Copy link

itali43 commented Oct 21, 2020

Solution: https://stackoverflow.com/a/64150387/2399348

So, set VALID_ARCHS to $(ARCHS_STANDARD). This works for device AND simulator builds.

This didn't work for me (was able to run it either on device or sim but not both depending on config) so I added x86_64 and i386 at the end:

$(ARCHS_STANDARD) x86_64 i386

I also flipped Build Active Architecture Only to 'Yes', and my problem went away.

Note: XCode 12.0.1, iPadOS 14.0.XX, bug did not exist in iPadOS 13/XCode 11.6.XX

Thank you so much to the previous posters for inspiring this fix.. this bug nearly killed me.

@kushalpal17
Copy link

line 144: ARCHS[@]: unbound variable
Command PhaseScriptExecution failed with a nonzero exit code

Please help, I am using Xcode 11.3.1

@itali43
Copy link

itali43 commented Nov 9, 2020

Hi @kushalpal17, did you try deleting the pod lock file, the pods folder and unistalling then reinstalling pods? I'd also consider updating / upgrading cocoapods. Also, turning your machine off and on again may make it work.

If none of that works out, maybe try what I did for 12.0.1? I don't think it will help but it probably won't hurt.
( I added the VALID_ARCHS key with the value: $(ARCHS_STANDARD) x86_64 i386 in user defined settings, I explain it a bit more above)

@ArneKorsika
Copy link

Solution: https://stackoverflow.com/a/64150387/2399348
So, set VALID_ARCHS to $(ARCHS_STANDARD). This works for device AND simulator builds.

This didn't work for me (was able to run it either on device or sim but not both depending on config) so I added x86_64 and i386 at the end:

$(ARCHS_STANDARD) x86_64 i386

I also flipped Build Active Architecture Only to 'Yes', and my problem went away.

Note: XCode 12.0.1, iPadOS 14.0.XX, bug did not exist in iPadOS 13/XCode 11.6.XX

Thank you so much to the previous posters for inspiring this fix.. this bug nearly killed me.

Thanks, this is the only solution that worked for me.
xCode 12.2 (12B45b) + iOS 14.2

@ahmedsafadii
Copy link

samee problem

@olegderecha
Copy link

Our team added the solution for fixing iOS build for Xcode 12, but stopped working on Xcode 11.
For Xcode 12 added:
EXCLUDED_ARCHS = arm64; into project.pbxproj but stopped working build for Xcode 11.
The solution was added to make build working for Detox / Mapbox / Xcode 12.

@caryz
Copy link

caryz commented Dec 12, 2020

Solution: https://stackoverflow.com/a/64150387/2399348
So, set VALID_ARCHS to $(ARCHS_STANDARD). This works for device AND simulator builds.

This didn't work for me (was able to run it either on device or sim but not both depending on config) so I added x86_64 and i386 at the end:
$(ARCHS_STANDARD) x86_64 i386
I also flipped Build Active Architecture Only to 'Yes', and my problem went away.
Note: XCode 12.0.1, iPadOS 14.0.XX, bug did not exist in iPadOS 13/XCode 11.6.XX
Thank you so much to the previous posters for inspiring this fix.. this bug nearly killed me.

Thanks, this is the only solution that worked for me.
xCode 12.2 (12B45b) + iOS 14.2

I could not get this to work on Xcode 12.2 (12B45b) for the life of me using these settings, even after having gone through multiple pages of Google results on GitHub and Stackoverflow.

As a last resort, I just started trying different Xcode 12.x versions. The moment I tried the same exact settings on Xcode 12.0.1 (12A7300) it was no longer an issue. Guess I'm staying on 12.0.1 for a while 🤷.

For what it's worth, I'm using Firebase Analytics + Crashlytics pods, with other dependencies on SPM.

@mlch911
Copy link

mlch911 commented Dec 14, 2020

Solution: https://stackoverflow.com/a/64150387/2399348
So, set VALID_ARCHS to $(ARCHS_STANDARD). This works for device AND simulator builds.

This didn't work for me (was able to run it either on device or sim but not both depending on config) so I added x86_64 and i386 at the end:
$(ARCHS_STANDARD) x86_64 i386
I also flipped Build Active Architecture Only to 'Yes', and my problem went away.
Note: XCode 12.0.1, iPadOS 14.0.XX, bug did not exist in iPadOS 13/XCode 11.6.XX
Thank you so much to the previous posters for inspiring this fix.. this bug nearly killed me.

Thanks, this is the only solution that worked for me.
xCode 12.2 (12B45b) + iOS 14.2

I could not get this to work on Xcode 12.2 (12B45b) for the life of me using these settings, even after having gone through multiple pages of Google results on GitHub and Stackoverflow.

As a last resort, I just started trying different Xcode 12.x versions. The moment I tried the same exact settings on Xcode 12.0.1 (12A7300) it was no longer an issue. Guess I'm staying on 12.0.1 for a while 🤷.

For what it's worth, I'm using Firebase Analytics + Crashlytics pods, with other dependencies on SPM.

I'm using Xcode 12.2, and his solution works for me.

@drosenstark
Copy link

Solution: https://stackoverflow.com/a/64150387/2399348

So, set VALID_ARCHS to $(ARCHS_STANDARD). This works for device AND simulator builds.

Lots of people reporting that this didn't work, but it worked for me. Xcode 12.3.

@bwoodlt
Copy link

bwoodlt commented Jan 1, 2021

None of this worked for me....

@martinfrouin
Copy link

The Build Settings editor no longer includes the Valid Architectures build setting (VALID_ARCHS), and its use is discouraged. Instead, there is a new Excluded Architectures build setting (EXCLUDED_ARCHS). If a project includes VALID_ARCHS, the setting is displayed in the User-Defined section of the Build Settings editor. (15145028)

-> https://developer.apple.com/documentation/xcode-release-notes/xcode-12-release-notes

It works for me by removing VALID_ARCHS lines on my project.pbxproj

@LorandP
Copy link

LorandP commented Jan 21, 2021

For those who have Xcode 11.5, I have managed to solve this by upgrading Xcode to 12.1 and having no VALID_ARCHS under Project -> Build settings -> User-Defined

@TurkiWalid
Copy link

TurkiWalid commented Feb 19, 2021

For me i solved building an Xcode 12.x project on Xcode 11.x by removing Excluded Architectures from Build Settings -> User Defined and setting Valid Architectures to $(ARCHS_STANDARD)

IAmKio added a commit to pillarwallet/pillarwallet that referenced this issue Apr 7, 2021
IAmKio added a commit to pillarwallet/pillarwallet that referenced this issue Apr 7, 2021
@taimourmaavan
Copy link

Adding $(ARCHS_STANDARD) to Valid Architectures in Build Settings solved it for me

@EddieXu123
Copy link

Please help: Xcode 13

@jonnokim17
Copy link

can't seem to resolve the issue on Xcode 13 as well.

@kockok
Copy link

kockok commented Oct 11, 2021

Screen Shot 2021-10-11 at 5 27 01 PM

Screen Shot 2021-10-11 at 5 27 54 PM

updated to Xcode 13

@exequielc
Copy link

@kockok did you solve this isue? or some one?

@kockok
Copy link

kockok commented Oct 25, 2021

@kockok did you solve this isue? or some one?

By updating to the latest pods, this issue changed from an error to a warning and I think it's solved.

However, another error raised instead.
Screen Shot 2021-10-25 at 6 37 54 PM

@thorfinnko
Copy link

having the same issue as @kockok

@LaiNhuTung
Copy link

+1 same issue @kockok

@thorfinnko
Copy link

I was able to create a build but the solution is not ideal, while creating a building have to remove arm64 from excluded architectures in pods and projects and while running the project on the simulator have to add the excluded arc > any ios SImulator SDK > then arm64 in that.
Is a hack of a solution but not ideal at all.

@windy48
Copy link

windy48 commented May 26, 2022

I'm using Xcode 13.4, I added arm64 to Build Setting -> Excluded Architectures to be able to run on iOS simulator
And when I archive the project I also met this issue, just remove the arm64 in Build Setting -> Excluded Architectures and it's solved

@tienlx91
Copy link

tienlx91 commented Aug 9, 2022

I'm using Xcode 13.4, I added arm64 to Build Setting -> Excluded Architectures to be able to run on iOS simulator And when I archive the project I also met this issue, just remove the arm64 in Build Setting -> Excluded Architectures and it's solved

The setting should show like this:

Screen Shot 2022-08-09 at 16 42 15

I was accidentally set arm64 to all, and the error will appear:
Screen Shot 2022-08-09 at 16 44 08

@NgocLe1001
Copy link

please help !!!

@olegderecha
Copy link

@NgocLe1001 ,
The problem is, that you don't know what is happening under Command PhaseScriptExecution failed with a nonzero exit code error, because you can't expand it in Xcode and to see in what exact script is executed. Xcode doesn't show it, because it is not the native script, but something from Build Phases.

You need:

  • to run the build using the command line
  • find the *.sh file that causes an error
  • open this file using open ... .sh
  • discover the script

Example. I had an issue with a build and didn't know where.
Run build command:
xcodebuild -workspace ios/{ProjectName}.xcworkspace -configuration Debug -UseModernBuildSystem=NO -scheme {SchemeName} -destination 'platform=iOS Simulator,name=iPhone 14,OS=16.1' -derivedDataPath ios/build

Then, I see this:
image

Open that failed screen and see what is inside and then you can at least know what script failed and where to search.
In my case the scrip was:
image

What to do next, depends on the issue.

@b0r1ngx
Copy link

b0r1ngx commented Mar 13, 2024

delete the arm64 in Build setting -> Valid Architectures.

It's helps, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
s1:awaiting input Waiting for input from the original author s6:need sample Needs a sample project that reproduces the issue
Projects
None yet
Development

No branches or pull requests