Page 1 of 1

[SOLVED] Problem linking to ImageMagick-6.9.0-3-Q16-x86-dll on Windows 32-bit with mingw32

Posted: 2015-01-09T09:03:24-07:00
by bbigras
If I understand correctly, ImageMagick-6.9.0-3-Q16-x86-dll is built using msvc and I need to use gendef and dlltool to have a lib I can use with mingw32. I'm trying to link with a Go program using the canvas wrapper.

Code: Select all

cd C:\ImageMagick-6.9.0-Q16
gendef *.dll

mkdir C:\ImageMagick-6.9.0-Q16\lib
cd C:\ImageMagick-6.9.0-Q16\lib
dlltool -D ..\CORE_RL_magick_.dll -l libMagickCore.a -d ..\CORE_RL_magick_.def
dlltool -D ..\CORE_RL_wand_.dll -l libMagickWand.a -d ..\CORE_RL_wand_.def
I'm able to link on 64-bit with ImageMagick-6.9.0-3-Q16-x64-dll.exe but on 32-bit with ImageMagick-6.9.0-3-Q16-x86-dll.exe I get :

Code: Select all

C:\DOCUME~1\test\LOCALS~1\Temp\go-build468732827\github.com\gosexy\canvas\_obj\canvas.cgo2.o:canvas.cgo2.c:(.text+0xeb0): undefined reference to `_imp__MagickRelinquishMemory'
C:\DOCUME~1\test\LOCALS~1\Temp\go-build468732827\github.com\gosexy\canvas\_obj\canvas.cgo2.o:canvas.cgo2.c:(.text+0x14bc): undefined reference to `_imp__MagickWandTerminus'
C:/mingw-w64/mingw32/bin/../lib/gcc/i686-w64-mingw32/4.9.2/../../../../i686-w64-mingw32/bin/ld.exe: $WORK\github.com\gosexy\canvas\_obj\canvas.cgo2.o: bad reloc address 0x20 in section `.eh_frame'
C:/mingw-w64/mingw32/bin/../lib/gcc/i686-w64-mingw32/4.9.2/../../../../i686-w64-mingw32/bin/ld.exe: final link failed: Invalid operation
collect2.exe: error: ld returned 1 exit status
Maybe I'm not using dlltool correctly. I saw ImageMagick-i686-pc-mingw32.tar.gz on the website but it's outdated (6.8.5) and there's no 64-bit version.

Re: Problem linking to ImageMagick-6.9.0-3-Q16-x86-dll on Windows 32-bit with mingw32

Posted: 2015-01-09T09:51:25-07:00
by dlemstra
It looks like you are linking a 32-bit library with 64-bit libraries of mingw.

Re: Problem linking to ImageMagick-6.9.0-3-Q16-x86-dll on Windows 32-bit with mingw32

Posted: 2015-01-09T11:16:00-07:00
by bbigras
I was using "MinGW-w64 - for 32 and 64 bit Windows" and I selected the 32-bit version when installing but I tested with regular MinGW and it worked fine.

I'll check with MinGW-w64 devs to see if it was a bug in their package or if I did something wrong.

Thanks.