Opened 7 years ago

Closed 6 years ago

Last modified 4 years ago

#26391 closed defect (fixed)

xcodeversion not set correctly when xcodebuild fails to print the Xcode version

Reported by: ralph@… Owned by: macports-tickets@…
Priority: Normal Milestone: MacPorts 2.0.0
Component: base Version: 1.9.1
Keywords: Cc: simon.bugzilla@…, arritjenof@…
Port:

Description

I have Xcode 4.0 developer prerelease 3 installed in /Developer. Now, when I try to install any port, I get the following message

Error: The installed version of Xcode (2.0orlower) is too old to use on the installed OS version. Version 3.2.2 or later is recommended on Mac OS X 10.6.

Clearly, however it is working out the version of Xcode is getting the wrong answer. (The Finder clearly shows Xcode as being Version 4.0).

This is a serious bug which makes macports unusable for me.

Change History (23)

comment:1 Changed 7 years ago by danielluke (Daniel J. Luke)

  • Priority changed from High to Normal

comment:2 Changed 7 years ago by jmroot (Joshua Root)

We can't support prerelease software, but we'll apply a patch to fix this if anyone supplies one. Base determines the Xcode version by running xcodebuild -version.

comment:3 Changed 7 years ago by ralph@…

Please close. The issue arose due to manually moving the XCode install directory, causing xcodebuild -version being unable to find Xcode.

comment:4 Changed 7 years ago by danielluke (Daniel J. Luke)

  • Resolution set to invalid
  • Status changed from new to closed

comment:5 Changed 7 years ago by frederick.c.lee@…

  • Resolution invalid deleted
  • Status changed from closed to reopened

I have both Xcode 3.2.4 (my default) & Xcode 3.2.5 (beta) installed on Mac OS X 10.6.4 This is what I'm getting with macports:

[/Users/admin]sudo port upgrade outdated
Error: The installed version of Xcode (3.0) is too old to use on the installed OS version. Version 3.2.2 or later is recommended on Mac OS X 10.6.

I've ran 'xcodebuild' which appears to be for 'Xcode 4.2':

[/Users/admin]xcodebuild -version
XcodeComponent versions: DevToolsCore-1755.0; DevToolsSupport-1591.0
BuildVersion: 10M2409

Must I remove Xcode 3.2.5 & re-install Xcode 3.2.4 for ports to function properly? ... does it mean that I can't have multiple versions of Xcode installed?

comment:6 follow-up: Changed 7 years ago by jmroot (Joshua Root)

  • Resolution set to invalid
  • Status changed from reopened to closed

See comment:2. /usr/bin/xcodebuild must print a version that we can parse.

comment:7 in reply to: ↑ 6 Changed 7 years ago by frederick.c.lee@…

  • Resolution invalid deleted
  • Status changed from closed to reopened

Replying to jmr@…:

See comment:2. /usr/bin/xcodebuild must print a version that we can parse.

[/Users/admin/Workarea/Satellites, etc./gpredict-1.2]xcodebuild -version
XcodeComponent versions: DevToolsCore-1763.0; DevToolsSupport-1758.0
BuildVersion: 10M2423

This reflects Xcode version 3.2.5. Can't MacPort scan for 'DevToolsCore'???

I can't use MacPort until this is remedied.

Last edited 4 years ago by ryandesign (Ryan Schmidt) (previous) (diff)

comment:8 Changed 7 years ago by frederick.c.lee@…

This should be a better cut/paste:

xcodebuild -version
XcodeComponent versions: DevToolsCore-1763.0; DevToolsSupport-1758.0
BuildVersion: 10M2423

This should give the MacPort parser enough to read & interpret.

comment:9 Changed 7 years ago by frederick.c.lee@…

I've removed the Xcode 3.2.5 beta 3 and restarted my MacBookPro with the existing Xcode 3.2.4.

This time I see the 'Xcode 3.2.4' identifier versus previously (see above) I did not:

[/Users/admin]xcodebuild -version
Xcode 3.2.4
Component versions: DevToolsCore-1705.0; DevToolsSupport-1591.0
BuildVersion: 10M2309

I re-ran the MacPort update and all appears okay.

You may close this ticket.

comment:10 Changed 7 years ago by raimue (Rainer Müller)

  • Resolution set to invalid
  • Status changed from reopened to closed

comment:11 Changed 6 years ago by simon.bugzilla@…

  • Cc simon.bugzilla@… added

Cc Me!

comment:12 in reply to: ↑ description Changed 6 years ago by simon.bugzilla@…

  • Resolution invalid deleted
  • Status changed from closed to reopened

I think we need to reopen this bug as it appears in the final version of Xcode 4 too.

comment:13 Changed 6 years ago by jmroot (Joshua Root)

We'll need to see the output that xcodebuild -version gives with the final release. I must say though, it's suspicious that others (example) haven't seen any issues with Xcode 4 final. Are you sure you didn't install without UNIX Development?

