44

I've been playing around with Qt for a few hours now. I found that qmake produces Xcode project files on Mac OS X instead of good ol' makefiles. I don't want to launch Xcode every time I want to build "Hello, world".

How do I make qmake generate regular makefiles or, if that's something that cannot be done on the Mac, how do I compile .xcodeproj files from the command line?

I tried xcodebuild -project myProject -alltargets. I get a lot of output followed by Abort trap.

asked Dec 18, 2008 at 14:28
2
  • Looks like a bad target. Try maybe specifying a known-good target, or just without arguments (will build the default target) and see what happens. Commented Jan 3, 2009 at 18:31
  • can state clearly how you set the QMAKESPEC variable to macx-g++ i did like QMAKESPEC=macx-g++ at terminal,but when i write the qmake command it was unable to generate a makefile for me Commented Jan 7, 2009 at 3:33

4 Answers 4

60
$ man xcodebuild

So a typical command might be something like:

$ xcodebuild -project myProject.xcodeproj -alltargets
answered Dec 18, 2008 at 15:05
Sign up to request clarification or add additional context in comments.

1 Comment

I had to write the full name of my project file to get this to work, e.g., myProject.xcodeproj
21

The open-source Qt binary installers for OS X from Trolltech default to creating .xcodeproj files when you run qmake. I don't use XCode for editing so it is a pain to open it to compile the project.

To compile your projects from Terminal.app, just set an environment variable of QMAKESPEC to macx-g++

If you want to just compile a certain project from the terminal, go into that directory and run

qmake -spec macx-g++

When you run qmake, this will create a Makefile which you can use by running make.

answered Dec 18, 2008 at 17:43

2 Comments

can state clearly how you set the QMAKESPEC variable to macx-g++ i did like QMAKESPEC=macx-g++ at terminal,but when i write the qmake command it was unable to generate a makefile for me
@isaac export QMAKESPEC=macx-g++ (if you use sh at least)
2

Try the following way. It has to work.

xcodebuild -project myProject.xcodeproj -alltargets

I have used this method in most of my projects.

Didier Ghys
30.6k9 gold badges77 silver badges82 bronze badges
answered Jan 17, 2012 at 6:18

Comments

0

Looking at this part of your back trace:

# 2008年12月18日 20:40:52.333 xcodebuild[1070:613] [MT] ASSERTION FAILURE in /SourceCache/DevToolsBase/DevToolsBase-921/pbxcore/FileTypes/PBXCFBundleWrapperFileType.m:174 # Details: path should be a non-empty string, but it's an empty string # Object: # Method: -subpathForWrapperPart:ofPath:withExtraFileProperties: # Thread: {name = (null), num = 1}

This implies that something, maybe one of your configuration variables, is blank when it needs to refer to a file. What I'm wondering is if maybe you have an extra target in your project that doesn't work, so that building with -alltargets is what's causing your problem.

I tested xcodebuild without any arguments on one of my projects just now - it did a default build of my project without errors. What happens if you try it without arguments?

answered Dec 18, 2008 at 17:42

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.