How to compile/port Qt apps?


Zink

Member
Joined
Mar 8, 2012
Messages
170
Hi. I need a simple sound recording program. Since Audacity works only on the older kernel (and the older kernel doesn't work on my Pandy), and arecord is too simple, I need to find another app that will suit my needs. I have found KHdRecord, which looks like ideal for me, but when I try to compile it with C Dev Tools, I'm getting: "Environment variable QTDIR is not set. QTDIR must point to the QT development system"


So I have set QTDIR to /mnt/utmp/cdevtools/usr, but now I am getting lots of missing header file errors (like qapplication.h).


C Dev Tools readme file says that it can compile Qt apps. Do you have any ideas how to proceed?
 
So I have set QTDIR to /mnt/utmp/cdevtools/usr, but now I am getting lots of missing header file errors (like qapplication.h).

Try to set QTDIR to /mnt/utmp/cdevtools/usr/lib


or /mnt/utmp/cdevtools/usr/include/qt4
 
Are you using "qmake" rather than "make"?
Why should I? When I use qmake it shows information that it's purpose is to generate makefiles (and project files). There already is a makefile in the source.

Try to set QTDIR to /mnt/utmp/cdevtools/usr/lib


or /mnt/utmp/cdevtools/usr/include/qt4
Still the same errors.
 
You should use qmake before make anywayto update your makefile with the systemvariables.
 
If all else fails, try PanDebian, install the necessary gcc and qt dev files, and try compiling your program in that. You may have to symlink gcc-4.4 and g++-4.4 to gcc and g++.
 
You should use qmake before make anywayto update your makefile with the systemvariables.
Alright, I tried to use it, but the app doesn't have pro file included. So I have run qmake -project first, and it succeeded, then qmake without parameters, which have output:


qt_config.prf:7: include(file) requires one argument


But the makefile has been created. Then I tried to make it, but I got a lot of errors like this:



Code:
/mnt/utmp/cdevtools/usr/include/qt4/QtGui/qicon.h:142: error: expected declaration specifiers before 'Q_GUI_EXPORT'

/mnt/utmp/cdevtools/usr/include/qt4/QtGui/qicon.h:143: error: expected declaration specifiers before 'Q_GUI_EXPORT'

In file included from /mnt/utmp/cdevtools/usr/include/qt4/QtGui/qpushbutton.h:45,

				 from aboutbox.c:9:

/mnt/utmp/cdevtools/usr/include/qt4/QtGui/qabstractbutton.h:53: error: expected declaration specifiers before 'QT_MODULE'

/mnt/utmp/cdevtools/usr/include/qt4/QtGui/qabstractbutton.h:56: error: expected declaration specifiers before 'class'

/mnt/utmp/cdevtools/usr/include/qt4/QtGui/qabstractbutton.h:58: error: expected declaration specifiers before 'class'

/mnt/utmp/cdevtools/usr/include/qt4/QtGui/qabstractbutton.h:174: error: expected declaration specifiers before ';' token

In file included from aboutbox.c:9:

/mnt/utmp/cdevtools/usr/include/qt4/QtGui/qpushbutton.h:51: error: expected declaration specifiers before 'QT_MODULE'

/mnt/utmp/cdevtools/usr/include/qt4/QtGui/qpushbutton.h:54: error: expected declaration specifiers before 'class'

/mnt/utmp/cdevtools/usr/include/qt4/QtGui/qpushbutton.h:55: error: expected declaration specifiers before 'class'

/mnt/utmp/cdevtools/usr/include/qt4/QtGui/qpushbutton.h:57: error: expected declaration specifiers before 'class'

/mnt/utmp/cdevtools/usr/include/qt4/QtGui/qpushbutton.h:118: error: expected declaration specifiers before ';' token

aboutbox.c:10:19: error: qgrid.h: No such file or directory

In file included from /mnt/utmp/cdevtools/usr/include/qt4/QtGui/qlayout.h:46,

				 from aboutbox.c:11:

/mnt/utmp/cdevtools/usr/include/qt4/QtGui/qlayoutitem.h:54: error: expected declaration specifiers before 'QT_MODULE'

/mnt/utmp/cdevtools/usr/include/qt4/QtGui/qlayoutitem.h:58: error: expected declaration specifiers before 'class'

/mnt/utmp/cdevtools/usr/include/qt4/QtGui/qlayoutitem.h:59: error: expected declaration specifiers before 'class'

/mnt/utmp/cdevtools/usr/include/qt4/QtGui/qlayoutitem.h:60: error: expected declaration specifiers before 'class'

/mnt/utmp/cdevtools/usr/include/qt4/QtGui/qlayoutitem.h:61: error: expected declaration specifiers before 'class'

/mnt/utmp/cdevtools/usr/include/qt4/QtGui/qlayoutitem.h:62: error: expected declaration specifiers before 'class'

/mnt/utmp/cdevtools/usr/include/qt4/QtGui/qlayoutitem.h:64: error: expected declaration specifiers before 'class'

/mnt/utmp/cdevtools/usr/include/qt4/QtGui/qlayoutitem.h:91: error: expected declaration specifiers before ';' token

/mnt/utmp/cdevtools/usr/include/qt4/QtGui/qlayoutitem.h:93: error: expected '=', ',', ';', 'asm' or '__attribute__' before ':' token

/mnt/utmp/cdevtools/usr/include/qt4/QtGui/qlayoutitem.h:96: error: expected declaration specifiers before 'class'

/mnt/utmp/cdevtools/usr/include/qt4/QtGui/qlayoutitem.h:120: error: expected declaration specifiers before ';' token

/mnt/utmp/cdevtools/usr/include/qt4/QtGui/qlayoutitem.h:122: error: expected declaration specifiers before 'class'

/mnt/utmp/cdevtools/usr/include/qt4/QtGui/qlayoutitem.h:142: error: expected declaration specifiers before ';' token

/mnt/utmp/cdevtools/usr/include/qt4/QtGui/qlayoutitem.h:144: error: expected declaration specifiers before 'class'

/mnt/utmp/cdevtools/usr/include/qt4/QtGui/qlayoutitem.h:176: error: expected declaration specifiers before ';' token

In file included from aboutbox.c:11:

/mnt/utmp/cdevtools/usr/include/qt4/QtGui/qlayout.h:57: error: expected declaration specifiers before 'QT_MODULE'

/mnt/utmp/cdevtools/usr/include/qt4/QtGui/qlayout.h:60: error: expected declaration specifiers before 'class'

/mnt/utmp/cdevtools/usr/include/qt4/QtGui/qlayout.h:88: error: expected declaration specifiers before 'class'

/mnt/utmp/cdevtools/usr/include/qt4/QtGui/qlayout.h:90: error: expected declaration specifiers before 'class'

/mnt/utmp/cdevtools/usr/include/qt4/QtGui/qlayout.h:224: error: expected declaration specifiers before ';' token


I suppose there is something wrong with the generated pro file. I have a Qt installation on my Windows machine. Do you think creating a project for the files there could help?

If all else fails, try PanDebian, install the necessary gcc and qt dev files, and try compiling your program in that. You may have to symlink gcc-4.4 and g++-4.4 to gcc and g++.
Thanks, I will try this when I'm back home with more sane internet connection.
 
Hmmm, looks like it still uses qt3 and wasn't updated since 2006. Maybe there is some stuff thats not compatible anymore with qt4?
 
You mean that the program I'm trying to compile uses qt3, or c dev tools use qt3? Is there anything I can do to fix that (edit the sources)?
 
We have qt4 on the Pandora and maybe there is some deprecated stuff from 3 to 4. The program you want to compile needs qt3. Not sure how much of qt is downward compatible.


If you just need a recording program try this one, I attached here. I haven't tested it at all as i don't have my Pandora here, but it might just work...


It's sweep: http://www.metadecks.org/software/sweep/index.html

sweep.pnd
 

Attachments

  • sweep.pnd
    1.1 MB · Views: 250
Thanks, I tried this program, but I could not make it to record anything (I have selected about 7 seconds of file, but the recording took about 1 second). And it's philosophy is not suitable for my usage (I need to record speeches of unknown length).


I guess the best option will be to try to port the program to qt4 then. I wonder however, why it throws errors in qt files instead of app files, and if I will be able to determine what's wrong.
 
Might be some codingstyle that is not supported by newer gcc versions, too.


Also seems like it misses some headerfiles, what could lead to typedefs not being defined.


Edit: hunt down and include qgrid.h ;)
 
