Which version of Xcode does xcodebuild use? - xcode4

I have installed both Xcode 3.2 and Xcode 4.0.2 on the same machine, which uses Hudson for automated CI (continuous integration) builds. When I say that both were installed, what I mean by that is that I can use both Xcode 3 and Xcode 4 simultaneously or interchangeably. They both exist on the machine, as I did a custom install for Xcode 4 without overwriting Xcode 3 (supposedly).
Do command line calls to 'xcodebuild' invoke Xcode 3 or Xcode 4?
Does that question even make sense? Someone who may or may not be knowledgable on the topic is requesting that some projects be built with 3 and some with 4.
If so, how do I force it to use 3 or 4?
alternatively, is there a separate location where Xcode 3's 'xcodebuild' is stored vs. where Xcode4's 'xcodebuild' is stored? If there is, I can just use a different path in my build script.

You can find out what version is xcodebuild using with xcode-select -print-path. Also, change to a different version using xcode-select -switch <path>

Also, to determine which XCode environment is being used, use the command xcodebuild -version.

Outside the terminal, you can view and change this in Xcode.
Open Preferences, then select the Locations tab. Near the bottom, an entry titled Command Line Tools labels a dropdown, whose selection corresponds to the version of Xcode used in xcodebuild.
You may open this dropdown to select another version of Xcode that you have installed in your /Applications or ~/Applications folder.
Interestingly, this panel only says what this pop-up menu does and that it's analogous to xcode-select if you've selected a different version of Xcode than the one it's running in.
In case you need it, I also have a screenshot from what this used to look like in Xcode 8.

Related

How to open project files with Xcode 4 by default while having Xcode 5 installed alongside

Xcode 4 is still my main IDE for iOS development. To try the upcoming iOS 7 I installed Xcode 5 Developer Preview and now all the files that were used to open in Xcode 4 now open in Xcode 5.
How can I revert Xcode 4 to be default editor again without uninstalling Xcode 5?
After reading about LaunchServices in OS X I have finally found the solution, thanks for the hint #peter-m.
To modify files association for certain app one can use lsregister tool. So to re-register the app there is -f parameter, and to unregister -u. Everything can be in fact done with just one command:
$ lsregister -f /Applications/Xcode.app
Or if you want to unregister Xcode 5 and not touch manually set associations earlier:
$ lsregister -u /Applications/Xcode5-DP5.app
lsregister is located in /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/, so add it to your $PATH
Re-login to OS X for changes to apply.
Assuming you don't have any Xcode 5 projects yet, how about manually:
Find an existing XCode 4 project (*.xcodeproj) with the Finder
Do a Get Info of the file
Change Open with: to your desired version of Xcode
Click on Change All
Repeat for all types of files that you want to open with XCode 4
Or if you want to try something more automatic take a look at: programmatically-script-atically-changing-the-default-open-with-setting
Based on the comment below, the problem seems to be with command line builds picking the wrong version of Xcode. In that case I suggest looking at: xcode-build-and-archive-from-command-line, especially the Reid's comment to his own answer which says:
Works fine in Xcode 4.4, and I'm sure it was fine in 4.3 as well. Make sure you have selected the correct Xcode release by using:
xcode-select <path to Xcode.app>
So perhaps the correct solution is based around understanding:
xcode-select -- Manages the path to the Xcode folder for Xcode BSD tools.

Qt Creator needs a compiler set up to build. Configure a compiler in the kit options

