Kodi Community Forum
Kodi 19 & c++14/c++17 - Printable Version

+- Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Development (https://forum.kodi.tv/forumdisplay.php?fid=32)
+--- Forum: Kodi Application (https://forum.kodi.tv/forumdisplay.php?fid=93)
+--- Thread: Kodi 19 & c++14/c++17 (/showthread.php?tid=358086)



Kodi 19 & c++14/c++17 - bkuhls - 2020-10-31

Hi,

I am trying to build Kodi 19 master branch as of
https://github.com/xbmc/xbmc/commit/dd1e33fb5d4a8d0112fb84e8c309c58c359b55aa with gcc-4.9.1.

This fails
Quote:output/host/opt/ext-toolchain/aarch64-amd-linux-gnu/include/c++/4.9.1/ext/new_allocator.h: In instantiation of 'void __gnu_cxx::new_allocator<_Tp>::construct(_Up*, _Args&& ...) [with _Up = std::pair<std::basic_string<char>, ADDON::SExtValue>; _Args = {std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::basic_string<char, std::char_traits<char>, std::allocator<char> >}; _Tp = std::pair<std::basic_string<char>, ADDON::SExtValue>]':
...
output/build/kodi-efa9ec691491ea3311f8de36b16b665f188afef4/xbmc/addons/AddonDatabase.cpp:172:90:   required from here
output/host/opt/ext-toolchain/aarch64-amd-linux-gnu/include/c++/4.9.1/ext/new_allocator.h:120:4: error: no matching function for call to 'std::pair<std::basic_string<char>, ADDON::SExtValue>::pair(std::basic_string<char>, std::basic_string<char>)'
added with commit https://github.com/xbmc/xbmc/commit/fdc25921759c8d46ce7de127b9c8532c23f6ca5a#diff-ef367fa021459213afae7d8580fc4dd7545c2388327787986c7372c1624f1f94R171

Afaics c++14/gcc 4.9 is still the supported version
https://github.com/xbmc/xbmc/commit/642d8e154a00a2d58cbc5c243d2f2e5cdecda46b
but only until binary addons are fixed which got broken by switching to c++17
https://github.com/xbmc/xbmc/commit/098478702becaa0f2d385d882efa2143b1b9044d

The std::pair build error seems to be rooted in the fact that gcc-4.9 does not
support this code: https://stackoverflow.com/a/47284746

Is there a way to simplify the code that older gcc versions can still be supported
or is the project determined to drop support for gcc < 7.x in Kodi core?


RE: Kodi 19 & c++14/c++17 - wsnipex - 2020-10-31

You need full C++14 support: gcc >= 5


RE: Kodi 19 & c++14/c++17 - bkuhls - 2020-11-01

(2020-10-31, 23:29)wsnipex Wrote: You need full C++14 support: gcc >= 5
Later I tried with gcc 5.3, same error.
With gcc-6.3.0 kodi compiles while pvr.hts (PS: pvr.vdr.vnsi also affected) does not build with it
 
Code:
kodi-pvr-hts-8.0.0-Matrix/lib/kissnet/kissnet.hpp:416:28: error: ‘byte’ is not a member of ‘std’
  using buffer = std::array<std::byte, buff_size>;
due to c++17 code: https://stackoverflow.com/questions/56843413/stdbyte-is-not-member-of-std#comment100238422_56843413

Please do not consider this thread a complaint, I just would like to understand the minimum
requirements for kodi19 so I can adjust the buildroot packages I am preparing right now.
But of course, the lower the gcc version needed the more embedded platforms can still
make use of Kodi Wink


RE: Kodi 19 & c++14/c++17 - emveepee - 2020-11-01

Many PVR addons went to c++17 with the removal of the p8 platform.  I am not sure Kodi has the same requirement.

Martin


RE: Kodi 19 & c++14/c++17 - Fuzzard - 2020-11-06

We don't as of right now on master, but I believe the intention right now will be to go back to 17 as soon as we branch off matrix for release


RE: Kodi 19 & c++14/c++17 - yasij - 2020-12-09

(2020-10-31, 19:30)bkuhls Wrote: Hi,

I am trying to build Kodi 19 master branch as of
https://github.com/xbmc/xbmc/commit/dd1e33fb5d4a8d0112fb84e8c309c58c359b55aa with gcc-4.9.1.

This fails
Quote:output/host/opt/ext-toolchain/aarch64-amd-linux-gnu/include/c++/4.9.1/ext/new_allocator.h: In instantiation of 'void __gnu_cxx::new_allocator<_Tp>::construct(_Up*, _Args&& ...) [with _Up = std::pair<std::basic_string<char>, ADDON::SExtValue>; _Args = {std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::basic_string<char, std::char_traits<char>, std::allocator<char> >}; _Tp = std::pair<std::basic_string<char>, ADDON::SExtValue>]':
...
output/build/kodi-efa9ec691491ea3311f8de36b16b665f188afef4/xbmc/addons/AddonDatabase.cpp:172:90:   required from here
output/host/opt/ext-toolchain/aarch64-amd-linux-gnu/include/c++/4.9.1/ext/new_allocator.h:120:4: error: no matching function for call to 'std::pair<std::basic_string<char>, ADDON::SExtValue>::pair(std::basic_string<char>, std::basic_string<char>)'
added with commit https://github.com/xbmc/xbmc/commit/fdc25921759c8d46ce7de127b9c8532c23f6ca5a#diff-ef367fa021459213afae7d8580fc4dd7545c2388327787986c7372c1624f1f94R171

Afaics c++14/gcc 4.9 is still the supported version
https://github.com/xbmc/xbmc/commit/642d8e154a00a2d58cbc5c243d2f2e5cdecda46b
but only until binary addons are fixed which got broken by switching to c++17
https://github.com/xbmc/xbmc/commit/098478702becaa0f2d385d882efa2143b1b9044d

The std::pair build error seems to be rooted in the fact that gcc-4.9 does not
support this code: https://stackoverflow.com/a/47284746

Is there a way to simplify the code that older gcc versions can still be supported
or is the project determined to drop support for gcc < 7.x in Kodi core?
This should work:
- extValues.emplace_back((*content)["key"].asString(), (*content)["value"].asString());
+ extValues.emplace_back((*content)["key"].asString(), SExtValue{(*content)["value"].asString()});


RE: Kodi 19 & c++14/c++17 - bkuhls - 2020-12-09

(2020-12-09, 04:11)yasij Wrote: This should work:
- extValues.emplace_back((*content)["key"].asString(), (*content)["value"].asString());
+ extValues.emplace_back((*content)["key"].asString(), SExtValue{(*content)["value"].asString()});
This fixed the compile problem, thanks! But I need to do more steps before I can runtime-test your fix.


RE: Kodi 19 & c++14/c++17 - bkuhls - 2020-12-13

(2020-12-09, 04:11)yasij Wrote: This should work:
- extValues.emplace_back((*content)["key"].asString(), (*content)["value"].asString());
+ extValues.emplace_back((*content)["key"].asString(), SExtValue{(*content)["value"].asString()});
Hi,

thanks again, a runtime-test was positive, I just sent your patch upstream:
https://github.com/xbmc/xbmc/pull/18932

Also I was able to get pvr.hts working again with gcc-4.9 by reverting the
TCP socket patches: https://github.com/bkuhls/buildroot/commit/cccf6ec2cf7819f839724514c78e2614fe418b42
I know this will never be committed upstream but as long as this works
I will keep these patches in my private repo, so this is just FYI Wink