Last edited by a moderator:
Strange thing: I have increased the terminal scrollback to see the beginning of output, and possibly find our in what file there is something wrong. And the only thing I have found out is that it starts with reporting errors in the standard include files. I mean: if it was an error in a project's file, it would report an error in that file, not in the includes. And if it was missing header files, it would report missing header files (that should have been included in the files that need them) before the errors, right?


This is the beginning:



Code:
/media/PANHDD/src/khdrecord$ make

gcc -c -pipe -Wall -W -D_REENTRANT -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/mnt/utmp/cdevtools/usr/share/qt4/mkspecs/linux-g++ -I. -I/mnt/utmp/cdevtools/usr/include/qt4/QtCore -I/mnt/utmp/cdevtools/usr/include/qt4/QtGui -I/mnt/utmp/cdevtools/usr/include/qt4 -I. -Ilame -I. -o aboutbox.o aboutbox.c

In file included from /mnt/utmp/cdevtools/usr/include/qt4/QtCore/qobjectdefs.h:45,

				 from /mnt/utmp/cdevtools/usr/include/qt4/QtGui/qwindowdefs.h:45,

				 from /mnt/utmp/cdevtools/usr/include/qt4/QtGui/qwidget.h:45,

				 from /mnt/utmp/cdevtools/usr/include/qt4/QtGui/qdialog.h:45,

				 from aboutbox.c:9:

