Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. 3rd Party Software
  4. Compile libraw on windows 7
Forum Updated to NodeBB v4.3 + New Features

Compile libraw on windows 7

Scheduled Pinned Locked Moved Unsolved 3rd Party Software
14 Posts 2 Posters 5.8k Views 1 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.
  • S Offline
    S Offline
    samdol
    wrote on last edited by
    #1

    Hi,

    Since Qt does not support raw image file, I downloaded LibRaw-0.17.2.zip and
    tried to compile on Windows 7. I installed mingw32 which comes with Qt5.6.2
    and installed MSYS.
    As instruction said, I did
    sh ./configure
    make
    when I compile by 'make', I got the following error message.

    src/libraw_c_api.cpp: In function 'int libraw_get_color_maximum(libraw_data_t*)':
    src/libraw_c_api.cpp:333:12: warning: 'int libraw_get_color_maximum(libraw_data_t*)' redeclared without dllimport attribute: previous dllimport ignored [-Wattributes]
    make: *** [src/libraw_c_api.lo] Error 1

    I just see warnings, but it spew error at the end.
    Does anyone who compiled libraw on Windows encountered the similar problem?

    S 1 Reply Last reply
    0
    • S samdol

      Hi,

      Since Qt does not support raw image file, I downloaded LibRaw-0.17.2.zip and
      tried to compile on Windows 7. I installed mingw32 which comes with Qt5.6.2
      and installed MSYS.
      As instruction said, I did
      sh ./configure
      make
      when I compile by 'make', I got the following error message.

      src/libraw_c_api.cpp: In function 'int libraw_get_color_maximum(libraw_data_t*)':
      src/libraw_c_api.cpp:333:12: warning: 'int libraw_get_color_maximum(libraw_data_t*)' redeclared without dllimport attribute: previous dllimport ignored [-Wattributes]
      make: *** [src/libraw_c_api.lo] Error 1

      I just see warnings, but it spew error at the end.
      Does anyone who compiled libraw on Windows encountered the similar problem?

      S Offline
      S Offline
      samdol
      wrote on last edited by samdol
      #2

      @samdol

      Inside LibRaw-0.17.2 directory, I found a script called "Makefile.mingw" Using
      this file I excuted
      mingw32-make -f makefile.mingw
      And I could got libraw.a under lib directory.
      Now I intend to use libraw.a to make qtraw plugin.
      I downloaded qtraw-master.zip from github
      https://github.com/mardy/qtraw
      and extract it and move to the
      directory. I created "libraw" directory inside and put header files(libraw.h,
      libraw_const.h...) and put libraw.a to "libraw/win32" directory.

      But when I try to build the libraw plugin, I got the message
      Project ERROR: libraw development package not found
      It seems
      PKGCONFIG += libraw
      in .pro file cause this problem.
      So if I remove that line and build again, I got another error message
      undefined reference to '_imp__ZTV26LibRaw_abstract_datastream'
      I have no idea what to do next.
      The following is my .pro file
      include(../common-config.pri)

      TARGET = qtraw
      TEMPLATE = lib
      CONFIG +=
      link_pkgconfig
      plugin
      DESTDIR = imageformats

      PKGCONFIG +=
      libraw

      HEADERS +=
      datastream.h
      raw-io-handler.h
      SOURCES +=
      datastream.cpp
      main.cpp
      raw-io-handler.cpp
      OTHER_FILES +=
      raw.json

      target.path += $$[QT_INSTALL_PLUGINS]/imageformats
      INSTALLS += target

      kde_desktop.files = raw.desktop
      kde_desktop.path = $${INSTALL_KDEDIR}/share/kde4/services/qimageioplugins/
      INSTALLS += kde_desktop

      unix:!macx:!symbian: LIBS += $$PWD/libraw/linux/libraw.a
      else:macx: LIBS += $$PWD/libraw/macx/libraw.a
      else:win32: LIBS += $$PWD/libraw/win32/libraw.a
      QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.6

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

        Hi,

        You need to pass the include dir as well as library dir when you are compiling the plugin inside the sources.

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

        S 1 Reply Last reply
        0
        • SGaistS SGaist

          Hi,

          You need to pass the include dir as well as library dir when you are compiling the plugin inside the sources.

          S Offline
          S Offline
          samdol
          wrote on last edited by
          #4

          @SGaist
          It seems the line
          PKGCONFIG +=
          libraw
          in src.pro causes the problem. I don't know exactly what PKGCONFIG means but
          after googling it seems setting system library. So I commented out those two lines and compiled again, then I got another error message,

          release/datastream.o:datastream.cpp:(.text+0x1): undefined reference to _imp___ZTV26LibRaw_abstract_datastream' release/datastream.o:datastream.cpp:(.text+0x117): undefined reference to _imp___ZTV26LibRaw_abstract_datastream'
          c:/Qt/Qt5.6.2/Tools/mingw492_32/bin/../lib/gcc/i686-w64-mingw32/4.9.2/../../../../i686-w64-mingw32/bin/ld.exe: release/datastream.o: bad reloc address 0x0 in section `.rdata$_ZTI26LibRaw_abstract_datastream[__ZTI26LibRaw_abstract_datastream]'
          collect2.exe: error: ld returned 1 exit status
          Makefile.Release:68: recipe for target 'imageformats/qtraw.dll' failed
          mingw32-make[2]: Leaving directory 'd:/qqes/qtraw-master/build-qtraw-Desktop_Qt_5_6_2_MinGW_32bit-Release/src'
          Makefile:34: recipe for target 'release' failed
          mingw32-make[1]: Leaving directory 'd:/qqes/qtraw-master/build-qtraw-Desktop_Qt_5_6_2_MinGW_32bit-Release/src'
          mingw32-make[2]: *** [imageformats/qtraw.dll] Error 1
          mingw32-make[1]: *** [release] Error 2
          makefile:39: recipe for target 'sub-src-make_first' failed
          mingw32-make: *** [sub-src-make_first] Error 2

          I don't know what to do with this.

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

            It's for the pkg-config tool that is not standard on Windows but that you can install.

            Hence you need to add to LIBS the path and library to link to for libraw.

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

            S 1 Reply Last reply
            0
            • SGaistS SGaist

              It's for the pkg-config tool that is not standard on Windows but that you can install.

              Hence you need to add to LIBS the path and library to link to for libraw.

              S Offline
              S Offline
              samdol
              wrote on last edited by
              #6

              @SGaist

              I think I added the path and library to LIBS as
              else:win32: LIBS += $$PWD/libraw/win32/libraw.a

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

                LIBS += -L$$PWD/libraw/win32/ -lraw

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

                S 1 Reply Last reply
                1
                • SGaistS SGaist

                  LIBS += -L$$PWD/libraw/win32/ -lraw

                  S Offline
                  S Offline
                  samdol
                  wrote on last edited by
                  #8

                  @SGaist
                  The contents of libraw.pc.in is

                  prefix=@prefix@
                  exec_prefix=@exec_prefix@
                  libdir=@libdir@
                  includedir=@includedir@

                  Name: libraw
                  Description: Raw image decoder library (non-thread-safe)
                  Requires: @PACKAGE_REQUIRES@
                  Version: @PACKAGE_VERSION@
                  Libs: -L${libdir} -lraw -lstdc++@PC_OPENMP@
                  Cflags: -I${includedir}/libraw

                  so I set
                  INCLUDEPATH += $$PWD/libraw
                  LIBS += -L$$PWD/libraw/win32/ -lraw -lstdc++
                  but that gives me the same error.

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

                    Which version of MinGW did you use to build libraw ?

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

                    S 1 Reply Last reply
                    0
                    • SGaistS SGaist

                      Which version of MinGW did you use to build libraw ?

                      S Offline
                      S Offline
                      samdol
                      wrote on last edited by
                      #10

                      @SGaist
                      I used mingw 4.9.2.

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

                        The one provided with Qt ?

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

                        S 2 Replies Last reply
                        0
                        • SGaistS SGaist

                          The one provided with Qt ?

                          S Offline
                          S Offline
                          samdol
                          wrote on last edited by
                          #12
                          This post is deleted!
                          1 Reply Last reply
                          0
                          • SGaistS SGaist

                            The one provided with Qt ?

                            S Offline
                            S Offline
                            samdol
                            wrote on last edited by
                            #13

                            @SGaist
                            Yes, It came with 5.6.2

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

                              Can you check against the latest version of LibRaw ?

                              There might be a problem with their handling of the imported/exported symbol.

                              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