Test User
2015-11-01 05:17:14 UTC
When building GraphicsMagick-1.3.22 with MinGW I encounter an error
compiling
blob.c. I didn't understand the message:
../GraphicsMagick-1.3.22/magick/studio.h:338:29: error: expected
declaration spe
cifiers or '...' before '(' token
# define sleep(sec) Sleep(sec * 1000)
so I compiled the preprocessed blob.c:
$ gcc -c blob.i
In file included from c:/MinGW/local/include/zconf.h:452:0,
from c:/MinGW/local/include/zlib.h:34,
from ../GraphicsMagick-1.3.22/magick/blob.c:60:
c:\mingw\include\unistd.h:139:73: error: expected declaration specifiers or
'...
' before '(' token
unsigned __cdecl __MINGW_NOTHROW sleep( unsigned );
^
c:\mingw\include\unistd.h:143:16: error: expected declaration specifiers or
'...
' before '(' token
unsigned sleep( unsigned period ){ return __mingw_sleep( period, 0 ); }
The problem seems to be that MinGW has a header unistd.h that declares
sleep(unsigned secs) and causes the attempt to redefine it as Windows API
function Sleep(DWORD milliseconds) in magick/studio.h to fail, i.e.
#if defined(MSWINDOWS)
/* various declarations */
# undef sleep
# define sleep(sec) Sleep(sec * 1000) /* ERROR! */
# if !defined(HAVE_TIFFCONF_H)
# define HAVE_TIFFCONF_H
# endif
#endif /* defined(MSWINDOWS) */
Maybe there could be a HAVE_POSIX_SLEEP in magicj/magick_confi.h and then:
#if defined(MSWINDOWS)
...
#if !defined(HAVE_POSIX_SLEEP)
# define sleep(sec) Sleep(sec * 1000)
#endif
Regards,
Test User.
compiling
blob.c. I didn't understand the message:
../GraphicsMagick-1.3.22/magick/studio.h:338:29: error: expected
declaration spe
cifiers or '...' before '(' token
# define sleep(sec) Sleep(sec * 1000)
so I compiled the preprocessed blob.c:
$ gcc -c blob.i
In file included from c:/MinGW/local/include/zconf.h:452:0,
from c:/MinGW/local/include/zlib.h:34,
from ../GraphicsMagick-1.3.22/magick/blob.c:60:
c:\mingw\include\unistd.h:139:73: error: expected declaration specifiers or
'...
' before '(' token
unsigned __cdecl __MINGW_NOTHROW sleep( unsigned );
^
c:\mingw\include\unistd.h:143:16: error: expected declaration specifiers or
'...
' before '(' token
unsigned sleep( unsigned period ){ return __mingw_sleep( period, 0 ); }
The problem seems to be that MinGW has a header unistd.h that declares
sleep(unsigned secs) and causes the attempt to redefine it as Windows API
function Sleep(DWORD milliseconds) in magick/studio.h to fail, i.e.
#if defined(MSWINDOWS)
/* various declarations */
# undef sleep
# define sleep(sec) Sleep(sec * 1000) /* ERROR! */
# if !defined(HAVE_TIFFCONF_H)
# define HAVE_TIFFCONF_H
# endif
#endif /* defined(MSWINDOWS) */
Maybe there could be a HAVE_POSIX_SLEEP in magicj/magick_confi.h and then:
#if defined(MSWINDOWS)
...
#if !defined(HAVE_POSIX_SLEEP)
# define sleep(sec) Sleep(sec * 1000)
#endif
Regards,
Test User.