[Solved] Embedded Linux data directory
i’ve been trying to run Qt app on embedded device but i am getting following error:
Cannot create Qt for Embedded Linux data directory: /tmp/qtembedded-0
This message is right because my root dir is read only partition, read write partition is mounted on /APPL. Is there any way to tell Qt to use ie /APPL/tmp to create data directory?
Thanks for you answers!
OK I’ve done some digging and here’s what I’ve found. The QWSServer object tries to create and listen on a local socket which by default is /tmp/qtembedded-0. This is done in qwindowsystem_qws.cpp:
- void QWSServerPrivate::initServer(int flags)
- qwsServer = q;
- qwsServerPrivate = this;
- disablePainting = false;
- #ifndef QT_NO_QWS_MULTIPROCESS
- ssocket = new QWSServerSocket(qws_qtePipeFilename(), q);
where the function qws_qtePipeFilename() is defined in qapplication_qws.cpp and in turn calls qws_dataDir() which is in the same file. This in turn calls:
where QT_VFB_DATADIR is a macro in qvfbhdr.h declared as:
- #define QT_VFB_DATADIR(DISPLAY) QString("%1/qtembedded-%2-%3") \
and finally we see trace down that we need QT_QWS_TEMP_DIR which is declared as:
- #ifndef QT_QWS_TEMP_DIR
- #define QT_QWS_TEMP_DIR "/tmp"
So now we see that to locate the socket to a different location we somehow need to define QT_QWS_TEMP_DIR to a path of your choice that is writeable by the user your application will be running as.
I think you should be able to do this by defining QT_QWS_TEMP_DIR in the qplatformdefs.h of your custom mkspec. Then rebuild Qt Embedded for your target device and deploy and test.