Mobility
2nd February 2014, 08:55
Hi,
I've been trying to get Imagemagick working in my Qt project. Because I'm using MinGW compiler, I had to build the Imagemagic lib myself. I followed these instructions: http://imagemagick.sourceforge.net/http/www/install.html
My .pro file looks like this:
INCLUDEPATH += "C:/ImageMagick-6.8.8-Q8/include"
INCLUDEPATH += "C:/ImageMagick-6.8.8-Q8/include/magick"
INCLUDEPATH += "C:/ImageMagick-6.8.8-Q8/include/Magick++"
INCLUDEPATH += "C:/ImageMagick-6.8.8-Q8/include/wand"
LIBS += -Lc:/MinGW/lib -llibMagickWand-6.Q16 -llibMagickCore-6.Q16
I have added headers to .cpp and it seems to work:
#include <Magick++.h>
Then I have tried to copy the related 'dll' and 'a' files under mingw/lib and the application directory.
Problem is that it gives following errors when building the project:
c:/qtsdk/mingw/bin/../lib/gcc/mingw32/4.4.0/../../../../mingw32/bin/ld.exe: Dwarf Error: Offset (484) greater than or equal to (null) size (4954657).
c:/MinGW/lib/libmingw32.a(tlsthrd.o):tlsthrd.c:(.text+0x20): undefined reference to `EnterCriticalSection@4'
c:/qtsdk/mingw/bin/../lib/gcc/mingw32/4.4.0/../../../../mingw32/bin/ld.exe: Dwarf Error: found dwarf version '0', this reader only handles version 2 and 3 information.
c:/MinGW/lib/libmingw32.a(tlsthrd.o):tlsthrd.c:(.text+0x61): undefined reference to `LeaveCriticalSection@4'
c:/qtsdk/mingw/bin/../lib/gcc/mingw32/4.4.0/../../../../mingw32/bin/ld.exe: Dwarf Error: found dwarf version '20039', this reader only handles version 2 and 3 information.
c:/MinGW/lib/libmingw32.a(tlsthrd.o):tlsthrd.c:(.text+0xb5): undefined reference to `EnterCriticalSection@4'
c:/qtsdk/mingw/bin/../lib/gcc/mingw32/4.4.0/../../../../mingw32/bin/ld.exe: Dwarf Error: found dwarf version '8259', this reader only handles version 2 and 3 information.
c:/MinGW/lib/libmingw32.a(tlsthrd.o):tlsthrd.c:(.text+0xd0): undefined reference to `LeaveCriticalSection@4'
c:/qtsdk/mingw/bin/../lib/gcc/mingw32/4.4.0/../../../../mingw32/bin/ld.exe: Dwarf Error: found dwarf version '11829', this reader only handles version 2 and 3 information.
c:/MinGW/lib/libmingw32.a(tlsthrd.o):tlsthrd.c:(.text+0x104): undefined reference to `EnterCriticalSection@4'
c:/qtsdk/mingw/bin/../lib/gcc/mingw32/4.4.0/../../../../mingw32/bin/ld.exe: Dwarf Error: found dwarf version '11777', this reader only handles version 2 and 3 information.
c:/MinGW/lib/libmingw32.a(tlsthrd.o):tlsthrd.c:(.text+0x133): undefined reference to `LeaveCriticalSection@4'
c:/qtsdk/mingw/bin/../lib/gcc/mingw32/4.4.0/../../../../mingw32/bin/ld.exe: Dwarf Error: found dwarf version '26989', this reader only handles version 2 and 3 information.
c:/MinGW/lib/libmingw32.a(tlsthrd.o):tlsthrd.c:(.text+0x156): undefined reference to `LeaveCriticalSection@4'
c:/qtsdk/mingw/bin/../lib/gcc/mingw32/4.4.0/../../../../mingw32/bin/ld.exe: Dwarf Error: found dwarf version '12151', this reader only handles version 2 and 3 information.
c:/MinGW/lib/libmingw32.a(tlsthrd.o):tlsthrd.c:(.text+0x1af): undefined reference to `DeleteCriticalSection@4'
c:/qtsdk/mingw/bin/../lib/gcc/mingw32/4.4.0/../../../../mingw32/bin/ld.exe: Dwarf Error: found dwarf version '29811', this reader only handles version 2 and 3 information.
c:/MinGW/lib/libmingw32.a(tlsthrd.o):tlsthrd.c:(.text+0x1dc): undefined reference to `InitializeCriticalSection@4'
collect2: ld returned 1 exit status
mingw32-make.exe[1]: *** [debug\barcode_reader_from_image.exe] Error 1
mingw32-make.exe: *** [debug] Error 2
09:47:54: The process "C:\QtSDK\mingw\bin\mingw32-make.exe" exited with code 2.
Error while building project barcode_reader_from_image (target: Desktop)
When executing build step 'Make'
Any idea what is causing the errors? By googling I found some comments that some other libs should also be added, but at least these did not make any change:
LIBS += c:/MinGW/lib/libkernel32.a
LIBS += c:/MinGW/lib/libgdi32.a
On the other hand, if I do not put the -Lc:/MinGW/lib to the .pro file (only the two libraries), it seems that the added libraries are not found:
.pro:
INCLUDEPATH += "C:/ImageMagick-6.8.8-Q8/include"
INCLUDEPATH += "C:/ImageMagick-6.8.8-Q8/include/magick"
INCLUDEPATH += "C:/ImageMagick-6.8.8-Q8/include/Magick++"
INCLUDEPATH += "C:/ImageMagick-6.8.8-Q8/include/wand"
LIBS += c:/MinGW/lib/libMagickCore-6-Q16.a
LIBS += c:/MinGW/lib/libMagickWand-6-Q16.a
Then trying to use the libraries in source:
Magick::Image magick;
build error:
debug/mainwindow.o:C:\Users\Aki\barcode_reader_from_imag e-build-desktop-Qt_4_8_0_for_Desktop_-_MinGW__Qt_SDK__Debug/../barcode_reader_from_image/mainwindow.cpp:49: undefined reference to `Magick::InitializeMagick(char const*)'
collect2: ld returned 1 exit status
mingw32-make.exe[1]: *** [debug\barcode_reader_from_image.exe] Error 1
mingw32-make.exe: *** [debug] Error 2
10:41:12: The process "C:\QtSDK\mingw\bin\mingw32-make.exe" exited with code 2.
Error while building project barcode_reader_from_image (target: Desktop)
When executing build step 'Make'
Don't know anymore what to try. Any help is higly appreciated! Thanks!
I've been trying to get Imagemagick working in my Qt project. Because I'm using MinGW compiler, I had to build the Imagemagic lib myself. I followed these instructions: http://imagemagick.sourceforge.net/http/www/install.html
My .pro file looks like this:
INCLUDEPATH += "C:/ImageMagick-6.8.8-Q8/include"
INCLUDEPATH += "C:/ImageMagick-6.8.8-Q8/include/magick"
INCLUDEPATH += "C:/ImageMagick-6.8.8-Q8/include/Magick++"
INCLUDEPATH += "C:/ImageMagick-6.8.8-Q8/include/wand"
LIBS += -Lc:/MinGW/lib -llibMagickWand-6.Q16 -llibMagickCore-6.Q16
I have added headers to .cpp and it seems to work:
#include <Magick++.h>
Then I have tried to copy the related 'dll' and 'a' files under mingw/lib and the application directory.
Problem is that it gives following errors when building the project:
c:/qtsdk/mingw/bin/../lib/gcc/mingw32/4.4.0/../../../../mingw32/bin/ld.exe: Dwarf Error: Offset (484) greater than or equal to (null) size (4954657).
c:/MinGW/lib/libmingw32.a(tlsthrd.o):tlsthrd.c:(.text+0x20): undefined reference to `EnterCriticalSection@4'
c:/qtsdk/mingw/bin/../lib/gcc/mingw32/4.4.0/../../../../mingw32/bin/ld.exe: Dwarf Error: found dwarf version '0', this reader only handles version 2 and 3 information.
c:/MinGW/lib/libmingw32.a(tlsthrd.o):tlsthrd.c:(.text+0x61): undefined reference to `LeaveCriticalSection@4'
c:/qtsdk/mingw/bin/../lib/gcc/mingw32/4.4.0/../../../../mingw32/bin/ld.exe: Dwarf Error: found dwarf version '20039', this reader only handles version 2 and 3 information.
c:/MinGW/lib/libmingw32.a(tlsthrd.o):tlsthrd.c:(.text+0xb5): undefined reference to `EnterCriticalSection@4'
c:/qtsdk/mingw/bin/../lib/gcc/mingw32/4.4.0/../../../../mingw32/bin/ld.exe: Dwarf Error: found dwarf version '8259', this reader only handles version 2 and 3 information.
c:/MinGW/lib/libmingw32.a(tlsthrd.o):tlsthrd.c:(.text+0xd0): undefined reference to `LeaveCriticalSection@4'
c:/qtsdk/mingw/bin/../lib/gcc/mingw32/4.4.0/../../../../mingw32/bin/ld.exe: Dwarf Error: found dwarf version '11829', this reader only handles version 2 and 3 information.
c:/MinGW/lib/libmingw32.a(tlsthrd.o):tlsthrd.c:(.text+0x104): undefined reference to `EnterCriticalSection@4'
c:/qtsdk/mingw/bin/../lib/gcc/mingw32/4.4.0/../../../../mingw32/bin/ld.exe: Dwarf Error: found dwarf version '11777', this reader only handles version 2 and 3 information.
c:/MinGW/lib/libmingw32.a(tlsthrd.o):tlsthrd.c:(.text+0x133): undefined reference to `LeaveCriticalSection@4'
c:/qtsdk/mingw/bin/../lib/gcc/mingw32/4.4.0/../../../../mingw32/bin/ld.exe: Dwarf Error: found dwarf version '26989', this reader only handles version 2 and 3 information.
c:/MinGW/lib/libmingw32.a(tlsthrd.o):tlsthrd.c:(.text+0x156): undefined reference to `LeaveCriticalSection@4'
c:/qtsdk/mingw/bin/../lib/gcc/mingw32/4.4.0/../../../../mingw32/bin/ld.exe: Dwarf Error: found dwarf version '12151', this reader only handles version 2 and 3 information.
c:/MinGW/lib/libmingw32.a(tlsthrd.o):tlsthrd.c:(.text+0x1af): undefined reference to `DeleteCriticalSection@4'
c:/qtsdk/mingw/bin/../lib/gcc/mingw32/4.4.0/../../../../mingw32/bin/ld.exe: Dwarf Error: found dwarf version '29811', this reader only handles version 2 and 3 information.
c:/MinGW/lib/libmingw32.a(tlsthrd.o):tlsthrd.c:(.text+0x1dc): undefined reference to `InitializeCriticalSection@4'
collect2: ld returned 1 exit status
mingw32-make.exe[1]: *** [debug\barcode_reader_from_image.exe] Error 1
mingw32-make.exe: *** [debug] Error 2
09:47:54: The process "C:\QtSDK\mingw\bin\mingw32-make.exe" exited with code 2.
Error while building project barcode_reader_from_image (target: Desktop)
When executing build step 'Make'
Any idea what is causing the errors? By googling I found some comments that some other libs should also be added, but at least these did not make any change:
LIBS += c:/MinGW/lib/libkernel32.a
LIBS += c:/MinGW/lib/libgdi32.a
On the other hand, if I do not put the -Lc:/MinGW/lib to the .pro file (only the two libraries), it seems that the added libraries are not found:
.pro:
INCLUDEPATH += "C:/ImageMagick-6.8.8-Q8/include"
INCLUDEPATH += "C:/ImageMagick-6.8.8-Q8/include/magick"
INCLUDEPATH += "C:/ImageMagick-6.8.8-Q8/include/Magick++"
INCLUDEPATH += "C:/ImageMagick-6.8.8-Q8/include/wand"
LIBS += c:/MinGW/lib/libMagickCore-6-Q16.a
LIBS += c:/MinGW/lib/libMagickWand-6-Q16.a
Then trying to use the libraries in source:
Magick::Image magick;
build error:
debug/mainwindow.o:C:\Users\Aki\barcode_reader_from_imag e-build-desktop-Qt_4_8_0_for_Desktop_-_MinGW__Qt_SDK__Debug/../barcode_reader_from_image/mainwindow.cpp:49: undefined reference to `Magick::InitializeMagick(char const*)'
collect2: ld returned 1 exit status
mingw32-make.exe[1]: *** [debug\barcode_reader_from_image.exe] Error 1
mingw32-make.exe: *** [debug] Error 2
10:41:12: The process "C:\QtSDK\mingw\bin\mingw32-make.exe" exited with code 2.
Error while building project barcode_reader_from_image (target: Desktop)
When executing build step 'Make'
Don't know anymore what to try. Any help is higly appreciated! Thanks!