Fix for Linker Error when compiling from source

Questions and postings pertaining to the development of ImageMagick, feature enhancements, and ImageMagick internals. ImageMagick source code and algorithms are discussed here. Usage questions which are too arcane for the normal user list should also be posted here.
Post Reply
Glenstorm

Fix for Linker Error when compiling from source

Post by Glenstorm »

I don't know if this issue is prevalent elsewhere, but here it is.

I'm compiling Magick from source using the VisualMagick (using VS2008 Professional) thing since the binary distribution excludes HDRI support which I require. But when I try to compile in Win32 configuration, it throws a linker error saying the module machine type X86 does not match target machine type x64. I'm using an x64 machine however the Target Machine type in Properties->Linker->Advanced is set to /MACHINE:X86.

The issue comes due to /MACHINE:AMD64 being defined as part of Additional Dependencies in Properties->Linker->Input (for some projects under Linker->Librarian). I don't know why it is there instead of in the Advanced Tab, but that is a different issue. If you guys look in the Command Prompt Tab (under Linker) /MACHINE:AMD64 comes after /MACHINE:X86 and hence seems to be the origin of the issue. I don't know if AMD64 should be part of the code for Magick to work, but it compiles fine after I recompiled configure.exe to exclude the AMD64 tag and trying to compile the resultant solution file.

If anyone is having similar issues all you have to do is open the configure solution/workspace file, search for AMD64 and remove "/MACHINE:AMD64" from the string in which it is found (without quotes) and build. I still haven't tested it yet, but it shouldn't have issues.
Post Reply