Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Trying to implement QChart, get error undefined reference to 'qt_version_tag@Qt_5.9'
QtWS25 Last Chance

Trying to implement QChart, get error undefined reference to 'qt_version_tag@Qt_5.9'

Scheduled Pinned Locked Moved Unsolved General and Desktop
qchartqtversiontag
11 Posts 4 Posters 2.0k 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.
  • M Offline
    M Offline
    markd
    wrote on 12 Nov 2019, 16:58 last edited by markd 11 Dec 2019, 19:55
    #1

    I am running Qt 5.9.1 on Ubuntu 16.04. I have successfully built and run the linechart example.

    When I start trying to migrate code from linechart to my application, I get the following link error:
    undefined reference to 'qt_version_tag@Qt_5.9', associated with libQt5Charts.so

    I understand that this is usually due to issues with linking to the wrong version of a library but I am at a loss to see what I'm doing wrong.

    I've checked which libraries the linechart example is using:
    $ ldd linechart | grep -i libQt5
    libQt5Charts.so.5 => /opt/Qt5.9.1/5.9.1/gcc_64/lib/libQt5Charts.so.5 (0x00007fd9d140b000)

    I've checked which libraries my app is using (apart from libQt5Charts.so.5):
    $ ldd LTSD | grep -i libQt5
    libQt5Widgets.so.5 => /opt/Qt5.9.1/5.9.1/gcc_64/lib/libQt5Widgets.so.5 (0x00007f2451f3d000)
    libQt5Gui.so.5 => /opt/Qt5.9.1/5.9.1/gcc_64/lib/libQt5Gui.so.5 (0x00007f245178f000)
    libQt5Core.so.5 => /opt/Qt5.9.1/5.9.1/gcc_64/lib/libQt5Core.so.5 (0x00007f2451055000)

    As soon as I add the line " QChart *slagchart = new QChart();" to my code, I get the error. The linker doesn't build an executable so I can't check ldd to see where it is trying to get the library.

    I've tried adding "DEFINES += QT_NO_VERSION_TAGGING" to the .pro file and it seems to make no difference.

    1 Reply Last reply
    0
    • C Offline
      C Offline
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on 12 Nov 2019, 18:40 last edited by
      #2

      Build your app without QtCharts and take a look which Qt libraries are used with the help of ldd

      Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
      Visit the Qt Academy at https://academy.qt.io/catalog

      1 Reply Last reply
      0
      • M Offline
        M Offline
        markd
        wrote on 12 Nov 2019, 18:45 last edited by
        #3

        @markd said in Trying to implement QChart, get error undefined reference to 'qt_version_tag@Qt_5.9':

        As noted above, if I comment out the 'new QChart(); line I get the following:

        $ ldd LTSD | grep -i libQt5
        libQt5Widgets.so.5 => /opt/Qt5.9.1/5.9.1/gcc_64/lib/libQt5Widgets.so.5 (0x00007f2451f3d000)
        libQt5Gui.so.5 => /opt/Qt5.9.1/5.9.1/gcc_64/lib/libQt5Gui.so.5 (0x00007f245178f000)
        libQt5Core.so.5 => /opt/Qt5.9.1/5.9.1/gcc_64/lib/libQt5Core.so.5 (0x00007f2451055000

        As soon as I add the line " QChart *slagchart = new QChart();" to my code, I get the error. The linker doesn't build an executable so I can't check ldd to see where it is trying to get the library.

        J 1 Reply Last reply 13 Nov 2019, 05:47
        0
        • M markd
          12 Nov 2019, 18:45

          @markd said in Trying to implement QChart, get error undefined reference to 'qt_version_tag@Qt_5.9':

          As noted above, if I comment out the 'new QChart(); line I get the following:

          $ ldd LTSD | grep -i libQt5
          libQt5Widgets.so.5 => /opt/Qt5.9.1/5.9.1/gcc_64/lib/libQt5Widgets.so.5 (0x00007f2451f3d000)
          libQt5Gui.so.5 => /opt/Qt5.9.1/5.9.1/gcc_64/lib/libQt5Gui.so.5 (0x00007f245178f000)
          libQt5Core.so.5 => /opt/Qt5.9.1/5.9.1/gcc_64/lib/libQt5Core.so.5 (0x00007f2451055000

          As soon as I add the line " QChart *slagchart = new QChart();" to my code, I get the error. The linker doesn't build an executable so I can't check ldd to see where it is trying to get the library.

          J Offline
          J Offline
          jsulm
          Lifetime Qt Champion
          wrote on 13 Nov 2019, 05:47 last edited by
          #4

          @markd Do you have another Qt version installed on your system (in /usr for example)?
          Check the linker call when building your app with QChart to see what it links.

          https://forum.qt.io/topic/113070/qt-code-of-conduct

          M 1 Reply Last reply 13 Nov 2019, 21:20
          0
          • J jsulm
            13 Nov 2019, 05:47

            @markd Do you have another Qt version installed on your system (in /usr for example)?
            Check the linker call when building your app with QChart to see what it links.

            M Offline
            M Offline
            markd
            wrote on 13 Nov 2019, 21:20 last edited by
            #5

            @jsulm below is the link output from Qt Creator. You can see "-L/opt/Qt5.9.1/5.9.1/gcc_64/lib -lQt5Charts -lQt5Widgets -lQt5Gui -lQt5Core" down near the bottom.

            g++ -Wl,-rpath,/opt/Qt5.9.1/5.9.1/gcc_64/lib -o LTSD LTSDView.o LTVrecord.o LTSlagDetect.o main.o keylok.o GUI_Indicators.o SpinCamera.o imageviewer.o logikaImaging.o qrc_resources.o moc_LTSDView.o moc_LTVrecord.o moc_LTSlagDetect.o moc_GUI_Indicators.o moc_SpinCamera.o moc_imageviewer.o moc_logikaImaging.o   -L/usr/local/cuda-8.0/lib64/ -L/usr/lib -lSpinnaker ../LogikaLibrary/libkfunc64.a -Wl,-rpath,/usr/lib/x86_64-linux-gnu /lib/x86_64-linux-gnu/libudev.so.1 -L/usr/local/lib -lopencv_cudabgsegm -lopencv_shape -lopencv_stitching -lopencv_cudastereo -lopencv_videostab -lopencv_superres -lopencv_cudafeatures2d -lopencv_dnn -lopencv_cudacodec -lopencv_ml -lopencv_cudaoptflow -lopencv_cudaobjdetect -lopencv_cudalegacy -lopencv_cudawarping -lopencv_video -lopencv_objdetect -lopencv_photo -lopencv_cudaimgproc -lopencv_cudafilters -lopencv_cudaarithm -lopencv_calib3d -lopencv_features2d -lopencv_highgui -lopencv_videoio -lopencv_imgcodecs -lopencv_imgproc -lopencv_flann -lopencv_core -lopencv_cudev -L/usr/local/cuda-8.0/lib64 -lcuda -lcudart -L/opt/Qt5.9.1/5.9.1/gcc_64/lib -lQt5Charts -lQt5Widgets -lQt5Gui -lQt5Core -lGL -lpthread 
            /opt/Qt5.9.1/5.9.1/gcc_64/lib/libQt5Charts.so: undefined reference to `qt_version_tag@Qt_5.9'
            /opt/Qt5.9.1/5.9.1/gcc_64/lib/libQt5Charts.so: undefined reference to `operator delete(void*, unsigned long)@Qt_5'
            Makefile:288: recipe for target 'LTSD' failed
            collect2: error: ld returned 1 exit status
            make: *** [LTSD] Error 1
            16:07:11: The process "/usr/bin/make" exited with code 2.
            Error while building/deploying project LTSD (kit: Desktop Qt 5.9.1 GCC 64bit)
            When executing step "Make"
            
            

            As far as I can see, everything is pointing to opt/Qt5.9.1/...

            I've added "DEFINES += QT_NO_VERSION_TAGGING" to the .pro file, which as I understand it, is supposed to suppress the version tagging test at link time but I still get the same error.

            1 Reply Last reply
            0
            • C Offline
              C Offline
              Christian Ehrlicher
              Lifetime Qt Champion
              wrote on 14 Nov 2019, 06:06 last edited by
              #6

              This is really strange. Can you check if the libraries have the same qt_version_tags with 'nm' ?

              nm /opt/Qt5.9.1/5.9.1/gcc_64/lib/libQt5Charts.so.5 | grep qt_version_tag
              nm /opt/Qt5.9.1/5.9.1/gcc_64/lib/libQt5Widgets.so.5 | grep qt_version_tag

              Did you build Qt 5.9.1 by your own?

              Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
              Visit the Qt Academy at https://academy.qt.io/catalog

              M 2 Replies Last reply 14 Nov 2019, 13:53
              0
              • C Christian Ehrlicher
                14 Nov 2019, 06:06

                This is really strange. Can you check if the libraries have the same qt_version_tags with 'nm' ?

                nm /opt/Qt5.9.1/5.9.1/gcc_64/lib/libQt5Charts.so.5 | grep qt_version_tag
                nm /opt/Qt5.9.1/5.9.1/gcc_64/lib/libQt5Widgets.so.5 | grep qt_version_tag

                Did you build Qt 5.9.1 by your own?

                M Offline
                M Offline
                markd
                wrote on 14 Nov 2019, 13:53 last edited by
                #7

                @Christian-Ehrlicher I used the pre-built distribution

                qt-opensource-linux-x64-5.9.1.run
                

                output from the nm command is as follows:

                mark@mark:/opt/Qt5.9.1/5.9.1/gcc_64/lib$ nm libQt5Charts.so.5
                nm: libQt5Charts.so.5: no symbols
                mark@mark:/opt/Qt5.9.1/5.9.1/gcc_64/lib$ nm libQt5Widgets.so.5
                nm: libQt5Widgets.so.5: no symbols
                

                I'm guessing that isn't what you expected to see but I don't know enough about linux or Qt to know what it means.

                J 1 Reply Last reply 14 Nov 2019, 14:47
                0
                • M markd
                  14 Nov 2019, 13:53

                  @Christian-Ehrlicher I used the pre-built distribution

                  qt-opensource-linux-x64-5.9.1.run
                  

                  output from the nm command is as follows:

                  mark@mark:/opt/Qt5.9.1/5.9.1/gcc_64/lib$ nm libQt5Charts.so.5
                  nm: libQt5Charts.so.5: no symbols
                  mark@mark:/opt/Qt5.9.1/5.9.1/gcc_64/lib$ nm libQt5Widgets.so.5
                  nm: libQt5Widgets.so.5: no symbols
                  

                  I'm guessing that isn't what you expected to see but I don't know enough about linux or Qt to know what it means.

                  J Offline
                  J Offline
                  JonB
                  wrote on 14 Nov 2019, 14:47 last edited by
                  #8

                  @markd , @Christian-Ehrlicher
                  I needed to do this the other day, but didn't know how to discover embedded Qt version, as recommended by Christian.

                  So that he knows, like you I find nm reports "no symbols", since file libQt5Widgets.so.5 tells you it's "stripped".

                  On a whim, I just tried

                  objdump -T -t /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5.12.2 | grep -i qt_version_tag
                  

                  and I do get:

                  0000000000000000      DO *UND*	0000000000000000  Qt_5.12     qt_version_tag
                  

                  @Christian-Ehrlicher
                  Is that 5.12 all you expected from nm, or should it be more specific like 5.12.2?

                  1 Reply Last reply
                  0
                  • C Christian Ehrlicher
                    14 Nov 2019, 06:06

                    This is really strange. Can you check if the libraries have the same qt_version_tags with 'nm' ?

                    nm /opt/Qt5.9.1/5.9.1/gcc_64/lib/libQt5Charts.so.5 | grep qt_version_tag
                    nm /opt/Qt5.9.1/5.9.1/gcc_64/lib/libQt5Widgets.so.5 | grep qt_version_tag

                    Did you build Qt 5.9.1 by your own?

                    M Offline
                    M Offline
                    markd
                    wrote on 14 Nov 2019, 15:03 last edited by
                    #9

                    @Christian-Ehrlicher
                    I tried objdump and got the following:

                    mark@mark:/opt/Qt5.9.1/5.9.1/gcc_64/lib$ objdump -T -t libQt5Charts.so.5 | grep -i qt_version_tag
                    0000000000000000      DO *UND*	0000000000000000  Qt_5.9      qt_version_tag
                    
                    1 Reply Last reply
                    0
                    • C Offline
                      C Offline
                      Christian Ehrlicher
                      Lifetime Qt Champion
                      wrote on 14 Nov 2019, 17:46 last edited by
                      #10

                      And what's the output for the other libs in there like e.g. QtCore?

                      Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
                      Visit the Qt Academy at https://academy.qt.io/catalog

                      M 1 Reply Last reply 15 Nov 2019, 12:54
                      0
                      • C Christian Ehrlicher
                        14 Nov 2019, 17:46

                        And what's the output for the other libs in there like e.g. QtCore?

                        M Offline
                        M Offline
                        markd
                        wrote on 15 Nov 2019, 12:54 last edited by
                        #11

                        @Christian-Ehrlicher

                        mark@mark:/opt/Qt5.9.1/5.9.1/gcc_64/lib$ objdump -T -t libQt5Core.so.5 | grep -i qt_version_tag
                        000000000035aa9d g    DO .rodata	0000000000000001  Qt_5        qt_version_tag_5_0
                        000000000035aa9c g    DO .rodata	0000000000000001  Qt_5        qt_version_tag_5_1
                        000000000035aa9b g    DO .rodata	0000000000000001  Qt_5        qt_version_tag_5_2
                        000000000035aa9a g    DO .rodata	0000000000000001  Qt_5        qt_version_tag_5_3
                        000000000035aa99 g    DO .rodata	0000000000000001  Qt_5        qt_version_tag_5_4
                        000000000035aa98 g    DO .rodata	0000000000000001  Qt_5        qt_version_tag_5_5
                        000000000035aa97 g    DO .rodata	0000000000000001  Qt_5        qt_version_tag_5_6
                        000000000035aa96 g    DO .rodata	0000000000000001  Qt_5        qt_version_tag_5_7
                        000000000035aa95 g    DO .rodata	0000000000000001  Qt_5        qt_version_tag_5_8
                        000000000035aa94 g    DO .rodata	0000000000000001  Qt_5        qt_version_tag_5_9
                        000000000035aa97 g    DO .rodata	0000000000000001 (Qt_5.6)     qt_version_tag
                        000000000035aa94 g    DO .rodata	0000000000000001  Qt_5.9      qt_version_tag
                        000000000035aa9c g    DO .rodata	0000000000000001 (Qt_5.1)     qt_version_tag
                        000000000035aa95 g    DO .rodata	0000000000000001 (Qt_5.8)     qt_version_tag
                        000000000035aa9d g    DO .rodata	0000000000000001 (Qt_5.0)     qt_version_tag
                        000000000035aa9a g    DO .rodata	0000000000000001 (Qt_5.3)     qt_version_tag
                        000000000035aa9b g    DO .rodata	0000000000000001 (Qt_5.2)     qt_version_tag
                        000000000035aa98 g    DO .rodata	0000000000000001 (Qt_5.5)     qt_version_tag
                        000000000035aa99 g    DO .rodata	0000000000000001 (Qt_5.4)     qt_version_tag
                        000000000035aa96 g    DO .rodata	0000000000000001 (Qt_5.7)     qt_version_tag
                        mark@mark:/opt/Qt5.9.1/5.9.1/gcc_64/lib$ objdump -T -t libQt5Widgets.so.5 | grep -i qt_version_tag
                        0000000000000000      DO *UND*	0000000000000000  Qt_5.9      qt_version_tag
                        mark@mark:/opt/Qt5.9.1/5.9.1/gcc_64/lib$ objdump -T -t libQt5Gui.so.5 | grep -i qt_version_tag
                        0000000000000000      DO *UND*	0000000000000000  Qt_5.9      qt_version_tag
                        mark@mark:/opt/Qt5.9.1/5.9.1/gcc_64/lib$ objdump -T -t libQt5Charts.so.5 | grep -i qt_version_tag
                        0000000000000000      DO *UND*	0000000000000000  Qt_5.9      qt_version_tag
                        mark@mark:/opt/Qt5.9.1/5.9.1/gcc_64/lib$ 
                        
                        1 Reply Last reply
                        0

                        4/11

                        13 Nov 2019, 05:47

                        topic:navigator.unread, 7
                        • Login

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