Compiling source code in Windows

Post any defects you find in the released or beta versions of the ImageMagick software here. Include the ImageMagick version, OS, and any command-line required to reproduce the problem. Got a patch for a bug? Post it here.
Post Reply
el_supremo
Posts: 1015
Joined: 2005-03-21T21:16:57-07:00

Compiling source code in Windows

Post by el_supremo »

I tried to compile the current version 6.6.3-8 on Windows and ran into a few problems.

When building the CORE_magick project, the function InitializeCriticalSectionandSpinCount is undefined. The way to make windows define and link this function is to include this define:

Code: Select all

#define _WIN32_WINNT 0x0501
But this must occur before the include of <windows.h>. I got around this by putting the define in magick_config.h but there's probably a better way to do it.

When building CORE_lcms, the function sqrtf is undefined. In lcms2_internal.h I added a define inside an existing #ifdef:

Code: Select all

// Other replacement functions
#ifdef _MSC_VER
# ifndef snprintf
#       define snprintf  _snprintf
# endif
# ifndef vsnprintf
#       define vsnprintf  _vsnprintf
# endif
//PAH Added this
#define sqrtf(x) (float)sqrt((float)x)
#endif
In IM_MOD_wmf vsnprintf is undefined so I added this at the front of wmf/src/stream.h:

Code: Select all

#ifdef _MSC_VER
# ifndef vsnprintf
#       define vsnprintf  _vsnprintf
# endif
#endif
Pete
Sorry, my ISP shutdown all personal webspace so my MagickWand Examples in C is offline.
See my message in this topic for a link to a zip of all the files.
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Compiling source code in Windows

Post by magick »

Thanks for the patches. We'll get them into the next point release of ImageMagick.
User avatar
rmabry
Posts: 148
Joined: 2004-04-13T11:25:27-07:00

Re: Compiling source code in Windows

Post by rmabry »

Something still amiss. I get the (probably) same error in 6.4.4-1:

====================
10>MagickCore module DLL export interface
10>Generating Code...
10>Compiling resources...
10>Linking...
10> Creating library ..\lib\CORE_RL_magick_.lib and object ..\lib\CORE_RL_magick_.exp
10>semaphore.obj : error LNK2019: unresolved external symbol _InitializeCriticalSectionAndSpinCount referenced in function _AllocateSemaphoreInfo
10>..\bin\CORE_RL_magick_.dll : fatal error LNK1120: 1 unresolved externals
10>Build log was saved at "file://f:\ImageMagick\VisualMagick\Release\CORE_magick\BuildLog.htm"
10>CORE_magick - 2 error(s), 1 warning(s)
====================

I'll try Pete's #define trick in the morning...

Rick
User avatar
rmabry
Posts: 148
Joined: 2004-04-13T11:25:27-07:00

Re: Compiling source code in Windows

Post by rmabry »

I got around this by putting the define in magick_config.h
I'll try Pete's #define trick in the morning...
It worked (in magick-config.h, not magick_config.h). I have no idea why, but thanks, Pete.

Any prognosis for the problem?

Rick
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Compiling source code in Windows

Post by magick »

Look for this patch in the next point release of ImageMagick.
Post Reply