Rockbox Technical Forums

Rockbox Development => Starting Development and Compiling => Topic started by: ivi on March 31, 2016, 05:43:33 PM

Title: Building rockbox cross-toolchain with gcc 5.x: add -std=gnu89 to CFLAGS
Post by: ivi on March 31, 2016, 05:43:33 PM
Hi,

one of the changes in gcc 5 was in the way extern inline is handled with the new default GNU11 C standard (see https://gcc.gnu.org/gcc-5/porting_to.html), which in turn breaks the build of gcc 4.4.4.

In order to fix this, you can patch rockboxdev.sh in the following way to get back to the previously used GNU89 C standard, which will then allow you to successfully compile the cross gcc 4.4.4:

Code: [Select]
@@ -211,7 +211,7 @@
             ./configure --prefix=$prefix $configure_params
         ;;
         *)
-            CFLAGS=-U_FORTIFY_SOURCE ../$toolname-$version/configure --target=$target --prefix=$prefix --enable-languages=c --disable-libssp --disable-docs $configure_params
+            CFLAGS="-U_FORTIFY_SOURCE -std=gnu89" ../$toolname-$version/configure --target=$target --prefix=$prefix --enable-languages=c --disable-libssp --disable-docs $configure_params
         ;;
     esac

This should also not harm any older versions of gcc, so someone with commit rights could also apply this to git (I don't have a system available right now with older gcc's to test this, though).

Regards,
Ingmar
Title: Re: Building rockbox cross-toolchain with gcc 5.x: add -std=gnu89 to CFLAGS
Post by: [Saint] on April 01, 2016, 04:06:53 AM
Yeah, I should add all this to our Gerrit instance I suppose.

I have a tonne of environment related commits sitting in my local tree that I should really get merged upstream.

You've actually made me feel overwhelmingly lazy, because apparently I figured this out in at least October of 2015 (http://www.rockbox.org/irc/log-20150803#03:49:54) against gcc-4.9 (actually, lord only knows when I figured this out because at this point I apparently already had this in my local tree and knew it was an issue for modern gcc instances and what to do about it when another user hit the same issue - makes it somewhat worse I suppose...), we used slightly different approaches (-fgnu89-inline vs. -std=gnu89), but the end result is the same.


[Saint]
Title: Re: Building rockbox cross-toolchain with gcc 5.x: add -std=gnu89 to CFLAGS
Post by: jawsdaws on May 25, 2016, 11:03:28 AM
Thanks for this, ivi!  I had this error this morning.
Title: Re: Building rockbox cross-toolchain with gcc 5.x: add -std=gnu89 to CFLAGS
Post by: Massa on October 31, 2016, 07:22:47 AM
Has this been integrated in the sources meanwhile?
Or is this patch still needed?

If yes, which one of the two solutions is the better one?

[Edit]
I answer myself: the patch is still needed ???
(did no dev with commit access find time in the last six months to check this in? ::))
[/Edit]
Title: Re: Building rockbox cross-toolchain with gcc 5.x: add -std=gnu89 to CFLAGS
Post by: [Saint] on November 08, 2016, 08:41:41 PM
I'm guessing you're just building armeabi?


[Saint]
Title: Re: Building rockbox cross-toolchain with gcc 5.x: add -std=gnu89 to CFLAGS
Post by: Massa on November 09, 2016, 06:17:23 AM
Yes.

Why do you ask? Are there issues with this change for other platforms?
Title: Re: Building rockbox cross-toolchain with gcc 5.x: add -std=gnu89 to CFLAGS
Post by: [Saint] on November 09, 2016, 01:25:16 PM
Yes.

Why do you ask? Are there issues with this change for other platforms?


Yes.


[Saint]