Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. Desktop Qt 5.8.0 MinGW 32bit Windows app using ImageMagick libs

Desktop Qt 5.8.0 MinGW 32bit Windows app using ImageMagick libs

Scheduled Pinned Locked Moved Solved Installation and Deployment
9 Posts 2 Posters 1.9k 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.
  • S Offline
    S Offline
    smoyertech
    wrote on last edited by
    #1

    I have a working Desktop Qt 5.8.0 MinGW 32bit Windows project app, and want to try using ImageMagick to read various image formats. I downloaded the pre-built "ImageMagick-i686-pc-mingw32.tar.gz" binary release, since I do not want to use the MSVC compiled binary release.

    I am getting undefined references when building my Qt project. We have had no problems building with ImageMagick and running on Linux, only with Windows.

    Has anyone had any success using ImageMagick libraries with QT/MinGW on Windows? If so can you share your success?

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

      Hi,

      What exact error are you getting ?

      How does your .pro file look like ?

      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
      • S Offline
        S Offline
        smoyertech
        wrote on last edited by smoyertech
        #3

        Here is the .pro file:

        QT += core

        TARGET = libcc_imagechunks
        TEMPLATE = lib

        DEFINES += LIBCC_IMAGECHUNKS_LIBRARY

        SOURCES += cc_imagechunks.cpp

        HEADERS += cc_imagechunks.hpp

        win32 {
        INCLUDEPATH += "C:/Workspace/Qt/ImgAnnotation/ImageMagic-i686-pc-mingw32-6.8.5/include/ImageMagick-6"
        LIBS += -L"C:/Workspace/Qt/ImgAnnotation/ImageMagic-i686-pc-mingw32-6.8.5/bin" \
        -lMagick++-6.Q16-1 \
        -lMagickCore-6.Q16-1 \
        -lMagickWand-6.Q16-1
        }

        It generates lots of undefined references:

        debug/cc_imagechunks.o: In function ZN14CC_ImageChunks21initializeImageMagickEv': C:\Workspace\Qt\ImgAnnotation\build-cc_imagechunks-Desktop_Qt_5_8_0_MinGW_32bit-Debug/../CC_ImageChunks/SAVE/cc_imagechunks.cpp:85: undefined reference to Magick::CoderInfo::nameabi:cxx11 const'
        debug/cc_imagechunks.o: In function ZN14CC_ImageChunks12setImageTypeEv': C:\Workspace\Qt\ImgAnnotation\build-cc_imagechunks-Desktop_Qt_5_8_0_MinGW_32bit-Debug/../CC_ImageChunks/SAVE/cc_imagechunks.cpp:114: undefined reference to Magick::Image::ping(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
        C:\Workspace\Qt\ImgAnnotation\build-cc_imagechunks-Desktop_Qt_5_8_0_MinGW_32bit-Debug/../CC_ImageChunks/SAVE/cc_imagechunks.cpp:130: undefined reference to Magick::Image::magick[abi:cxx11]() const' debug/cc_imagechunks.o: In function ZN14CC_ImageChunks14IMReadToOCVMatEv':
        C:\Workspace\Qt\ImgAnnotation\build-cc_imagechunks-Desktop_Qt_5_8_0_MinGW_32bit-Debug/../CC_ImageChunks/SAVE/cc_imagechunks.cpp:144: undefined reference to Magick::Image::read(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)' C:\Workspace\Qt\ImgAnnotation\build-cc_imagechunks-Desktop_Qt_5_8_0_MinGW_32bit-Debug/../CC_ImageChunks/SAVE/cc_imagechunks.cpp:160: undefined reference to Magick::Image::write(int, int, unsigned int, unsigned int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, MagickCore::StorageType, void*)'
        debug/cc_imagechunks.o: In function ZN6Magick13coderInfoListINSt7__cxx114listINS_9CoderInfoESaIS3_EEEEEvPT_NS3_9MatchTypeES8_S8_': C:\Workspace\Qt\ImgAnnotation\build-cc_imagechunks-Desktop_Qt_5_8_0_MinGW_32bit-Debug/../ImageMagic-i686-pc-mingw32-6.8.5/include/ImageMagick-6/Magick++/STL.h:2080: undefined reference to Magick::CoderInfo::CoderInfo(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
        collect2.exe: error: ld returned 1 exit status
        Makefile.Debug:63: recipe for target 'debug\libcc_imagechunks.dll' failed
        mingw32-make[1]: Leaving directory 'C:/Workspace/Qt/ImgAnnotation/build-cc_imagechunks-Desktop_Qt_5_8_0_MinGW_32bit-Debug'
        Makefile:34: recipe for target 'debug' failed
        mingw32-make[1]: *** [debug\libcc_imagechunks.dll] Error 1
        mingw32-make: *** [debug] Error 2
        07:16:33: The process "C:\Qt\Tools\mingw530_32\bin\mingw32-make.exe" exited with code 2.
        Error while building/deploying project cc_imagechunks (kit: Desktop Qt 5.8.0 MinGW 32bit)
        When executing step "Make"
        07:16:33: Elapsed time: 00:10.

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

          Are you sure you have an 32bit ImageMagick build ?

          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
          • S Offline
            S Offline
            smoyertech
            wrote on last edited by
            #5

            Yes, the download we are using is ImageMagick-i686-pc-mingw32.tar.gz, so we are presuming 32-bit. I do not know how to confirm it is a 32-bit build.

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

              You can use Dependency Walker for that.

              Did you modify the C++11 related flags in your .pro file ?

              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
              • S Offline
                S Offline
                smoyertech
                wrote on last edited by smoyertech
                #7

                Thanks, I confirmed the ImageMagick dlls are 32 bit.

                I added "DEFINES += __MINGW32__" in the .pro file but that did not remove the undefined reference errors. Do you know if there are other defines I need to add?

                1 Reply Last reply
                0
                • S Offline
                  S Offline
                  smoyertech
                  wrote on last edited by smoyertech
                  #8

                  I found the root cause of the issue.

                  The following link explains about how changes were made to the C++ compiler necessary to conform to the 2011 C++ standard. The ImageMagick binary release built using the MinGW compiler was built prior to the the compiler changes and the Qt 5.8 MinGW compiler was built more recently.

                  https://gcc.gnu.org/onlinedocs/libstdc++/manual/using_dual_abi.html

                  The following simple change to the .pro file fixed the problem:

                  # Force pre C++11 style name mangling in order to be compatible with pre-built MinGW ImageMagick DLLs
                  DEFINES += "_GLIBCXX_USE_CXX11_ABI=0"

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

                    That's a sneaky one !

                    Glad you found out and thanks for sharing !

                    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

                    • Login

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