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

The MagickWand interface is a new high-level C API interface to ImageMagick core methods. We discourage the use of the core methods and encourage the use of this API instead. Post MagickWand questions, bug reports, and suggestions to this forum.
Post Reply
bbigras
Posts: 6
Joined: 2015-01-09T08:50:15-07:00
Authentication code: 6789

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

Post 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.
Last edited by bbigras on 2015-01-09T11:16:47-07:00, edited 1 time in total.
User avatar
dlemstra
Posts: 1570
Joined: 2013-05-04T15:28:54-07:00
Authentication code: 6789
Contact:

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

Post by dlemstra »

It looks like you are linking a 32-bit library with 64-bit libraries of mingw.
.NET + ImageMagick = Magick.NET https://github.com/dlemstra/Magick.NET, @MagickNET, Donate
bbigras
Posts: 6
Joined: 2015-01-09T08:50:15-07:00
Authentication code: 6789

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

Post 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.
Post Reply