[Interest] Disable Qt Concurrent in 5.1 for simple RTOS

Thiago Macieira thiago.macieira at intel.com
Wed Oct 2 03:54:56 CEST 2013


On terça-feira, 1 de outubro de 2013 19:12:59, George Seibert wrote:
> Hi,
> 
> Has anyone compiled Qt 5 for a simple RTOS without threading?
> 
> I'm trying to compile Qt 5.1 for a small in-house RTOS which doesn't have
> threading.  I've tried -no-feature-concurrent, as well as -no-concurrent
> which isn't understood by configure, but Qt Concurrent is still reported as
> "yes" at the end of running configure.

Do you have compilation errors with QtConcurrent? If the module doesn't make 
sense for your OS, don't use it in your applications.

If the compiler in your OS is too old to understand QtConcurrent's template-
heavy code, you should edit the configure script and search for 
canBuildConcurrent. Right after that, there's a switch checking for OS and 
compiler which you can use to disable QtConcurrent.

> I've used the configure switch -no-feature-thread to disable threads, but
> I've run into compile errors regarding QThreadData.  This, after solving a
> compile error in qpropertyanimation.cpp that was missing an #ifndef
> QT_NO_THREAD around the QMutex locker.unlock() call.  The errors regarding
> QThreadData are more complex (invalid use of incomplete type in qthread_p.h
> and forward declaration in qobject.h).

Qt requires threads, period. There is no support for disabling threads in the 
Qt code. The last version that supported building without threads was 3.3.

The QT_NO_THREAD macro exists only as a convenience for the bootstrapped code 
(qmake, moc, rcc) which don't use threads, ever. They also don't use QObject. 
The main QtCore code, plus the rest of the modules, assumes threads are 
available and will use them.

Some classes *require* threads to work: QFileSystemModel, QProcess, etc.

> I'm fairly sure I can solve the compile errors, but the errors lead me to
> believe I'm not properly disabling threads/concurrency using configure.
> How do I disable threads and concurrency?

To disable QtConcurrent, see above.

You don't disable threads. At least, not without heavy modification of the 
code.

If you need just some simple classes, you may be able to use libQtBootstrap.a 
(the one that moc and rcc use). Note: there's absolutely no guarantee that 
this lib works or that it will remain present in future versions.

> Also, is there any way to disable the networking features?  According to
> the configure help, you can disable features with the -no-feature-<FEATURE>
> switch, with features listed in qfeatures.txt.  I've tried, for example,
> -no-feature-getaddrinfo, yet it's still reported as "yes" at the end of
> running configure.

That's because your OS supports getaddrinfo. Why do you want to disable code 
that works?

The -no-feature-<FEATURE> option exists for disabling Qt features, like 
disabling support for file dialogs, ItemViews, drag and drop, etc. It's not for 
OS-detection.

Also note that the feature system is not frequently tested. I can put you in 
contact with someone who used to maintain that (and has recently supplied 
patches to make it work), but the Qt Project does not guarantee that Qt works 
or even compiles if any feature is disabled. The Qt Project only supports a 
full build of each module.

-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 190 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20131001/163c6996/attachment.sig>


More information about the Interest mailing list