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. Undefined references for Sentry shared object?

Undefined references for Sentry shared object?

Scheduled Pinned Locked Moved Solved Mobile and Embedded
5 Posts 2 Posters 649 Views 2 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.
  • C Offline
    C Offline
    Colton
    wrote on last edited by
    #1

    My goal is to include Sentry-Native in an Android Quick project. However, when compiling, I keep getting undefined references for every Sentry function. Even with a minimal project, it produces this error.

    Am I doing something wrong here?

    I compiled Sentry-Native ahead of time as shared objects and included them in the app with this:

    android:!equals(QT_ARCH, armeabi-v7a) {
        ANDROID_EXTRA_LIBS += $$PWD/sentry-libs/$${QT_ARCH}/libsentry_$${QT_ARCH}.so
        DEPENDPATH += $$PWD/sentry-libs/$${QT_ARCH}
        INCLUDEPATH += $$PWD/sentry-libs/include
        DEFINES += USES_SENTRY
    }
    

    And at the beginning of the main function I am doing this:

    #ifdef USES_SENTRY
        sentry_options_t *options = sentry_options_new();
        sentry_options_set_dsn(options, "...");
        sentry_init(options);
    
        sentry_capture_event(sentry_value_new_message_event(
          /*   level */ SENTRY_LEVEL_INFO,
          /*  logger */ "custom",
          /* message */ "It works!"
        ));
    
        // Make sure everything flushes
        auto sentryClose = qScopeGuard([] { sentry_close(); });
    #endif
    

    And here are the errors:

    ..\SentryTest/main.cpp:15: error: undefined reference to 'sentry_options_new'
    ..\SentryTest/main.cpp:16: error: undefined reference to 'sentry_options_set_dsn'
    ..\SentryTest/main.cpp:17: error: undefined reference to 'sentry_init'
    ..\SentryTest/main.cpp:19: error: undefined reference to 'sentry_value_new_message_event'
    ..\SentryTest/main.cpp:19: error: undefined reference to 'sentry_capture_event'
    ..\SentryTest/main.cpp:26: error: undefined reference to 'sentry_close'
    clang++: error: linker command failed with exit code 1 (use -v to see invocation)
    
    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #4

      ANDROID_EXTRA_LIBS is for deploying additional libraries and LIBS for linking to them.

      Did you see the example in the documentation to include libraries for all ABIs ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      C 1 Reply Last reply
      0
      • SGaistS Offline
        SGaistS Offline
        SGaist
        Lifetime Qt Champion
        wrote on last edited by
        #2

        Hi,

        From the looks of it, you don't link to that library.

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        1 Reply Last reply
        0
        • C Offline
          C Offline
          Colton
          wrote on last edited by
          #3

          From what I read, sounded like ANDROID_EXTRA_LIBS would be enough, as it loads the library already. I thought I had tried LIBS in addition before, but trying it again, it compiles, but is now outputting the following:

          I zygote  : Late-enabling -Xcheck:jni
          W zygote  : Unexpected CPU variant for X86 using defaults: x86
          W System  : ClassLoader referenced unknown path:
          I QtCore  : Start
          I Qt      : qt started
          E AndroidRuntime: FATAL EXCEPTION: qtMainLoopThread
          E AndroidRuntime: Process: org.qtproject.example.SentryTest, PID: 6208
          E AndroidRuntime: java.lang.UnsatisfiedLinkError: dlopen failed: library "libsentry_x86.so" not found
          E AndroidRuntime: 	at java.lang.Runtime.load0(Runtime.java:928)
          E AndroidRuntime: 	at java.lang.System.load(System.java:1621)
          E AndroidRuntime: 	at org.qtproject.qt5.android.QtNative$4.run(QtNative.java:505)
          E AndroidRuntime: 	at org.qtproject.qt5.android.QtThread$2.run(QtThread.java:87)
          E AndroidRuntime: 	at org.qtproject.qt5.android.QtThread$1.run(QtThread.java:61)
          E AndroidRuntime: 	at java.lang.Thread.run(Thread.java:764)
          

          With this:

          LIBS += -L$$PWD/sentry-libs/$${QT_ARCH} -lsentry_$${QT_ARCH}
          

          And alternatively:

          LIBS += $$PWD/sentry-libs/$${QT_ARCH}/ibsentry_$${QT_ARCH}.so
          

          This is with an emulator instead of a physical device which may be changing the results (sadly can't be sure, the physical device is busy).

          1 Reply Last reply
          0
          • SGaistS Offline
            SGaistS Offline
            SGaist
            Lifetime Qt Champion
            wrote on last edited by
            #4

            ANDROID_EXTRA_LIBS is for deploying additional libraries and LIBS for linking to them.

            Did you see the example in the documentation to include libraries for all ABIs ?

            Interested in AI ? www.idiap.ch
            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

            C 1 Reply Last reply
            0
            • SGaistS SGaist

              ANDROID_EXTRA_LIBS is for deploying additional libraries and LIBS for linking to them.

              Did you see the example in the documentation to include libraries for all ABIs ?

              C Offline
              C Offline
              Colton
              wrote on last edited by
              #5

              @SGaist I did that originally and it didn't work. Tried again with the minimal project and it works, thank you!

              Guess that means the problem is my actual project.

              1 Reply Last reply
              1

              • Login

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