comment:14 Changed 6 years ago by simon.bugzilla@…

xcodebuild -version returns,

Xcode 4.0
Build version 4A304a

I'm doing a full reinstall of Xcode, see if that fixes anything.

Last edited 4 years ago by ryandesign (Ryan Schmidt) (previous) (diff)

comment:15 Changed 6 years ago by jmroot (Joshua Root)

AFAICT that should be parsed correctly. There are two different error messages mentioned in this ticket so far; what is the exact one you are getting?

comment:16 Changed 6 years ago by jmroot (Joshua Root)

  • Resolution set to invalid
  • Status changed from reopened to closed

No response; closing.

comment:17 Changed 6 years ago by arritjenof@…

Hi,

i'm having the same issue, on an otherwise stable setup that allows me to actually do some work ;) For that reason, i have 2 versions of XCode/DevTools installed. One (3.2.6) is physically located on another partition that has a seperate (2nd) MacOSX installation (10.6.2) — but running that XCode while booted into the first (main) OS works fine.

On my main OSX/XCode partition i have mac ports installed, but (i think) ever-since installing XCode 4.0.1 it is broken, reporting the same error that Ralph mentiones:

$ > sudo port install tightvnc
Error: The installed version of Xcode (3.0) is too old to use on the installed OS version. Version 3.2.4 or later is recommended on Mac OS X 10.6.
Error: Status 1 encountered during processing.
To report a bug, see <http://guide.macports.org/#project.tickets>

Below i included the output of xcodebuild -version -sdk. (i'm sorry if that's a bit too verbose..).

$ > xcodebuild -version -sdk
iPhoneSimulator3.2.sdk - 'Simulator - iOS 3.2' (iphonesimulator3.2)
SDKVersion: 3.2
Path: /Volumes/hds/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.2.sdk
PlatformPath: /Volumes/hds/Developer/Platforms/iPhoneSimulator.platform
ProductBuildVersion: 7W367a
ProductCopyright: 1983-2010 Apple Inc.
ProductVersion: 3.2
ProductName: iPhone OS

iPhoneSimulator4.0.sdk - 'Simulator - iOS 4.0' (iphonesimulator4.0)
SDKVersion: 4.0
Path: /Volumes/hds/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.0.sdk
PlatformPath: /Volumes/hds/Developer/Platforms/iPhoneSimulator.platform
ProductBuildVersion: 8A400
ProductCopyright: 1983-2010 Apple Inc.
ProductVersion: 4.0.2
ProductName: iPhone OS

iPhoneSimulator4.1.sdk - 'Simulator - iOS 4.1' (iphonesimulator4.1)
SDKVersion: 4.1
Path: /Volumes/hds/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.1.sdk
PlatformPath: /Volumes/hds/Developer/Platforms/iPhoneSimulator.platform
ProductBuildVersion: 8B117
ProductCopyright: 1983-2010 Apple Inc.
ProductVersion: 4.1
ProductName: iPhone OS

iPhoneSimulator4.2.sdk - 'Simulator - iOS 4.2' (iphonesimulator4.2)
SDKVersion: 4.2
Path: /Volumes/hds/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.2.sdk
PlatformPath: /Volumes/hds/Developer/Platforms/iPhoneSimulator.platform
ProductBuildVersion: 8C134
ProductCopyright: 1983-2010 Apple Inc.
ProductVersion: 4.2
ProductName: iPhone OS

iPhoneSimulator4.3.sdk - 'Simulator - iOS 4.3' (iphonesimulator4.3)
SDKVersion: 4.3
Path: /Volumes/hds/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.3.sdk
PlatformPath: /Volumes/hds/Developer/Platforms/iPhoneSimulator.platform
ProductBuildVersion: 8F192
ProductCopyright: 1983-2011 Apple Inc.
ProductVersion: 4.3
ProductName: iPhone OS

MacOSX10.5.sdk - 'Mac OS X 10.5' (macosx10.5)
SDKVersion: 10.5
Path: /Volumes/hds/Developer/SDKs/MacOSX10.5.sdk
PlatformVersion: 1.0
ProductBuildVersion: 9L31a
ProductCopyright: 1983-2009 Apple Inc.
ProductVersion: 10.5.8
ProductName: Mac OS X
ProductUserVisibleVersion: 10.5.8

MacOSX10.6.sdk - 'Mac OS X 10.6' (macosx10.6)
SDKVersion: 10.6
Path: /Volumes/hds/Developer/SDKs/MacOSX10.6.sdk
PlatformVersion: 1.0
ProductBuildVersion: 10M2518
ProductCopyright: 1983-2011 Apple Inc.
ProductVersion: 10.6
ProductName: Mac OS X
ProductUserVisibleVersion: 10.6

iPhoneOS4.3.sdk - 'iOS 4.3' (iphoneos4.3)
SDKVersion: 4.3
Path: /Volumes/hds/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.3.sdk
PlatformVersion: 4.3
PlatformPath: /Volumes/hds/Developer/Platforms/iPhoneOS.platform
ProductBuildVersion: 8F191m
ProductCopyright: 1983-2011 Apple Inc.
ProductVersion: 4.3
ProductName: iPhone OS

