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. Qt Android client for Postresql
QtWS25 Last Chance

Qt Android client for Postresql

Scheduled Pinned Locked Moved Mobile and Embedded
35 Posts 4 Posters 9.7k Views
  • 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.
  • A Offline
    A Offline
    akn10red
    wrote on last edited by
    #13

    this is the application output:

    @I/Qt ( 7822): qt start
    D/dalvikvm( 7822): Trying to load lib /data/data/org.qtproject.example.btchat/lib/libpq.so 0x411e6f98
    W/System.err( 7822): java.lang.reflect.InvocationTargetException
    W/System.err( 7822): at java.lang.reflect.Method.invokeNative(Native Method)
    W/System.err( 7822): at java.lang.reflect.Method.invoke(Method.java:511)
    W/System.err( 7822): at org.qtproject.qt5.android.bindings.QtActivity.loadApplication(QtActivity.java:245)
    W/System.err( 7822): at org.qtproject.qt5.android.bindings.QtActivity.startApp(QtActivity.java:655)
    W/System.err( 7822): at org.qtproject.qt5.android.bindings.QtActivity.onCreate(QtActivity.java:895)
    W/System.err( 7822): at android.app.Activity.performCreate(Activity.java:5008)
    W/System.err( 7822): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079)
    W/System.err( 7822): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2023)
    W/System.err( 7822): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084)
    W/System.err( 7822): at android.app.ActivityThread.access$600(ActivityThread.java:130)
    W/System.err( 7822): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195)
    W/System.err( 7822): at android.os.Handler.dispatchMessage(Handler.java:99)
    W/System.err( 7822): at android.os.Looper.loop(Looper.java:137)
    W/System.err( 7822): at android.app.ActivityThread.main(ActivityThread.java:4745)
    W/System.err( 7822): at java.lang.reflect.Method.invokeNative(Native Method)
    W/System.err( 7822): at java.lang.reflect.Method.invoke(Method.java:511)
    W/System.err( 7822): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
    W/System.err( 7822): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
    W/System.err( 7822): at dalvik.system.NativeStart.main(Native Method)
    W/System.err( 7822): Caused by: java.lang.UnsatisfiedLinkError: Cannot load library: reloc_library[1306]: 36 cannot locate 'sigemptyset'...
    W/System.err( 7822): at java.lang.Runtime.load(Runtime.java:340)
    W/System.err( 7822): at java.lang.System.load(System.java:521)
    W/System.err( 7822): at org.qtproject.qt5.android.QtNative.loadBundledLibraries(QtNative.java:156)
    W/System.err( 7822): at org.qtproject.qt5.android.QtActivityDelegate.loadApplication(QtActivityDelegate.java:430)
    W/System.err( 7822): ... 19 more@

    1 Reply Last reply
    0
    • A Offline
      A Offline
      antreimer
      wrote on last edited by
      #14

      The problem is this that it cannot locate 'sigemptyset'...

      isgemptyset should be in libc.so but is missing in the older android builds.

      The workaround that works for me was to staticlally link libc. I uploaded the changes and the lib is now 10x larger at 2MB. I'll update the wiki and include instructions to statically link.

      1 Reply Last reply
      0
      • A Offline
        A Offline
        antreimer
        wrote on last edited by
        #15

        The problem is this that it cannot locate 'sigemptyset'...

        isgemptyset should be in libc.so but is missing in the older android builds.

        The workaround that works for me was to staticlally link libc. I uploaded the changes and the lib is now 10x larger at 2MB. I'll update the wiki and include instructions to statically link.

        1 Reply Last reply
        0
        • A Offline
          A Offline
          akn10red
          wrote on last edited by
          #16

          with the new lib file the app crashes without showing any message. and application output is:
          @{ . . .
          I/Qt (27083): qt start
          D/dalvikvm(27083): Trying to load lib /data/data/org.qtproject.example.btchat/lib/libpq.so 0x411e4508
          F/libc (27083): Fatal signal 11 (SIGSEGV) at 0x00006c23 (code=1), thread 27083 (.example.btchat)
          }@

          EDIT: The app seems to be working on my phone. However I don't know whether it should work the same way as described in Qt documentation or not. The code given under doesn't seem to be making database connection (hence else part is executed) :
          @
          QSqlDatabase db= QSqlDatabase::addDatabase("QPSQL");

              db.setHostName("89.129.198.19");
              db.setDatabaseName("abcde");
              db.setUserName("activa");
              db.setPassword("X123xyz");
              db.setPort(5432);
          
              bool ok = db.open();
          
              if(!ok)
                  {
                      QMessageBox::information(this,"Connection","Connection Failed!");
                  }
              else
                  {
                       QMessageBox::information(this,"Connection","Connection Established!");
                  }@
          
          1 Reply Last reply
          0
          • A Offline
            A Offline
            akn10red
            wrote on last edited by
            #17

            with the new lib file the app crashes without showing any message. and application output is:
            @{ . . .
            I/Qt (27083): qt start
            D/dalvikvm(27083): Trying to load lib /data/data/org.qtproject.example.btchat/lib/libpq.so 0x411e4508
            F/libc (27083): Fatal signal 11 (SIGSEGV) at 0x00006c23 (code=1), thread 27083 (.example.btchat)
            }@

            EDIT: The app seems to be working on my phone. However I don't know whether it should work the same way as described in Qt documentation or not. The code given under doesn't seem to be making database connection (hence else part is executed) :
            @
            QSqlDatabase db= QSqlDatabase::addDatabase("QPSQL");

                db.setHostName("89.129.198.19");
                db.setDatabaseName("abcde");
                db.setUserName("activa");
                db.setPassword("X123xyz");
                db.setPort(5432);
            
                bool ok = db.open();
            
                if(!ok)
                    {
                        QMessageBox::information(this,"Connection","Connection Failed!");
                    }
                else
                    {
                         QMessageBox::information(this,"Connection","Connection Established!");
                    }@
            
            1 Reply Last reply
            0
            • A Offline
              A Offline
              antreimer
              wrote on last edited by
              #18

              The first so file I uploaded was only tested against lollipop. The second one was also tested against KitKat. I'll look into it. My brother has a Jellybean phone.

              Edit:

              I uploaded libpq.so now compiled with android-9.

              1 Reply Last reply
              0
              • A Offline
                A Offline
                antreimer
                wrote on last edited by
                #19

                The first so file I uploaded was only tested against lollipop. The second one was also tested against KitKat. I'll look into it. My brother has a Jellybean phone.

                Edit:

                I uploaded libpq.so now compiled with android-9.

                1 Reply Last reply
                0
                • A Offline
                  A Offline
                  akn10red
                  wrote on last edited by
                  #20

                  [quote author="antreimer" date="1424547268"]The first so file I uploaded was only tested against lollipop. The second one was also tested against KitKat. I'll look into it. My brother has a Jellybean phone.[/quote]

                  i've edited my post. please the app seems to be working on my phone but now the database connection is not being established :P

                  BTW i'm testing it on KitKat too

                  1 Reply Last reply
                  0
                  • A Offline
                    A Offline
                    akn10red
                    wrote on last edited by
                    #21

                    [quote author="antreimer" date="1424547268"]The first so file I uploaded was only tested against lollipop. The second one was also tested against KitKat. I'll look into it. My brother has a Jellybean phone.[/quote]

                    i've edited my post. please the app seems to be working on my phone but now the database connection is not being established :P

                    BTW i'm testing it on KitKat too

                    1 Reply Last reply
                    0
                    • A Offline
                      A Offline
                      antreimer
                      wrote on last edited by
                      #22

                      Could you add something like
                      @QMessageBox::information(this,"Connection", db.lastError().text() );@
                      I think that'll output the error in connection

                      1 Reply Last reply
                      0
                      • A Offline
                        A Offline
                        antreimer
                        wrote on last edited by
                        #23

                        Could you add something like
                        @QMessageBox::information(this,"Connection", db.lastError().text() );@
                        I think that'll output the error in connection

                        1 Reply Last reply
                        0
                        • A Offline
                          A Offline
                          akn10red
                          wrote on last edited by
                          #24

                          I already did that. it says driver not loaded. its is the same error i was getting without this library. I added this code to check whether the library was loaded or not. And it shows that it is loaded (message box is shown):

                          @ QLibrary library("libpq.so");

                          if (library.load())
                          QMessageBox::information(this,"Loaded","Lib loaded");@

                          1 Reply Last reply
                          0
                          • A Offline
                            A Offline
                            akn10red
                            wrote on last edited by
                            #25

                            I already did that. it says driver not loaded. its is the same error i was getting without this library. I added this code to check whether the library was loaded or not. And it shows that it is loaded (message box is shown):

                            @ QLibrary library("libpq.so");

                            if (library.load())
                            QMessageBox::information(this,"Loaded","Lib loaded");@

                            1 Reply Last reply
                            0
                            • A Offline
                              A Offline
                              antreimer
                              wrote on last edited by
                              #26

                              what about libqsqlpsql.so?

                              Edit:
                              OK, I hope now it'll work. Qt does some majik that I didn't know of to install drivers.
                              copy libqsqlpsql.so into /path/to/qt/android_armv7/plugins/sqldrivers/ and try again.

                              1 Reply Last reply
                              0
                              • A Offline
                                A Offline
                                antreimer
                                wrote on last edited by
                                #27

                                what about libqsqlpsql.so?

                                Edit:
                                OK, I hope now it'll work. Qt does some majik that I didn't know of to install drivers.
                                copy libqsqlpsql.so into /path/to/qt/android_armv7/plugins/sqldrivers/ and try again.

                                1 Reply Last reply
                                0
                                • A Offline
                                  A Offline
                                  akn10red
                                  wrote on last edited by
                                  #28

                                  [quote author="antreimer" date="1424550965"]what about libqsqlpsql.so?

                                  Edit:
                                  OK, I hope now it'll work. Qt does some majik that I didn't know of to install drivers.
                                  copy libqsqlpsql.so into /path/to/qt/android_armv7/plugins/sqldrivers/ and try again.[/quote]

                                  OK. I copied both libqsqlpsql.so and libpq.so to the specified destination but that didn't work either. same problem.
                                  libqsqlpsql.so lib is also loaded according to the method posted in my previous post

                                  1 Reply Last reply
                                  0
                                  • A Offline
                                    A Offline
                                    akn10red
                                    wrote on last edited by
                                    #29

                                    [quote author="antreimer" date="1424550965"]what about libqsqlpsql.so?

                                    Edit:
                                    OK, I hope now it'll work. Qt does some majik that I didn't know of to install drivers.
                                    copy libqsqlpsql.so into /path/to/qt/android_armv7/plugins/sqldrivers/ and try again.[/quote]

                                    OK. I copied both libqsqlpsql.so and libpq.so to the specified destination but that didn't work either. same problem.
                                    libqsqlpsql.so lib is also loaded according to the method posted in my previous post

                                    1 Reply Last reply
                                    0
                                    • A Offline
                                      A Offline
                                      antreimer
                                      wrote on last edited by
                                      #30

                                      ok. I'm fairly new to qt on android as well but my latest understanding now is that you don't need libqsqlpsql.so. It must somehow be copied by qt and it'll appear as libplugins_sqldrivers_libqsqlpsql.so in your apk

                                      1 Reply Last reply
                                      0
                                      • A Offline
                                        A Offline
                                        antreimer
                                        wrote on last edited by
                                        #31

                                        ok. I'm fairly new to qt on android as well but my latest understanding now is that you don't need libqsqlpsql.so. It must somehow be copied by qt and it'll appear as libplugins_sqldrivers_libqsqlpsql.so in your apk

                                        1 Reply Last reply
                                        0
                                        • A Offline
                                          A Offline
                                          antreimer
                                          wrote on last edited by
                                          #32

                                          I now statically linked the plugin so nothing should be needed to do other then to copy it into th sqldrivers plugin folder https://drive.google.com/open?id=0ByPpOAN5EsHKfmgwRTFvQUl5Z1NvUnlYMHptTEs0d2xEc24xZ19Jb0ZDMTBpb3JDQ014ZkU&authuser=0

                                          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