Important: Please read the Qt Code of Conduct -

Qtjsondb build failed for android

  • Hi

    when trying to build qtjsondb for android, got the error:

    jsondbpartition.cpp:62:25: fatal error: sys/statvfs.h: No such file or directory

    how to fix it?


  • in jsondbpartition.cpp, the following change should resolve the error:

    << #include <sys/statvfs.h>

    #ifndef ANDROID

    include <sys/statvfs.h>


    include <sys/vfs.h>

    define statvfs statfs


    I also ran into some other issues during the build:
    (Changes could be wrapped with #ifdef ANDROID...)

    qjsondbmodelutils.cpp failed due to "ambiguous overload for 'operator <'. Making the following change resolved that:

    //return (dLhs->directions[i] ? lhsValue < rhsValue : rhsValue < lhsValue);
    return (dLhs->directions[i] ? rhsValue > lhsValue : lhsValue > rhsValue);

    1. src/daemon/main.cpp failed since lockf and F_TLOCK are not defined.

      //if (lockf(lfp, F_TLOCK, 0)<0)
      if (fcntl(lfp, 1, 0)<0)

    2. dbserver.cpp failed since '::getpwent': wasn't defined.

      //#if defined(Q_OS_UNIX)
      #if defined(Q_OS_UNIX) && !defined(ANDROID)

Log in to reply