Page 1 of 1

Compiling source code in Windows

Posted: 2010-08-21T16:23:41-07:00
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

Re: Compiling source code in Windows

Posted: 2010-08-22T06:52:15-07:00
by magick
Thanks for the patches. We'll get them into the next point release of ImageMagick.

Re: Compiling source code in Windows

Posted: 2010-09-12T22:25:31-07:00
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

Re: Compiling source code in Windows

Posted: 2010-09-13T05:56:42-07:00
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

Re: Compiling source code in Windows

Posted: 2010-09-13T06:01:45-07:00
by magick
Look for this patch in the next point release of ImageMagick.