/mnt/utmp/cdevtools/usr/include/qt4/QtCore/qnamespace.h:54: warning: return type defaults to 'int'

/mnt/utmp/cdevtools/usr/include/qt4/QtCore/qnamespace.h: In function 'QT_MODULE':

/mnt/utmp/cdevtools/usr/include/qt4/QtCore/qnamespace.h:54: error: expected declaration specifiers before 'namespace'

/mnt/utmp/cdevtools/usr/include/qt4/QtCore/qnamespace.h:1744: error: expected declaration specifiers before 'Q_DECLARE_OPERATORS_FOR_FLAGS'

/mnt/utmp/cdevtools/usr/include/qt4/QtCore/qnamespace.h:1763: error: expected declaration specifiers before 'class'

/mnt/utmp/cdevtools/usr/include/qt4/QtCore/qnamespace.h:1818: error: expected declaration specifiers before ';' token

In file included from /mnt/utmp/cdevtools/usr/include/qt4/QtGui/qwindowdefs.h:45,

				 from /mnt/utmp/cdevtools/usr/include/qt4/QtGui/qwidget.h:45,

				 from /mnt/utmp/cdevtools/usr/include/qt4/QtGui/qdialog.h:45,

				 from aboutbox.c:9:

/mnt/utmp/cdevtools/usr/include/qt4/QtCore/qobjectdefs.h:51: error: expected declaration specifiers before 'QT_MODULE'

/mnt/utmp/cdevtools/usr/include/qt4/QtCore/qobjectdefs.h:55: error: expected declaration specifiers before 'class'

/mnt/utmp/cdevtools/usr/include/qt4/QtCore/qobjectdefs.h:142: error: expected declaration specifiers before 'template'

/mnt/utmp/cdevtools/usr/include/qt4/QtCore/qobjectdefs.h:145: error: expected declaration specifiers before 'template'

/mnt/utmp/cdevtools/usr/include/qt4/QtCore/qobjectdefs.h:212: error: expected declaration specifiers before 'Q_CORE_EXPORT'

/mnt/utmp/cdevtools/usr/include/qt4/QtCore/qobjectdefs.h:240: error: expected declaration specifiers before 'class'

/mnt/utmp/cdevtools/usr/include/qt4/QtCore/qobjectdefs.h:241: error: expected declaration specifiers before 'class'

/mnt/utmp/cdevtools/usr/include/qt4/QtCore/qobjectdefs.h:242: error: expected declaration specifiers before 'class'

/mnt/utmp/cdevtools/usr/include/qt4/QtCore/qobjectdefs.h:243: error: expected declaration specifiers before 'class'

/mnt/utmp/cdevtools/usr/include/qt4/QtCore/qobjectdefs.h:244: error: expected declaration specifiers before 'class'

/mnt/utmp/cdevtools/usr/include/qt4/QtCore/qobjectdefs.h:247: error: expected declaration specifiers before 'class'

/mnt/utmp/cdevtools/usr/include/qt4/QtCore/qobjectdefs.h:258: error: expected declaration specifiers before ';' token

/mnt/utmp/cdevtools/usr/include/qt4/QtCore/qobjectdefs.h:260: error: expected declaration specifiers before 'class'

/mnt/utmp/cdevtools/usr/include/qt4/QtCore/qobjectdefs.h:266: error: expected declaration specifiers before ';' token

/mnt/utmp/cdevtools/usr/include/qt4/QtCore/qobjectdefs.h:268: error: expected declaration specifiers before 'template'