I Have Installed Qt Creator5 with latest binaries.
but when i am running any program it is giving me this error.
:-1: error: Qt Creator needs a compiler set up to build. Configure a compiler in the kit options.
i have searched the whole internet for answer but its inadequate and not helping.
kindly reply the way to get rid of this error.
i was also having the same problem so what i did is
For linux
sudo apt-get install g++
sudo apt-get install libgl1-mesa-dev libglu1-mesa-dev
and then closed the qt creator and restarted it and it worked
i do not know which of the above two made it work but it worked !!
For Windows
Below given solution have worked for few people. so it is worth a try.
Delete this file
C:\Users\AppData\Roaming\QtProject\qtcreator\toolchains.xml
to solve the problem.
For me on Windows 7 this was solved by clicking on the arrow icon next to the computer icon on the bottom left of the Qt Creator screen above green arrows and then double clicked a compiler on the list and rebuild the project.
* for windows users only *
Before continuing to next steps make sure u have downloaded latest version of Qt.
Download and install minGW-64-bit from link:
https://sourceforge.net/projects/mingw-w64/files/latest/download
Remember The directory to which you install minGW.
Open Qt creator and go to tools -> options -> Build and Run
In Compilers tab Select add -> MinGW -> Name: MinGW path: Browse for mingw-w64.bat (you will find this file in the directory in which you have installed MinGW).ABI: x86 Windows msvc2015 pe 64bit Don't forget to apply your edits.
Go to Kit -> add Name: GCC Device Type: Desktop Device: Local PC (Default for desktop) Compiler: minGW Qt Version: select newest version Apply changes and restart qt
While creating new project make sure you use GCC as kit
If it still doesn't works Click computer icon on bottom left above play button -> GCC -> Build
OR
Go to projects (It is in the menu on left hand side) -> Build Steps -> make -> Override minGw31-make.exe -> browse to path in which you have installed minGW/bin\mingw32-make.exeDo the same for clean steps too
If u Still get any error after these steps try setting Environment Variables
Press Win+Q
Type " Environment variables "
click on " Edit the system environment variables "
System Properties -> Advance -> Environment Variables
Click on path (NOTE : Use These steps very carefully and do not mess with other options)
Click edit
press right arrow to go to end of text
type a semi-colon (if it isn't at the end of it because all the system paths are distinguished by a semi-colon)
paste path "MinGW_installation_directory\bin" (In my case it was "G:\Qt\Tools\mingw32\bin"). Make sure you copy and paste CORRECT path
Click OK and apply the changes.
That should do it !!!
user2304430 has it right, I struggled also figure it out. Above the green Run/Debug buttons in the bottom left, there's a computer icon with a pop-out menu. In there, you have to select your kit.
I went in circles for half an hour checking that my kits were set up right in options. But you actually have to select the kit in the Computer Icon -> pop-out menu in the bottom left before it does anything.
Amazingly, the first many Google pages for the error don't show this, you'd think almost all new users run into this.
I had a similar issue when developing on my Mac -
I was trying to do desktop development with QT creator 3.3.0 based on QT 5.4.0 (Clang 6.0 (Apple)) on OSX 10.9. After trying to manually modify my kits to use GCC, G++, and CLANG. I finally found this really simple solution:
Delete the xxx.pro.user file and then restart QT Creator. It should then automatically pick up your compilers/environments.
Had the same issue on Fedora 22 after installing Qt5.5.
Installing the following packages did the trick:
sudo dnf install gcc-c++
sudo dnf install mesa-libGL-devel
When I installed Qt into folder ~/Qt/ and then manually renamed the folder into something other, I had similar problem. When I restored the folder name into the original ~/Qt/ (specified at the Qt installer), the problem has disappeared; all was solved.

How to run and use Xcode 3 and Xcode 4 under OS X 10.7 Lion?

I am looking for a full guide on how to trick Xcode3 to run under Lion.
I am aware that Apple does not support this, but this doesn't meant it's impossible, it's just not supported.
This is how I upgraded my dev environment to Lion. I am only doing it this way because I'm in a crunch and have some issues with Xcode 4.
I'm just sharing what I did and the issues I encountered, not recommending anything:
I made sure I could build & launch my Apps in 10.6.8 using Xcode 3.2.x.
I upgraded my development machine to Lion 10.7.1.
I can build all my SW products with Xcode 3.2.x.
BUT, the debugger seems unhappy with some things... Though I can step and break, I can't evaluate some expressions. For example, the twist pane won't display contents of complex structures.
I'm wondering if others have debugger issues with the 3.2.x Xcode (GDB) on Lion?
Thanks,
Rick
First you have to obtain the Xcode 3.2.6 install to work. The installer is not going to work on Lion so you have two alternatives:
Run it from another partition where you have 10.6
Path the installer in order to make it run on Lion by following this guide
Also here are some other things you may have to clean inside the xcode projects:
Remove lines like ARCHS = arm7 because it will fail to build for Simulator. Best is to let Xcode use defaults (all supported archs).
Check for SDKROOT = ..., it should be only iphoneos, macosx or undefined (not ""). Keep in mind that the SDK you are building against is not necessary the minimum required SDK for running the application. It's ok if SDKROOT is missing from Xcode project files but it's not ok if it does contain a path or "".
Remove any GCC_VERSION = ...

How do I specify an installation location for Xcode 4.1 from the Mac App Store?

I just installed Lion, and downloaded Xcode 4.1 from the Mac App Store. I like having my Xcodes installed in /Developer directories that have their Xcode versions appended (e.g. /Developer-xcode3.2.6). Downloading Xcode 4.1 from the Mac App Store just gives me an installer app, which does not allow me to specify an installation location, as Xcode installers did in the past. When I ran the installer, it asked me to move old Xcode 3 installs out of /Developer, so is just renaming the /Developer directory sufficient? Will that break stuff?
Locate the 'Xcode Install' package. Show package contents. Inside the Resources folder you will find Xcode.mpkg. Install as usual.
renaming the folder should be enough but, yes, it may break stuff if you continue to use xcode 3. “it may” because you will still have a “/Developer” folder which will contain tools xcode use. if they (the tools) don't change too much between xc3 & 4, you shouldn't have any problem.
but stick with xcode4 and you won't have any problem at all.

Xcode 4 (final version) error when building

I can't seem to find the answer.
I've just used Xcode 4 final version and built an existing project that was built ok with Xcode 3, but got this error:
ld: library not found for -lSystem.B
collect2: ld returned 1 exit status
Command /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc-4.2 failed with exit code 1
But another project was built OK with Xcode 4.
I installed Xcode 4 by choosing the default options.
Do I miss to include a library or framework somewhere?
Could somebody please help. Thank you.
Here's my solution for Xcode 4.0.2 with SDK 4.3 environment, but I believe it should also work on other setups.
libSystem.B.dylib is not present
under
/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.3.sdk/usr/lib,
however it is present for lower SDK
versions (e.g. iPhoneOS4.2.sdk)
most of the cases
libSystem.B.dylib is just a
symbolic link to libSystem.dylib
so in
iPhoneSimulator4.3.sdk/usr/lib
I've applied following command sudo
ln -s libSystem.dylib
libSystem.B.dylib and my simulator
builds started to work again :)
NOTE: libSystem.B.dylib is used by Flurry and Urban Airship so you better don't delete the reference in project file (of course Urban Airship does not work under Simulator, but I think Flurry does. libSystem.B.dylib may also be required by other libraries you included to your project.
UPDATE: solution still works for iOS5 Simulator after upgrading to Xcode 4.3
UPDATE, March 9th, 2k12: for Xcode installations via App Store, prefix above path with /Applications/Xcode.app/Contents or the path where you've installed Xcode.app.
Solved.
Turns out that there was a reference to libSystemB in my project (Don't know why it's there). After deleting the reference, it built well.
Thanks anyway guys!
-weak_library /usr/lib/libSystem.B.dylib breaks the iOS Simulator.
Use -weak-lSystem instead.
The quote belongs to gparker on the official dev forums.
-weak_library /usr/lib/libSystem.B.dylib breaks the iOS Simulator. Use -weak-lSystem instead.
nicktmro got it right, especially when you are developing cocos2d projects using xcode 4.x
I have the same problem since months and always kept making the symbolic link as described here everytime i updated xCode. Today I found a nice new way to fix this:
In your targets Build Phases go to 'Link Binary With Libraries' and search for:
libz.dylib
Set from 'Required' to 'Optional'
BUILD
BE HAPPY

Resources