XcodeComponent versions: DevToolsCore-1809.0; DevToolsSupport-1806.0
BuildVersion: 10M2518

XCode/IDE reports the following in the about window.

For 3.2.6

  Xcode IDE: 1761.0
  Xcode Core: 1809.0
  ToolSupport: 1806.0

For 4.0.1

  Build 4A1006

Additional:

$ > port version
Version: 1.9.2

MacOS

  10.6.7

hope this can help solve something ;).

thanks, arri

comment:18 Changed 6 years ago by arritjenof@…

  • Resolution invalid deleted
  • Status changed from closed to reopened

comment:19 follow-up: Changed 6 years ago by jmroot (Joshua Root)

  • Cc arritjenof@… added

We don't pass -sdk when we run it; please show what you get from just

/usr/bin/xcodebuild -version

comment:20 in reply to: ↑ 19 Changed 6 years ago by arritjenof@…

Replying to jmr@…:

We don't pass -sdk when we run it; please show what you get from just

/usr/bin/xcodebuild -version

output is the same, less the sdk-info. so just the last 2 lines

$ > xcodebuild -version
XcodeComponent versions: DevToolsCore-1809.0; DevToolsSupport-1806.0
BuildVersion: 10M2518

comment:21 Changed 6 years ago by arritjenof@…

I'd like to add another observation.

As i wrote, i have two seperate OSX-installs, each on a seperate partiotion. The main partition (hd) and a secondary partition (hds). On hd the OS is fully up-to-date, and it has XCode 4.0.1 installed. On hds an older version of 10.6 is installed, and XCode 3.2.6. Perhaps noteworthy is the fact that I installed XCode 3.2.6 on the secondary partition while being booted into the 'main' OS on hd (that already had XCode 4.0.1 installed)

Anyway, i just did some digging, and found 3 versions of xcodebuild present on my machine:

$ > which xcodebuild
/usr/bin/xcodebuild

$ > /usr/bin/xcodebuild -version
XcodeComponent versions: DevToolsCore-1809.0; DevToolsSupport-1806.0
BuildVersion: 10M2518

$ > /Developer/usr/bin/xcodebuild -version
Xcode 4.0
Build version 4A1006

$ > /Volumes/hds/Developer/usr/bin/xcodebuild -version
XcodeComponent versions: DevToolsCore-1809.0; DevToolsSupport-1806.0
BuildVersion: 10M2518

along the way, i also found the xcode-select tool

$ > man xcode-select
	…
	DESCRIPTION
		xcode-select controls the location of the Xcode folder which will be used by xcodebuild(1) and
		other, related Xcode BSD tools. This allows you to easily switch between using different versions
		of the Xcode tools
	…
$ > xcode-select -print-path
/Volumes/hds/Developer

appearantly, installing the older XCode version on the secondary partition, also changed the default xcode_folder_path. and it seems the xcodebuild binary in /usr/bin/ is just stub, invoking the xcodebuild tool in the appropriate xcode_folder_path...(?)

setting the xcode_folder_path to the main /Developer directory again, fixed the ports-problem for me.

$ > sudo xcode-select -switch /Developer
$ > xcodebuild -version
Xcode 4.0
Build version 4A1006

to test, you can also play around with this configuration by setting the environment variable DEVELOPER_DIR, this overrides whatever xcode-switch would output. see man xcode-switch

$ > xcode-select -print-path
/Volumes/hds/Developer
$ > xcodebuild -version
XcodeComponent versions: DevToolsCore-1809.0; DevToolsSupport-1806.0
BuildVersion: 10M2518
$ > export DEVELOPER_DIR=/Developer/
$ > xcodebuild -version
Xcode 4.0
Build version 4A1006

So, i'd like to appologize for creating the confusion caused by my own mess.

Ofcourse this still doesn't explain why the output of xcodebuild -version for XCode 3.2.6 is not accepted by mac ports, but i hope this info will help resolve that problem too..

comment:22 Changed 6 years ago by jmroot (Joshua Root)

Not sure why your 3.2.6 doesn't print its version number, mine does:

% xcodebuild -version
Xcode 3.2.6
Component versions: DevToolsCore-1809.0; DevToolsSupport-1806.0
BuildVersion: 10M2518

comment:23 Changed 6 years ago by jmroot (Joshua Root)

  • Milestone set to MacPorts 2.0.0
  • Resolution set to fixed
  • Status changed from reopened to closed
  • Summary changed from Bogues XCode too old message to xcodeversion not set correctly when xcodebuild fails to print the Xcode version

Should be more or less worked around by r78908. If you know the DevToolsCore version corresponding to an Xcode version not in the list and want it added, open an enhancement ticket with a patch, or just post it to the -dev list.

Note: See TracTickets for help on using tickets.