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. TIFF support with Static Qt (5.4.2) on Linux

TIFF support with Static Qt (5.4.2) on Linux

Scheduled Pinned Locked Moved General and Desktop
11 Posts 3 Posters 4.1k 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.
  • SGaistS Offline
    SGaistS Offline
    SGaist
    Lifetime Qt Champion
    wrote on last edited by
    #2

    Hi and welcome to devnet,

    What does qDebug() << QImageWriter::supportedImageFormats() return ?

    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
      cgarry
      wrote on last edited by
      #3

      Thanks for the welcome.
      qDebug() << QImageWriter::supportedImageFormats() returns:
      ("bmp", "cur", "ico", "jpeg", "jpg", "pbm", "pgm", "png", "ppm", "xbm", "xpm")

      1 Reply Last reply
      0
      • A Offline
        A Offline
        alex_malyu
        wrote on last edited by
        #4

        "When built, the Qt Image Formats plugins are located as dynamic libraries in the runtime plugin directory (typically plugins/imageformats), together with the default image format plugins."

        Tiff support provided in plugin.
        Since you build qt statically you can't have dynamically loaded plugins.
        You may try to link it statically to your application.
        Check http://doc.qt.io/qt-5/plugins-howto.html

        But I am not sure if there is no legal issues with such approach.

        1 Reply Last reply
        0
        • C Offline
          C Offline
          cgarry
          wrote on last edited by
          #5

          Thanks for your help Alex. I understand that Tiff support is supplied in a plugin and this works well when dynamically linked.

          From the documentation (which I have read and re-read many times!), I would expect to statically link with the TIFF plugin by adding this to my application's .pro file:
          QTPLUGIN += qtiff

          However, this results in this warning when calling qmake:
          Project WARNING: Plugin class name could not be determined for qtiff plugin.

          And this error when calling make:
          /usr/bin/ld: cannot find -lqtiff
          collect2: error: ld returned 1 exit status

          This seems to occur because the statically built Qt has not built the image plugins for static linking:
          ls -l Qt/5.4/Src/qtbase/plugins/imageformats/
          -rw-rw-r-- 1 u64 u64 40456 Jun 10 09:01 libqico.a
          -rw-rw-r-- 1 u64 u64 882 Jun 10 09:01 libqico.prl

          As for the legal issues, my application is open source (GPL v3) so I do not believe that there is a licensing issue with linking statically. As an aside the only reason I am statically linking is to reduce the number of dependencies when deploying a binary image on Linux machines.

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

            Did you call configure in qtbase ?

            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
              cgarry
              wrote on last edited by cgarry
              #7

              No, I just called configure in the directory above qtbase and all the other qt* directories.

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

                Then check that the qtimageformats module has been built. tiff support comes from that one

                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
                  cgarry
                  wrote on last edited by
                  #9

                  Looking through the Qt directories I find this:

                  $ ls -l ~/Qt/5.4/qt-static/qtimageformats/plugins/imageformats
                  total 2996
                  -rw-rw-r-- 1 cgarry cgarry 66090 Jun 14 08:45 libqdds.a
                  -rw-rw-r-- 1 cgarry cgarry 931 Jun 14 08:44 libqdds.prl
                  -rw-rw-r-- 1 cgarry cgarry 54110 Jun 14 08:45 libqicns.a
                  -rw-rw-r-- 1 cgarry cgarry 934 Jun 14 08:45 libqicns.prl
                  -rw-rw-r-- 1 cgarry cgarry 925268 Jun 14 08:45 libqjp2.a
                  -rw-rw-r-- 1 cgarry cgarry 931 Jun 14 08:45 libqjp2.prl
                  -rw-rw-r-- 1 cgarry cgarry 597366 Jun 14 08:45 libqmng.a
                  -rw-rw-r-- 1 cgarry cgarry 934 Jun 14 08:45 libqmng.prl
                  -rw-rw-r-- 1 cgarry cgarry 40144 Jun 14 08:45 libqtga.a
                  -rw-rw-r-- 1 cgarry cgarry 931 Jun 14 08:45 libqtga.prl
                  -rw-rw-r-- 1 cgarry cgarry 684732 Jun 14 08:45 libqtiff.a
                  -rw-rw-r-- 1 cgarry cgarry 937 Jun 14 08:45 libqtiff.prl
                  -rw-rw-r-- 1 cgarry cgarry 27210 Jun 14 08:45 libqwbmp.a
                  -rw-rw-r-- 1 cgarry cgarry 934 Jun 14 08:45 libqwbmp.prl
                  -rw-rw-r-- 1 cgarry cgarry 622940 Jun 14 08:45 libqwebp.a
                  -rw-rw-r-- 1 cgarry cgarry 969 Jun 14 08:45 libqwebp.prl

                  So 'libqtiff.a' has at least been built. I shall try and dig into this further, but any tips on where to look next would be much appreciated.

                  Thanks,
                  Chris

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

                    You probably already did Q_IMPORT_PLUGIN(qtiff) in your code ?

                    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
                      cgarry
                      wrote on last edited by
                      #11

                      If I add this to my main.ccp:

                      #include <QtPlugin>
                      Q_IMPORT_PLUGIN(qtiff)

                      Then the build fails with:
                      ../main.o: In function _GLOBAL__sub_I_main.cpp': main.cpp:(.text.startup+0x55): undefined reference to qt_static_plugin_qtiff()'
                      collect2: ld returned 1 exit status

                      However, I have come to the conclusion that I am fighting the system here for no real good reason. Therefore, I have changed my approach to use dynamic linking instead of static linking (which I thought would be easier in the short term).

                      Using dynamic linking, my application now working without any problems and I do think this is the best way forward as I would like to produce source packages instead of binary packages.

                      Thanks,
                      Chris

                      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