[Merged, Moved] Compile problems on Ubuntu and OS X
-
I have a very basic application that just loads a qml file. Here is my error, any thoughts:
@Running build steps for project harvest...
Starting: "/usr/bin/qmake" /OE_Harvest_HEAD/Main/harvest-app/harvest.pro -r -spec macx-g++ QMLJSDEBUGGER_PATH=/Applications/Qt Creator.app/Contents/Resources/qml/qmljsdebugger
Reading /OE_Harvest_HEAD/Main/harvest-app/src/main/main.pro [/OE_Harvest_HEAD/Main/harvest-build-desktop/src/main]
Reading /OE_Harvest_HEAD/Main/harvest-app/src/test/test.pro [/OE_Harvest_HEAD/Main/harvest-build-desktop/src/test]
The process "/usr/bin/qmake" exited normally.
Starting: "/usr/bin/make" -w
make: Entering directory/OE_Harvest_HEAD/Main/harvest-build-desktop' cd src/main/ && /usr/bin/make -f Makefile make[1]: *** No rule to make target
main.cpp', needed by/OE_Harvest_HEAD/Main/harvest-app/build/obj/main.o'. Stop. make[1]: Entering directory
/OE_Harvest_HEAD/Main/harvest-build-desktop/src/main'
make[1]: Leaving directory/OE_Harvest_HEAD/Main/harvest-build-desktop/src/main' make: *** [sub-src-main-make_default] Error 2 make: Leaving directory
/OE_Harvest_HEAD/Main/harvest-build-desktop'
The process "/usr/bin/make" exited with code 2.
Error while building project harvest (target: Desktop)
When executing build step 'Make'@ -
I get this output error in Ubuntu. Any ideas?
@Running build steps for project harvest...
Starting: "/usr/bin/qmake-qt4" /home/kp/Desktop/harvest-app/harvest.pro -r -spec linux-g++ QMLJSDEBUGGER_PATH=/home/kp/qtcreator-2.1.81/share/qtcreator/qml/qmljsdebugger
Reading /home/kp/Desktop/harvest-app/src/main/main.pro [/home/kp/Desktop/harvest-build-desktop/src/main]
Reading /home/kp/Desktop/harvest-app/src/test/test.pro [/home/kp/Desktop/harvest-build-desktop/src/test]
The process "/usr/bin/qmake-qt4" exited normally.
Starting: "/usr/bin/make" -w
make: Entering directory/home/kp/Desktop/harvest-build-desktop' cd src/main/ && /usr/bin/make -f Makefile make[1]: Entering directory
/home/kp/Desktop/harvest-build-desktop/src/main'
make[1]: *** No rule to make targetmain.cpp', needed by
/home/kp/Desktop/harvest-app/build/obj/main.o'. Stop.
make[1]: Leaving directory/home/kp/Desktop/harvest-build-desktop/src/main' make: Leaving directory
/home/kp/Desktop/harvest-build-desktop'
make: *** [sub-src-main-make_default] Error 2
The process "/usr/bin/make" exited with code 2.
Error while building project harvest (target: Desktop)
When executing build step 'Make'@ -
Contents of my .pro file:
@include(../src.inc)
QMAKE_CXXFLAGS_DEBUG += -fprofile-arcs
-ftest-coverage
QT += declarative
TARGET = harvest
SOURCES += main.cpp
harvest.cpp
HEADERS += harvest.h
CONFIG += no_fixpath
RESOURCES = resources.qrcharvest.path = /usr/bin/harvest
harvest.files = ../../build/dist/harvest
INSTALLS += harvest@Here is the directory listing for the project folder:
build build.inc harvest.pro harvest.pro.user src
-
-
What sort of information would be helpful?
Contents of ./harvest-app/src/
@
drwxr-xr-x 5 kp kp 4096 2011-01-18 09:20 .
drwxr-xr-x 6 kp kp 4096 2011-01-18 09:20 ..
-rw-r--r-- 1 kp kp 245 2011-01-18 07:53 harvest.cpp
-rw-r--r-- 1 kp kp 296 2011-01-18 07:53 harvest.h
drwxr-xr-x 3 kp kp 4096 2011-01-18 07:53 images
-rw-r--r-- 1 kp kp 518 2011-01-18 08:04 main.cpp
-rw-r--r-- 1 kp kp 316 2011-01-18 09:28 main.pro
-rw-r--r-- 1 kp kp 12179 2011-01-18 09:31 main.pro.user
drwxr-xr-x 3 kp kp 4096 2011-01-18 07:53 qml
-rw-r--r-- 1 kp kp 5467 2011-01-18 07:53 resources.qrc
drwxr-xr-x 6 kp kp 4096 2011-01-18 07:53 .svn
@[EDIT: code formatting, for listing, Volker]
-
As I keep looking it seems to have something to do with a main.o file which doesn't exist in my folder structure. Where can I get this?
-
Well as browsing through the forum I suppose this is the same topic as "here?":http://developer.qt.nokia.com/forums/viewthread/3279/
I assume it's better to talk about this topic there because missing declarations in the .pro file would have been my next guess and it looks like this is not a platform dependant issue!
-
The paths to your main.cpp and harvest.cpp and other SOURCES and HEADERS are wrong. They must be either
- absolute path (not recommended)
- or relative to the directory where your .pro file is in
To achieve the latter, go to a shell, enter the directory where your .pro file lives and list the source file on the command line like this:
@
ls -l src/main.cpp
@If you see a result, the argument to ls is what must go into your .pro file.
Also, qmake should have printed a warning on the console:
@
$ qmake
WARNING: Failure to find: main.cpp
WARNING: Failure to find: harvest.cpp
WARNING: Failure to find: harvest.h
@ -
The .o files are generated by your compiler.
Are your source files stored in the same directory as your .pro-file? If not, this might be kind of problem, because your project file declares it's sources to be
@SOURCES += main.cpp
harvest.cpp@This usually means that these files are in the same folder as the .pro-file.
-
I am using both OS X and Ubuntu and having issues on each. I tried both areas since with a different os in each because I wasn't for sure where the best location was for it.
-
They are not. I will do some experimenting.
-
Thats fine. Still having some issues... and still poking around.
-
An easy solution for the SOURECS definition is to declare it as:
(notice that I assume that your sources and headers are located in src)@
SOURCES += src/main.cpp
src/harvest.cpp
INCLUDEPATH += src/
@With INCLUDEPATH qmake will configure make to find all header files within the src folder because this will also cause some trouble if they are not found.
I hope this helps you a little bit.
-
That change rendered this error:
@Running build steps for project main...
Configuration unchanged, skipping qmake step.
Starting: "/usr/bin/make" -w
make: Entering directory/home/kp/Desktop/harvest-app/src/main-build-desktop' /usr/bin/qmake-qt4 -spec /usr/share/qt4/mkspecs/linux-g++ QMLJSDEBUGGER_PATH=/home/kp/qtcreator-2.1.81/share/qtcreator/qml/qmljsdebugger /home/kp/Desktop/harvest-app/src/main/main.pro make: Leaving directory
/home/kp/Desktop/harvest-app/src/main-build-desktop'
/home/kp/Desktop/harvest-app/src/main/main.pro:13: Parse Error ('src/harvest.cpp')
Error processing project file: /home/kp/Desktop/harvest-app/src/main/main.pro
make: *** [/home/kp/Desktop/harvest-app/src/main-build-desktop/Makefile] Error 3
The process "/usr/bin/make" exited with code 2.
Error while building project main (target: Desktop)
When executing build step 'Make'@ -
My problem had to do with a shadow build and installing unit test files.