<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Ubuntu touch: different compiling behaviour with different GCC versions]]></title><description><![CDATA[<p dir="auto">Hi,<br />
I found a strange behaviour of GCC. In few words, I can successfully compile with GCC 5 or GCC 4 while I cannot compile with GCC 6.<br />
From GCC manual: In GCC 6 the default mode for C++ is now -std=gnu++14 instead of -std=gnu++98 while GCC 5 the default mode for C is now -std=gnu11 instead of -std=gnu89.<br />
I think that using c++14 causes different behaviour with the same code with respect to previous GCC versions.<br />
I found the source of problem at least for one error during compiling with GCC 6:<br />
[CODE]system/core/adb/transport.c:807:9: error: this ‘if’ clause does not guard... [-Werror=misleading-indentation]  if (error_out)[/CODE]<br />
is detected by GCC 6 thank to a new warning -Wmisleading-indentation added to -Wall option <a href="https://gcc.gnu.org/gcc-6/porting_to.html" rel="nofollow ugc">https://gcc.gnu.org/gcc-6/porting_to.html</a> while is not detected by GCC 5 or lower version.<br />
The current source code:<br />
[CODE]<br />
if (error_out)<br />
<em>error_out = "insufficient permissions for device";<br />
continue;<br />
[/CODE]<br />
it should be:<br />
[CODE]<br />
if (error_out)<br />
{<br />
<em>error_out = "insufficient permissions for device";<br />
}<br />
continue;[/CODE]<br />
with brackets for a better clearness <a href="https://stackoverflow.com/questions/2125066/is-it-bad-practice-to-use-an-if-statement-without-brackets#2125207" rel="nofollow ugc">https://stackoverflow.com/questions/2125066/is-it-bad-practice-to-use-an-if-statement-without-brackets#2125207</a><br />
After that I corrected this small error, another error appears related to invalid type conversion from const uint16_t</em> to const char16_t</em>:<br />
[CODE]<br />
frameworks/base/libs/androidfw/AssetManager.cpp: In member function ‘android::String8 android::AssetManager::getPkgName(const char*)’:<br />
frameworks/base/libs/androidfw/AssetManager.cpp:480:63: error: invalid conversion from ‘const char16_t*’ to ‘const uint16_t* {aka const short unsigned int*}’ [-fpermissive]<br />
const uint16_t* str = tree.getAttributeStringValue(idx, &amp;len);<br />
~~~~~~~~~~~~~~~~~~<s><s><s><s><s>^</s></s></s></s></s><br />
frameworks/base/libs/androidfw/AssetManager.cpp:481:46: error: invalid conversion from ‘const uint16_t* {aka const short unsigned int*}’ to ‘const char16_t*’ [-fpermissive]<br />
pkgName = (str ? String8(str, len) : String8());<br />
^<br />
In file included from frameworks/base/include/androidfw/Asset.h:30:0,<br />
from frameworks/base/libs/androidfw/AssetManager.cpp:26:<br />
system/core/include/utils/String8.h:56:33: note:   initializing argument 1 of ‘android::String8::String8(const char16_t*, size_t)’<br />
explicit                    String8(const char16_t* o, size_t numChars);</p>
<p dir="auto">[/CODE]<br />
In this case the error is related to android utils library android::String8 which uses different return type. So, I think that such problem should be not related to ubuntu touch, but to general android and CM. Is there a way to compile android or CM with GCC 6?<br />
I search on the web about this behaviour without success.</p>
<p dir="auto">Thank you</p>
]]></description><link>https://forums.ubports.com/topic/115/ubuntu-touch-different-compiling-behaviour-with-different-gcc-versions</link><generator>RSS for Node</generator><lastBuildDate>Mon, 20 Apr 2026 19:07:09 GMT</lastBuildDate><atom:link href="https://forums.ubports.com/topic/115.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 07 Dec 2016 15:19:27 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Ubuntu touch: different compiling behaviour with different GCC versions on Sat, 10 Dec 2016 19:05:04 GMT]]></title><description><![CDATA[<p dir="auto">I corrected all the errors: one was located in file system/core/adb/transport.c, another one in frameworks/base/libs/androidfw/AssetManager.cpp and the other four were located in file frameworks/base/libs/androidfw/ResourceType.cpp. Now I can compile with GCC 4,5,6. In few words, since c++11 has been introduced the type char16_t and GCC 6 supports -std=gnu++14 instead of -std=gnu++98. So since all the warnings are considered as errors due to -Werror a cast from const uint16_t* to const char16_t* solved all the problems. I do not why android developers did not change this.<br />
I filed a bug to CM, in particular the involved version is 12.1 aka android 5.1.</p>
]]></description><link>https://forums.ubports.com/post/503</link><guid isPermaLink="true">https://forums.ubports.com/post/503</guid><dc:creator><![CDATA[erotavlas]]></dc:creator><pubDate>Sat, 10 Dec 2016 19:05:04 GMT</pubDate></item></channel></rss>