Results 1 to 16 of 16

Thread: Qwt with CMake

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2020
    Posts
    53
    Qt products
    Qt5
    Platforms
    Unix/X11

    Default Re: Qwt with CMake

    That got me a bit further, as the libries are now found. However, I get a page full of linking errors, that I cannot make sense of. The order I list the libraries in target_link_libraries doen't seem to make a difference, and the errors are the same whether I compile for Release or Debug:
    Qt Code:
    1. [100%] Linking CXX executable plottapp
    2. /usr/bin/ld: /usr/local/qwt-6.2.0/lib/libqwt.so: undefined reference to `QtPrivate::QMetaTypeInterfaceWrapper<QVariant>::metaType@Qt_6'
    3. /usr/bin/ld: /usr/local/qwt-6.2.0/lib/libqwt.so: undefined reference to `QtPrivate::QMetaTypeInterfaceWrapper<bool>::metaType@Qt_6'
    4. /usr/bin/ld: /usr/local/qwt-6.2.0/lib/libqwt.so: undefined reference to `QtPrivate::QMetaTypeInterfaceWrapper<QSize>::metaType@Qt_6'
    5. .
    6. .
    7. .
    8. /usr/bin/ld: /usr/local/qwt-6.2.0/lib/libqwt.so: undefined reference to `QtPrivate::QMetaTypeInterfaceWrapper<QTime>::metaType@Qt_6'
    9. collect2: error: ld returned 1 exit status
    10. make[2]: *** [CMakeFiles/plottapp.dir/build.make:591: plottapp] Error 1
    11. make[1]: *** [CMakeFiles/Makefile2:84: CMakeFiles/plottapp.dir/all] Error 2
    12. make: *** [Makefile:136: all] Error 2
    13. *** Failure: Exit code 2 ***
    To copy to clipboard, switch view to plain text mode 

  2. #2
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,230
    Thanks
    302
    Thanked 864 Times in 851 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Qwt with CMake

    Finding Qt6Widgets is supposed to also bring in the dependencies (Qt6Gui and Qt6Core) but maybe you need to add those. Those errors look like there is a low level Qt library that is not being linked in. Maybe try putting ${QWT} at the beginning of the link libraries list, followed by Charts, Widgets, Gui, and Core. I think that is the correct dependency order.
    <=== The Great Pumpkin says ===>
    Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.

  3. #3
    Join Date
    Jan 2020
    Posts
    53
    Qt products
    Qt5
    Platforms
    Unix/X11

    Default Re: Qwt with CMake

    I tried adding Qt6Gui and Qt6Core, and all kinds of reordering, but to no avail. I have no problem using Qt Charts, so the issue must be related to Qwt.

  4. #4
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,230
    Thanks
    302
    Thanked 864 Times in 851 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Qwt with CMake

    Are you sure you are building qwt against your Qt6 installation? Can you successfully use qwt in a project built with QtCreator? (I know these are "Have you checked to see if it is plugged in?" questions, but I've done things like this in the past, where I have had mismatched builds and nothing seems to work).

    It is MOC that results in all of the QMetaType references so something could be wrong with your qwt build.
    <=== The Great Pumpkin says ===>
    Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.

  5. #5
    Join Date
    Jan 2020
    Posts
    53
    Qt products
    Qt5
    Platforms
    Unix/X11

    Default Re: Qwt with CMake

    I am not absolutely sure I am building Qwt corectly. I built Qwt thus:
    /usr/bin/qmake qwt.pro
    make
    sudo make install

    The strange thing is that all the examples supplied with Qwt works perfectly when build by QtCreator.

    The file qwtconfig.pri starts of with:
    QWT_VER_MAJ = 6
    QWT_VER_MIN = 2
    QWT_VER_PAT = 0
    QWT_VERSION = $${QWT_VER_MAJ}.$${QWT_VER_MIN}.$${QWT_VER_PAT}
    which looks correct to me.

    I do not know if it is relevant, but qwt.pro has this information at the start:
    lessThan(QT_MAJOR_VERSION, 5) {

    lessThan(QT_MINOR_VERSION, 8) {
    error(Qt >= 4.8 required.)
    }
    }

    include( qwtconfig.pri )

    The version 5 here probably refers to Qt 5.15.3 used by Kubuntu 22.04?
    qmake --version
    returns
    QMake version 3.1
    Using Qt version 5.15.3 in /usr/lib/x86_64-linux-gnu

    I noticed that there is also qmake6, which returns:
    qmake6 --version
    QMake version 3.1
    Using Qt version 6.2.4 in /usr/lib/x86_64-linux-gnu

    So I tried:
    make clean
    /usr/bin/qmake6 qwt.pro
    make
    sudo make install
    but the problem persists.

  6. #6
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,230
    Thanks
    302
    Thanked 864 Times in 851 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Qwt with CMake

    What do you see when you run this?
    Qt Code:
    1. ldd -d -r libqwt.so
    To copy to clipboard, switch view to plain text mode 
    Does it show dependencies on any of the Qt6 libraries?

    How about opening the qwt.pro file in QtCreator and ensuring that you are building using a Qt6 kit?

    I am afraid I am not really a linux developer, so this is getting to the limits of my knowledge and experience.
    <=== The Great Pumpkin says ===>
    Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.

  7. #7
    Join Date
    Jan 2020
    Posts
    53
    Qt products
    Qt5
    Platforms
    Unix/X11

    Default Re: Qwt with CMake

    I see:
    Qt Code:
    1. ldd: ./libqwt.so: No such file or directory
    To copy to clipboard, switch view to plain text mode 
    Q
    I then created a link:
    Qt Code:
    1. ln -s /usr/local/qwt-6.2.0/lib/libqwt.so.6.2.0 libqwt.so
    To copy to clipboard, switch view to plain text mode 
    but it made no difference. But output like
    Qt Code:
    1. /usr/bin/ld: /usr/local/qwt-6.2.0/lib/libqwt.so: undefined reference to `QtPrivate::QMetaTypeInterfaceWrapper<QVariant>::metaType@Qt_6'
    To copy to clipboard, switch view to plain text mode 
    indicated that the lib is found. It also indicates that qwt v. 6.2.0 is used, as well as Qt6, so it appears that there isn't a version mismatch. Also, I can build the qwt examples with Qt Creator, so libqwt.so seems to be OK.

  8. #8
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,230
    Thanks
    302
    Thanked 864 Times in 851 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Qwt with CMake

    Well. sorry, but I am at the end of my ideas. I think qmake creates a Makefile, right? (I use Visual Studio on Windows for all my development, which does not use Makefiles). Maybe take a look at one of those for your qwt examples and see if there is something in the linking that is missing from your CMakelists file. Otherwise, I don't know what else to suggest.
    <=== The Great Pumpkin says ===>
    Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.

  9. #9
    Join Date
    Jan 2020
    Posts
    53
    Qt products
    Qt5
    Platforms
    Unix/X11

    Default Re: Qwt with CMake

    Yes, cmake creates a makefile, but I don't find any clues there. There is a file called CMakeCache.txt, which includes:
    Qt Code:
    1. Name Value
    2. QWT /usr/local/qwt-6.2.0/lib/libqwt.so
    To copy to clipboard, switch view to plain text mode 
    which is the correct path. Anyway, don't spend more time on this problem. I will keep scratching my head though. One thing I haven't thought about before: does qmake use hard-coded paths?

  10. #10
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,230
    Thanks
    302
    Thanked 864 Times in 851 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Qwt with CMake

    cmake creates a makefile
    No, I meant qmake. Check the Makefile from that to see if there are any ideas about what could be wrong with the cmake configuration.
    <=== The Great Pumpkin says ===>
    Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.

Similar Threads

  1. Qt Creator Qt SDK 1.1.3 and CMake on Mac OS X 10.7.1 / Lion
    By agarny in forum Qt Tools
    Replies: 2
    Last Post: 3rd August 2012, 08:56
  2. Cmake
    By R.CH in forum Qt Programming
    Replies: 1
    Last Post: 7th October 2010, 17:06
  3. QT linguist Cmake
    By _Jack_ in forum Qt Programming
    Replies: 1
    Last Post: 18th September 2010, 11:29
  4. using moc with cmake
    By Isaac in forum Newbie
    Replies: 2
    Last Post: 29th May 2008, 03:10
  5. CMake and pthreads
    By Matt Smith in forum General Discussion
    Replies: 5
    Last Post: 3rd September 2006, 20:42

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.