/mnt/utmp/cdevtools/usr/include/qt4/QtCore/qobjectdefs.h:275: error: expected declaration specifiers before ';' token

/mnt/utmp/cdevtools/usr/include/qt4/QtCore/qobjectdefs.h:278: error: expected declaration specifiers before 'template'

/mnt/utmp/cdevtools/usr/include/qt4/QtCore/qobjectdefs.h:285: error: expected declaration specifiers before ';' token

/mnt/utmp/cdevtools/usr/include/qt4/QtCore/qobjectdefs.h:288: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token

/mnt/utmp/cdevtools/usr/include/qt4/QtCore/qobjectdefs.h:457: error: expected declaration specifiers before ';' token

/mnt/utmp/cdevtools/usr/include/qt4/QtCore/qobjectdefs.h:459: error: expected '=', ',', ';', 'asm' or '__attribute__' before '&' token

/mnt/utmp/cdevtools/usr/include/qt4/QtCore/qobjectdefs.h:466: error: expected ':', ',', ';', '}' or '__attribute__' before '*' token

/mnt/utmp/cdevtools/usr/include/qt4/QtCore/qobjectdefs.h:461: warning: empty declaration

/mnt/utmp/cdevtools/usr/include/qt4/QtCore/qobjectdefs.h:471: error: expected '=', ',', ';', 'asm' or '__attribute__' before ':' token

/mnt/utmp/cdevtools/usr/include/qt4/QtCore/qobjectdefs.h:474: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token



I tried to find qgrid.h, but there is no such file in c dev tools. aboutbox.c includes it, but not at the top. When I moved the include to the top, I saw:



aboutbox.c:8:19: error: qgrid.h: No such file or directory



I also tried to write a simple test app, consisting of one file:





Code:
#include <qdialog.h>


int main(int argc, char *argv[])

{


}


And the result is the same (lots of errors from files included from qdialog.h).


Now you can't tell me that the coding style is wrong :) . Maybe c dev tools need a serious update.


PanDebian installation on the way...
 
This file my also be deprcated in qt4.


It isn't in my toolchain, too. Did you try crosscompiling btw?
 
If possible, avoid using the qt4.7 as it blows up the pnd if you need to package it with it.


But yeah, then just do a symlink from q3grid.h to qgrid.h and put it somewhere the compile can find it.
 
I made it! I installed PanDebian and tried to compile it in it, but I was getting almost identical errors. So I searched the web, and found someone with similar problem, that was told to rename c files to cpp. I did that and the errors are gone! :D I still don't understand why it worked this way (how the program's author was building it), but it's of less importance now.


Well, under c dev tools I still was getting errors about invalid conversion between QString and char *, so I decided to compile it under PanDebian, in which I installed qt3 toolchain.


Now I have another problem: I can't record anything with the app :D . Maybe that was a bad choice, or maybe I could remove features that I don't need and try to adjust what's left for Pandora...
 
You need to comfigure your in and outputs of course. There is some magic to it afaik, but have a look into the audacity devthread for some starting ideas.
 
Hi. I need a simple sound recording program. Since Audacity works only on the older kernel (and the older kernel doesn't work on my Pandy), and arecord is too simple, I need to find another app that will suit my needs.
If you already try to compile a program yourself, why don't you try to compile audacity yourself for the new kernel?
 
You need to comfigure your in and outputs of course. There is some magic to it afaik, but have a look into the audacity devthread for some starting ideas.
The only configuration in/out in the program is "Sound Device" set to /dev/dsp and "Mixer Device" set to /dev/mixer. I tried setting Sound Device to /dev/snd/pcmC0D1p, but it didn't change anything (that was a shot in the dark, because I have no idea what these should be set to).


The program's behaviour is this: when I click "Start" (for recording) it gets pressed, but nothing shows in the wave bar, and when I click Stop the program hangs so that I have to kill it.

Hi. I need a simple sound recording program. Since Audacity works only on the older kernel (and the older kernel doesn't work on my Pandy), and arecord is too simple, I need to find another app that will suit my needs.
If you already try to compile a program yourself, why don't you try to compile audacity yourself for the new kernel?
Because Audacity needs fixes to work with the new kernel, and I have no idea where the problem is. Well, I assumed it needs fixes. Maybe it just needs to be recompiled with the new kernel libs, to work fine? I thought the best option would be to find another recording software for Debian, install it through synaptic, and if it works, try to make a pnd out of it. If that fails I think I will try to compile Audacity then.
 
Back
Top