/usr/bin/lipo hangs if current Xcode Developer path does not have a lipo

Originator:joshua.a.wise
Number:rdar://18701858 Date Originated:October 18, 2014
Status:Duplicate of 14384636 (closed) Resolved:
Product:Developer Tools Product Version:
Classification: Reproducible:always
 
Summary:
If the current Xcode Developer path (from xcode-select -p) does not have a lipo in its xctoolchain, then attempts to run 'lipo' will hang, rather than printing an error (or finding an appropriate lipo to run).

This goes about as badly with 'strings', too.

Steps to Reproduce:
1) Copy an old Xcode (i.e., Xcode 4.6.3) into /Applications.
2) xcode-select -s /Applications/Xcode-4.6.3.app/Contents/Developer/
3) Run /usr/bin/lipo --version.
4) xcrun and lipo hang, using 100% CPU.

Expected Results:
An error message should be produced.

Actual Results:
xcrun and lipo spin and hang until killed.

Version:
OS X 10.10 GM; Xcode in question is 4.6.3, but this in principle could happen at any time if you fail to upgrade Xcode after upgrading your OS.

Notes:


Configuration:
This happens when there is a mismatch between the selected Xcode and the system existing command line utilities.

Comments

Workaround

Someone found a workaround:

http://stackoverflow.com/questions/18667916/xcrun-lipo-freezes-with-os-x-mavericks-and-xcode-4-x

I amended with:

Worse than that, this happens even if a "reasonable" Xcode is xcode-selected, and an old Xcode's xcodebuild tries to invoke lipo. For instance, if I do:

joshua@bruges:~/projects/horndis/HoRNDIS$ xcode-select -p /Applications/Xcode.app/Contents/Developer/ joshua@bruges:~/projects/horndis/HoRNDIS$ lipo --version fatal error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/lipo: unknown flag: --version

lipo works in this case

joshua@bruges:~/projects/horndis/HoRNDIS$ /Applications/Xcode-4.6.3.app/Contents/Developer/usr/bin/xcodebuild [...] CreateUniversalBinary build/Release/HoRNDIS.kext/Contents/MacOS/HoRNDIS normal "x86_64 i386" cd /Users/joshua/projects/horndis/HoRNDIS lipo -create /Users/joshua/projects/horndis/HoRNDIS/build/HoRNDIS.build/Release/HoRNDIS.build/Objects-normal/x86_64/HoRNDIS /Users/joshua/projects/horndis/HoRNDIS/build/HoRNDIS.build/Release/HoRNDIS.build/Objects-normal/i386/HoRNDIS -output /Users/joshua/projects/horndis/HoRNDIS/build/Release/HoRNDIS.kext/Contents/MacOS/HoRNDIS

hang!

So even if xcode-select is set correctly, it is still possible to get hosed by this.

Also, this leaves xcruns lying around that need to be manually killed! So this is really unpleasant.

By joshua.a.wise at Oct. 19, 2014, 5:52 a.m. (reply...)

Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!