samedi 14 février 2015

Install multiple different versions of Xcode


I am on Yosemite and trying to compile a software package using g++. Compiling this particular package has previously worked on Mountain Lion under Xcode 4.6.3, but now I have Xcode 6.1.1, and the software won't compile. For this reason, I'd like to be able to switch between different versions of Xcode. I should say I am working exclusively with the command-line tools (CLT), make, g++ and the like. Now I installed an earlier version of Xcode, 4.6.3, so that the situation is the following:



  • /Applications/Xcode.app: current version of Xcode, 6.1.1

  • /Applications/Xcode4.6.3/Xcode.app: earlier version of Xcode, 4.6.3


I was planning on switching in between these two using sudo xcode-select -s PATH. As far as I can tell, this command works, and I can check the result using sudo xcode-select -p. Further, I have CLTs installed in /usr/bin, so that e.g., which g++ shows /usr/bin/g++. Still, if I switch to the older Xcode version, the package won't compile. Interestingly, find below the output of g++ -v for the two different versions of Xcode:


For Xcode 6.1.1:



g++ -v
Configured with: --prefix=/Applications/http://ift.tt/1d5DwEL --with gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 6.0 (clang-600.0.56) (based on LLVM 3.5svn)
Target: x86_64-apple-darwin14.1.0
Thread model: posix


For Xcode 4.6.3:



g++ -v
couldn't understand kern.osversion `14.1.0'
Using built-in specs.
Target: i686-apple-darwin11
Configured with: /private/var/tmp/llvmgcc42/llvmgcc42-2336.11~182/src/configure --disable-checking --enable-werror --prefix=/Applications/http://ift.tt/1DrdSY6 --mandir=/share/man --enable-languages=c,objc,c++,obj-c++ --program-prefix=llvm- --program-transform-name=/^[cg][^.-]*$/s/$/-4.2/ --with-slibdir=/usr/lib --build=i686-apple-darwin11 --enable-llvm=/private/var/tmp/llvmgcc42/llvmgcc42-2336.11~182/dst-llvmCore/Developer/usr/local --program-prefix=i686-apple-darwin11- --host=x86_64-apple-darwin11 --target=i686-apple-darwin11 --with-gxx-include-dir=/usr/include/c++/4.2.1
Thread model: posix
gcc version 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.11.00)


So my questions are:


What does the message couldn't understand kern.osversion 14.1.0 refer to? Is this something I should be worried about?


Why does it continue to show



--prefix=/Applications/http://ift.tt/1DrdSY6


in the output of g++ -v after selecting the older version, pointing to the new Xcode package, even though I changed the Xcode path using sudo xcode-select -s PATH?


What is your preferred way of having multiple versions of Xcode, each with their own set of CLTs, installed at the same time?


It'd be great if someone could clear things up.





Aucun commentaire:

Enregistrer un commentaire