Re: Fail to build SDL-2.0.5, after enabling -std=c99 ...
JIA Pei <[email protected]> Tue, 7 Mar 2017 11:28:11 -0800
| Newsgroups | gmane.comp.lib.sdl |
|---|---|
| Message-ID | <CADh8Q_WBzXsM9ufbE8WvCVpLyCt-1B+tpd9nmHGsQ_J8PBbvUQ@mail.gmail.com> |
--===============5378771353534419123== Content-Type: multipart/alternative; boundary=001a113cd9cc37e657054a290342 --001a113cd9cc37e657054a290342 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Thank you Daniel... Thank you for your very clear explanation... Cheers On Mon, Mar 6, 2017 at 5:09 PM, Daniel Gibson <[email protected]> wrote= : > Hi, > > building with -std=3Dc99 (instead of gnu99) doesn't only change the synta= x > that's accepted by the compiler, but also what parts of headers are used. > All (or most?) things in standard headers that are not part of the C99 > standard, like "GNU extensions" is not enabled (this is the "#define > _GNU_SOURCE" stuff mentioned in manpages). > IMHO it's not very useful to use -std=3Dc99, especially for code like lib= SDL > that needs to do operating-system specific things. Just use -std=3Dgnu99 = (or > even gnu89).. > > > Cheers, > Daniel > > On 07.03.2017 02:01, JIA Pei wrote: > >> >> Hi, Ryan: >> >> >> My current solution is to*change -std=3Dc99 to -std=3Dgnu99.* >> >> I'm testing your solution, which seems to be correct !!! However, I'm >> NOW facing some new issues: >> >> SDL2/SDL2-2.0.5/src/render/software/SDL_rotate.c:136:29:error: =E2=80=98= M_PI=E2=80=99 >> undeclared (first use in this function) >> radangle =3D angle * (M_PI / -180.0); /* reverse the angle becau= se >> our rotations are clockwise */ >> >> SDL2/SDL2-2.0.5/src/events/SDL_quit.c:55:22:error: storage size of >> =E2=80=98action=E2=80=99 isn=E2=80=99t known >> struct sigaction action; >> >> >> I can easily solve the first problem *'M_PI' hasn't been declared* by >> defining *M_PI *as*:* >> >> *#ifndef M_PI* >> *#define M_PI 3.14159265358979323846264338327950288 /* pi */* >> *#endif* >> >> >> >> However, how to solve the second issue ???? >> SDL2/SDL2-2.0.5/src/events/SDL_quit.c:55:22: error: storage size of >> =E2=80=98action=E2=80=99 isn=E2=80=99t known >> struct sigaction action; >> >> >> Cheers >> >> >> On Mon, Mar 6, 2017 at 2:00 PM, Ryan C. Gordon <[email protected] >> <mailto:[email protected]>> wrote: >> >> On 3/3/17 5:13 PM, Sik the hedgehog wrote: >> >> Try -std=3Dgnu99 (if I recall correctly) >> >> Looks like the problem is using asm instead of a reserved keywor= d >> (whoops). -std=3Dc99 will disable any extensions, -std=3Dgnu99 w= ill >> keep >> them. >> >> >> So the actual fix should be to change that to __asm__, right? >> >> --ryan. >> >> >> >> >> _______________________________________________ >> SDL mailing list >> [email protected] <mailto:[email protected]> >> http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org >> <http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org> >> >> >> >> >> -- >> >> Pei JIA, Ph.D. >> >> Email: [email protected] <mailto:[email protected]> >> cell in Canada: +1 778-863-5816 >> cell in China: +86 186-8244-3503 >> >> Welcome to Vision Open >> http://www.visionopen.com >> >> >> _______________________________________________ >> SDL mailing list >> [email protected] >> http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org >> >> > _______________________________________________ > SDL mailing list > [email protected] > http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org > --=20 Pei JIA, Ph.D. Email: [email protected] cell in Canada: +1 778-863-5816 cell in China: +86 186-8244-3503 Welcome to Vision Open http://www.visionopen.com --001a113cd9cc37e657054a290342 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable <div dir=3D"ltr">Thank you Daniel... Thank you for your very clear explanat= ion...<div><br></div><div>Cheers</div></div><div class=3D"gmail_extra"><br>= <div class=3D"gmail_quote">On Mon, Mar 6, 2017 at 5:09 PM, Daniel Gibson <s= pan dir=3D"ltr"><<a href=3D"mailto:[email protected]" target=3D"_bla= nk">[email protected]</a>></span> wrote:<br><blockquote class=3D"gma= il_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-lef= t:1ex">Hi,<br> <br> building with -std=3Dc99 (instead of gnu99) doesn't only change the syn= tax that's accepted by the compiler, but also what parts of headers are= used.<br> All (or most?) things in standard headers that are not part of the C99 stan= dard, like "GNU extensions" is not enabled (this is the "#de= fine _GNU_SOURCE" stuff mentioned in manpages).<br> IMHO it's not very useful to use -std=3Dc99, especially for code like l= ibSDL that needs to do operating-system specific things. Just use -std=3Dgn= u99 (or even gnu89)..<br> <br> <br> Cheers,<br> Daniel<span class=3D""><br> <br> On 07.03.2017 02:01, JIA Pei wrote:<br> </span><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-= left:1px #ccc solid;padding-left:1ex"> <br> Hi, Ryan:<br> <br> <br> My current solution is to*change -std=3Dc99 to -std=3Dgnu99.*<span class=3D= ""><br> <br> I'm testing your solution, which seems to be correct !!! However, I'= ;m<br> NOW facing some new issues:<br> <br> SDL2/SDL2-2.0.5/src/render/sof<wbr>tware/SDL_rotate.c:136:29:erro<wbr>r: = =E2=80=98M_PI=E2=80=99<br> undeclared (first use in this function)<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 radangle =3D angle * (M_PI / -180.0); /* revers= e the angle because<br> our rotations are clockwise */<br> <br> SDL2/SDL2-2.0.5/src/events/SDL<wbr>_quit.c:55:22:error: storage size of<br> =E2=80=98action=E2=80=99 isn=E2=80=99t known<br> =C2=A0 =C2=A0 struct sigaction action;<br> <br> <br></span> I can easily solve the first problem=C2=A0 *'M_PI' hasn't been = declared* by<br> defining *M_PI *as*:*<br> <br> =C2=A0 =C2=A0 *#ifndef M_PI*<br> =C2=A0 =C2=A0 *#define M_PI=C2=A0 =C2=A0 3.1415926535897932384626433832<wbr= >7950288=C2=A0 =C2=A0/* pi */*<br> =C2=A0 =C2=A0 *#endif*<span class=3D""><br> <br> <br> <br> However, how to solve the second issue ????<br> SDL2/SDL2-2.0.5/src/events/SDL<wbr>_quit.c:55:22: error: storage size of<br= > =E2=80=98action=E2=80=99 isn=E2=80=99t known<br> =C2=A0 =C2=A0 struct sigaction action;<br> <br> <br> Cheers<br> <br> <br> On Mon, Mar 6, 2017 at 2:00 PM, Ryan C. Gordon <<a href=3D"mailto:icculu= [email protected]" target=3D"_blank">[email protected]</a><br></span><span cl= ass=3D""> <mailto:<a href=3D"mailto:[email protected]" target=3D"_blank">icculus= @icculus.org</a>>> wrote:<br> <br> =C2=A0 =C2=A0 On 3/3/17 5:13 PM, Sik the hedgehog wrote:<br> <br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 Try -std=3Dgnu99 (if I recall correctly)<br> <br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 Looks like the problem is using asm instead of = a reserved keyword<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 (whoops). -std=3Dc99 will disable any extension= s, -std=3Dgnu99 will keep<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 them.<br> <br> <br> =C2=A0 =C2=A0 So the actual fix should be to change that to __asm__, right?= <br> <br> =C2=A0 =C2=A0 --ryan.<br> <br> <br> <br> <br> =C2=A0 =C2=A0 ______________________________<wbr>_________________<br> =C2=A0 =C2=A0 SDL mailing list<br></span> =C2=A0 =C2=A0 <a href=3D"mailto:[email protected]" target=3D"_blank">SDL= @lists.libsdl.org</a> <mailto:<a href=3D"mailto:[email protected]" ta= rget=3D"_blank">[email protected]</a>><br> =C2=A0 =C2=A0 <a href=3D"http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.or= g" rel=3D"noreferrer" target=3D"_blank">http://lists.libsdl.org/listin<wbr>= fo.cgi/sdl-libsdl.org</a><span class=3D""><br> =C2=A0 =C2=A0 <<a href=3D"http://lists.libsdl.org/listinfo.cgi/sdl-libsd= l.org" rel=3D"noreferrer" target=3D"_blank">http://lists.libsdl.org/listi<w= br>nfo.cgi/sdl-libsdl.org</a>><br> <br> <br> <br> <br> --<br> <br> Pei JIA, Ph.D.<br> <br></span> Email: <a href=3D"mailto:[email protected]" target=3D"_blank">jp4work@gmail= .com</a> <mailto:<a href=3D"mailto:[email protected]" target=3D"_blank">= [email protected]</a>><span class=3D""><br> cell in Canada:=C2=A0 =C2=A0 <a href=3D"tel:%2B1%20778-863-5816" value=3D"+= 17788635816" target=3D"_blank">+1 778-863-5816</a><br> cell in China: <a href=3D"tel:%2B86%20186-8244-3503" value=3D"+861868244350= 3" target=3D"_blank">+86 186-8244-3503</a><br> <br> Welcome to Vision Open<br> <a href=3D"http://www.visionopen.com" rel=3D"noreferrer" target=3D"_blank">= http://www.visionopen.com</a><br> <br> <br></span><span class=3D""> ______________________________<wbr>_________________<br> SDL mailing list<br> <a href=3D"mailto:[email protected]" target=3D"_blank">[email protected].= org</a><br> <a href=3D"http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org" rel=3D"nore= ferrer" target=3D"_blank">http://lists.libsdl.org/listin<wbr>fo.cgi/sdl-lib= sdl.org</a><br> <br> </span></blockquote><div class=3D"HOEnZb"><div class=3D"h5"> <br> ______________________________<wbr>_________________<br> SDL mailing list<br> <a href=3D"mailto:[email protected]" target=3D"_blank">[email protected].= org</a><br> <a href=3D"http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org" rel=3D"nore= ferrer" target=3D"_blank">http://lists.libsdl.org/listin<wbr>fo.cgi/sdl-lib= sdl.org</a><br> </div></div></blockquote></div><br><br clear=3D"all"><div><br></div>-- <br>= <div class=3D"gmail_signature" data-smartmail=3D"gmail_signature"><div dir= =3D"ltr"><div><br></div><div>Pei JIA, Ph.D.</div><div><br></div><div>Email:= <a href=3D"mailto:[email protected]" target=3D"_blank">[email protected]</= a></div><div>cell in Canada: =C2=A0 =C2=A0+1 778-863-5816</div><div>cell in= China: +86 186-8244-3503</div><div><br></div>Welcome to Vision Open<br><a = href=3D"http://www.visionopen.com" target=3D"_blank">http://www.visionopen.= com</a></div></div> </div> --001a113cd9cc37e657054a290342-- --===============5378771353534419123== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ SDL mailing list [email protected] http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org --===============5378771353534419123==--