Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. [Solved] Embedded Linux data directory
Forum Updated to NodeBB v4.3 + New Features

[Solved] Embedded Linux data directory

Scheduled Pinned Locked Moved Mobile and Embedded
6 Posts 3 Posters 10.2k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    portoist
    wrote on last edited by
    #1

    Hi,
    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!

    1 Reply Last reply
    0
    • Z Offline
      Z Offline
      ZapB
      wrote on last edited by
      #2

      Hmmm, good question and I'm not sure. A possible work around is to make /tmp writable. You could do this by making it a tmpfs filesystem type. ie add something like this to your /etc/fstab:

      @
      none /tmp/ tmpfs size=1M 0 0
      @

      which would create a tmpfs ramdisk with maximum size of 1MB.

      Nokia Certified Qt Specialist
      Interested in hearing about Qt related work

      1 Reply Last reply
      0
      • Z Offline
        Z Offline
        ZapB
        wrote on last edited by
        #3

        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)
        {
        Q_Q(QWSServer);
        Q_ASSERT(!qwsServer);
        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:

        @
        QString qws_dataDir()
        {
        static QString result;
        if (!result.isEmpty())
        return result;
        result = QT_VFB_DATADIR(qws_display_id);
        ...
        }
        @

        where QT_VFB_DATADIR is a macro in qvfbhdr.h declared as:

        @
        #define QT_VFB_DATADIR(DISPLAY) QString("%1/qtembedded-%2-%3")
        .arg(QT_QWS_TEMP_DIR).arg(getuid()).arg(DISPLAY)
        @

        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"
        #endif
        @

        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.

        Good luck!

        Nokia Certified Qt Specialist
        Interested in hearing about Qt related work

        1 Reply Last reply
        0
        • P Offline
          P Offline
          portoist
          wrote on last edited by
          #4

          Hello,
          thanks a lot for your answer and digging:) I'v decided to take simple solution and made /tmp writable. I was hoping that there will be some kind of easy solution like setting some enviroment variable not rebuilding Qt Embedded:)

          1 Reply Last reply
          0
          • S Offline
            S Offline
            Scylla
            wrote on last edited by
            #5

            We made the /tmp directory as "tmpfs" as ZapB mentioned above.

            1 Reply Last reply
            0
            • Z Offline
              Z Offline
              ZapB
              wrote on last edited by
              #6

              No problem. Either solution will work. It depends on your device configuration and other constraints as to what is the easiest. I've used the tmpfs approach too when we were booting a very minimal system using just an initramfs to launch only our application.

              Nokia Certified Qt Specialist
              Interested in hearing about Qt related work

              1 Reply Last reply
              0

              • Login

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • Users
              • Groups
              • Search
              • Get Qt Extensions
              • Unsolved