MinGW build error when sleep re#defined as Sleep
Test User <[email protected]> Sun, 1 Nov 2015 00:17:14 -0500
| Newsgroups | gmane.comp.video.graphicsmagick.bugs |
|---|---|
| Message-ID | <CAH7jLrvgVfSyEQ=crE4WaBowZe7zLYvmOdZXNHfPPtMLUjFO3w@mail.gmail.com> |
--===============4355713896015731741==
Content-Type: multipart/alternative; boundary=001a11c310be11dca0052373c6b2
--001a11c310be11dca0052373c6b2
Content-Type: text/plain; charset=UTF-8
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.
--001a11c310be11dca0052373c6b2
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><div><div><div>When building GraphicsMagick-1.3.22 with Mi=
nGW I encounter an error compiling<br>blob.c. I didn't understand the m=
essage:<br>../GraphicsMagick-1.3.22/magick/studio.h:338:29: error: expected=
declaration spe<br>cifiers or '...' before '(' token<br>=
=C2=A0#=C2=A0 define sleep(sec)=C2=A0 Sleep(sec * 1000)<br>so I compiled th=
e preprocessed blob.c:<br><br>$ gcc -c blob.i<br>In file included from c:/M=
inGW/local/include/zconf.h:452:0,<br>=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 from c:/MinGW/=
local/include/zlib.h:34,<br>=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 from ../GraphicsMagick-=
1.3.22/magick/blob.c:60:<br>c:\mingw\include\unistd.h:139:73: error: expect=
ed declaration specifiers or '...<br>' before '(' token<br>=
=C2=A0unsigned __cdecl __MINGW_NOTHROW sleep( unsigned );<br>=C2=A0=C2=A0=
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 ^<br>c:\mingw\include\unistd.=
h:143:16: error: expected declaration specifiers or '...<br>' befor=
e '(' token<br>=C2=A0unsigned sleep( unsigned period ){ return __mi=
ngw_sleep( period, 0 ); }<br><br></div>The problem seems to be that MinGW h=
as a header unistd.h that declares<br></div>sleep(unsigned secs) and causes=
the attempt to redefine it as Windows API<br>function Sleep(DWORD millisec=
onds) in magick/studio.h to fail, i.e.<br><br>#if defined(MSWINDOWS)<br>/* =
various declarations */<br>#=C2=A0 undef sleep<br>#=C2=A0 define sleep(sec)=
=C2=A0 Sleep(sec * 1000) /* ERROR! */<br>#=C2=A0 if !defined(HAVE_TIFFCONF_=
H)<br>#=C2=A0=C2=A0=C2=A0 define HAVE_TIFFCONF_H<br>#=C2=A0 endif<br>#endif=
/* defined(MSWINDOWS) */<br><br></div><div>Maybe there could be a HAVE_POS=
IX_SLEEP in magicj/magick_confi.h and then:<br></div><div>#if defined(MSWIN=
DOWS)<br>...<br></div><div>#if !defined(HAVE_POSIX_SLEEP)<br></div><div>#=
=C2=A0 define sleep(sec) Sleep(sec * 1000)<br></div><div>#endif<br><br></di=
v><div>Regards,<br></div><div>Test User.<br></div></div>
--001a11c310be11dca0052373c6b2--
--===============4355713896015731741==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
------------------------------------------------------------------------------
--===============4355713896015731741==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
_______________________________________________
Graphicsmagick-bugs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/graphicsmagick-bugs
--===============4355713896015731741==--