ncmpc: fix build with some old toolchains
PATCH 1/1 ncmpc: fix build with some old toolchains
With some "old" toolchains (glibc, uclibc in version 4.9.4, 5.3, 5.4, 5.5 ...), the following error is raised by the compiler:
../src/screen.cxx:60:29: required from here/usr/lfs/v0/rc-buildroot-test/scripts/instance-1/output/host/opt/ext-toolchain/mips-linux-gnu/include/c++/5.3.0/ext/new_allocator.h:120:4:
error: no matching function for call to 'std::pair<const screen_functions* const, std::unique_ptr<Page> >::pair(const screen_functions*, Page*)'
[...]
/usr/lfs/v0/rc-buildroot-test/scripts/instance-1/output/host/opt/ext-toolchain/mips-linux-gnu/include/c++/5.3.0/bits/stl_pair.h:112:26:
note: candidate: constexpr std::pair<_T1, _T2>::pair(const _T1&, const _T2&) [with _T1 = const screen_functions* const; _T2 = std::unique_ptr<Page>]
_GLIBCXX_CONSTEXPR pair(const _T1& __a, const _T2& __b)
^/usr/lfs/v0/rc-buildroot-test/scripts/instance-1/output/host/opt/ext-toolchain/mips-linux-gnu/include/c++/5.3.0/bits/stl_pair.h:112:26:
note: no known conversion for argument 2 from 'Page*' to 'const std::unique_ptr<Page>&'
This is due to the fact that init function of screen_functions structure returns Page* but PageMap wants a std::unique_ptr<Page>
To fix this, cast raw pointer into a unique_ptr with an explicit cast
Fixes:
- http://autobuild.buildroot.net/results/d8a7339d8bdd5cdc6bd1716585d4bcf15a2e8015
--- ...unique_ptr-error-with-some-old-toolchains.patch | 54 ++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 package/ncmpc/0001-Fix-unique_ptr-error-with-some-old-toolchains.patch
package/ncmpc/0001-Fix-unique_ptr-error-with-some-old-toolchains.patch new file +54 -0
@@ -0,0 +1,54 @@ +From 63c0c47106007f7b2a791e3e4b062a5424d3dfe8 Mon Sep 17 00:00:00 2001 +From: Fabrice Fontaine <[email protected]> +Date: Sun, 12 Aug 2018 09:02:50 +0200 +Subject: [PATCH] Fix unique_ptr error with some old toolchains + +With some "old" toolchains (glibc, uclibc in version 4.9.4, 5.3, 5.4, +5.5 ...), the following error is raised by the compiler: + +../src/screen.cxx:60:29: required from here +/usr/lfs/v0/rc-buildroot-test/scripts/instance-1/output/host/opt/ext-toolchain/mips-linux-gnu/include/c++/5.3.0/ext/new_allocator.h:120:4: +error: no matching function for call to 'std::pair<const screen_functions* const, std::unique_ptr<Page> >::pair(const screen_functions*, Page*)' + +[...] + +/usr/lfs/v0/rc-buildroot-test/scripts/instance-1/output/host/opt/ext-toolchain/mips-linux-gnu/include/c++/5.3.0/bits/stl_pair.h:112:26: +note: candidate: constexpr std::pair<_T1, _T2>::pair(const _T1&, const _T2&) [with _T1 = const screen_functions* const; _T2 = std::unique_ptr<Page>] + _GLIBCXX_CONSTEXPR pair(const _T1& __a, const _T2& __b) + ^ +/usr/lfs/v0/rc-buildroot-test/scripts/instance-1/output/host/opt/ext-toolchain/mips-linux-gnu/include/c++/5.3.0/bits/stl_pair.h:112:26: +note: no known conversion for argument 2 from 'Page*' to 'const +std::unique_ptr<Page>&' + +This is due to the fact that init function of screen_functions +structure returns Page* but PageMap wants a std::unique_ptr<Page> + +To fix this, cast raw pointer into a unique_ptr with an explicit cast + +Fixes: + - http://autobuild.buildroot.net/results/d8a7339d8bdd5cdc6bd1716585d4bcf15a2e8015 + +Signed-off-by: Fabrice Fontaine <[email protected]> +--- + src/screen.cxx | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +diff --git a/src/screen.cxx b/src/screen.cxx +index dd42b25..56afd11 100644 +--- a/src/screen.cxx ++++ b/src/screen.cxx +@@ -56,8 +56,9 @@ ScreenManager::MakePage(const struct screen_functions &sf) + return i; + + auto j = pages.emplace(&sf, +- sf.init(*this, main_window.w, +- main_window.size)); ++ std::unique_ptr<Page>(sf.init(*this, ++ main_window.w, ++ main_window.size))); + assert(j.second); + return j.first; + } +-- +2.14.1 +
Signature · 1 line
2.14.1
PATCH 1/1 ncmpc: fix build with some old toolchains
Hello,
Quoted 21 lines · Fabrice Fontaine
With some "old" toolchains (glibc, uclibc in version 4.9.4, 5.3, 5.4, 5.5 ...), the following error is raised by the compiler:
../src/screen.cxx:60:29: required from here
/usr/lfs/v0/rc-buildroot-test/scripts/instance-1/output/host/opt/ext-toolchain/mips-linux-gnu/include/c++/5.3.0/ext/new_allocator.h:120:4:
error: no matching function for call to 'std::pair<const screen_functions* const, std::unique_ptr<Page> >::pair(const screen_functions*, Page*)'[...]
/usr/lfs/v0/rc-buildroot-test/scripts/instance-1/output/host/opt/ext-toolchain/mips-linux-gnu/include/c++/5.3.0/bits/stl_pair.h:112:26:
note: candidate: constexpr std::pair<_T1, _T2>::pair(const _T1&, const _T2&) [with_T1= const screen_functions* const;_T2= std::unique_ptr<Page>]_GLIBCXX_CONSTEXPR pair(const _T1& __a, const _T2& __b) ^
/usr/lfs/v0/rc-buildroot-test/scripts/instance-1/output/host/opt/ext-toolchain/mips-linux-gnu/include/c++/5.3.0/bits/stl_pair.h:112:26:
note: no known conversion for argument 2 from 'Page*' to 'const std::unique_ptr<Page>&'This is due to the fact that init function of
screen_functionsstructure returns Page* but PageMap wants a std::unique_ptr<Page>To fix this, cast raw pointer into a
unique_ptrwith an explicit cast
Quoted 8 lines
Fixes:
- http://autobuild.buildroot.net/results/d8a7339d8bdd5cdc6bd1716585d4bcf15a2e8015Signed-off-by Fabrice Fontaine <[email protected]>--- ...unique_ptr-error-with-some-old-toolchains.patch | 54 ++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 package/ncmpc/0001-Fix-unique_ptr-error-with-some-old-toolchains.patch
To be honest, I don't have enough C++ knowledge to figure out if this is the right fix, but I've applied to master anyway. Please submit upstream to get a proper review. Thanks!
Best regards,
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin (formerly Free Electrons) Embedded Linux and Kernel engineering https://bootlin.com
PATCH 1/1 ncmpc: fix build with some old toolchains
Dear Thomas,
2018-08-12 14:32 GMT+02:00 Thomas Petazzoni <[email protected]>:
Quoted 42 lines
Hello,
Quoted 5 lines · Fabrice Fontaine
With some "old" toolchains (glibc, uclibc in version 4.9.4, 5.3, 5.4, 5.5 ...), the following error is raised by the compiler:
../src/screen.cxx:60:29: required from here
/usr/lfs/v0/rc-buildroot-test/scripts/instance-1/output/host/opt/ext-toolchain/mips-linux-gnu/include/c++/5.3.0/
ext/new_allocator.h:120:4:Quoted 1 line
error: no matching function for call to 'std::pair<const
screen_functions* const, std::unique_ptr<Page> >::pair(const screen_functions*, Page*)'
Quoted 4 lines
[...]
/usr/lfs/v0/rc-buildroot-test/scripts/instance-1/output/host/opt/ext-toolchain/mips-linux-gnu/include/c++/5.3.0/
bits/stl_pair.h:112:26:Quoted 1 line
note: candidate: constexpr std::pair<_T1, _T2>::pair(const _T1&, const
_T2&) [with
_T1= const screen_functions* const;_T2= std::unique_ptr<Page>]Quoted 3 lines
_GLIBCXX_CONSTEXPR pair(const _T1& __a, const _T2& __b) ^
/usr/lfs/v0/rc-buildroot-test/scripts/instance-1/output/host/opt/ext-toolchain/mips-linux-gnu/include/c++/5.3.0/
bits/stl_pair.h:112:26:Quoted 1 line
note: no known conversion for argument 2 from 'Page*' to 'const
std::unique_ptr<Page>&'
Quoted 8 lines
This is due to the fact that init function of
screen_functionsstructure returns Page* but PageMap wants a std::unique_ptr<Page>To fix this, cast raw pointer into a
unique_ptrwith an explicit castFixes:
- http://autobuild.buildroot.net/results/d8a7339d8bdd5cdc6bd1716585d4bc
f15a2e8015Quoted 4 lines
Signed-off-by Fabrice Fontaine <[email protected]>--- ...unique_ptr-error-with-some-old-toolchains.patch | 54
Quoted 9 lines
++++++++++++++++++++++
Quoted 2 lines
1 file changed, 54 insertions(+) create mode 100644 package/ncmpc/0001-Fix-unique_ptr-error-with-some-old-toolchains.patch
To be honest, I don't have enough C++ knowledge to figure out if this is the right fix, but I've applied to master anyway. Please submit upstream to get a proper review. Thanks!
I sent it upstream (https://github.com/MusicPlayerDaemon/ncmpc/pull/29) but the PR has been closed :-/
Quoted 8 lines
Best regards,
Thomas
--
Thomas Petazzoni, CTO, Bootlin (formerly Free Electrons) Embedded Linux and Kernel engineering
https://bootlin.com
Best Regards,
Fabrice
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20180812/727f14de/attachment.html>
PATCH 1/1 ncmpc: fix build with some old toolchains
Hello,
Quoted 6 lines · Fabrice Fontaine
Quoted 4 lines
To be honest, I don't have enough C++ knowledge to figure out if this is the right fix, but I've applied to master anyway. Please submit upstream to get a proper review. Thanks!
I sent it upstream (https://github.com/MusicPlayerDaemon/ncmpc/pull/29) but the PR has been closed :-/
Considering upstream's reaction, perhaps we should drop the patch, and add the appropriate BR2_TOOLCHAIN_HAS_GCC_AT_LEAST_... dependency ?
Thanks!
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin (formerly Free Electrons) Embedded Linux and Kernel engineering https://bootlin.com
PATCH 1/1 ncmpc: fix build with some old toolchains
Dear Thomas,
2018-08-12 16:01 GMT+02:00 Thomas Petazzoni <[email protected]>:
Quoted 8 lines
Hello,
Quoted 4 lines · Fabrice Fontaine
Quoted 4 lines
To be honest, I don't have enough C++ knowledge to figure out if this is the right fix, but I've applied to master anyway. Please submit upstream to get a proper review. Thanks!
Quoted 7 lines
Quoted 1 line
I sent it upstream (https://github.com/MusicPlayerDaemon/ncmpc/pull/29)
but
Quoted 1 line
the PR has been closed :-/
Considering upstream's reaction, perhaps we should drop the patch, and add the appropriate
BR2_TOOLCHAIN_HAS_GCC_AT_LEAST_... dependency ?
Indeed, you're right. I will send a new patch to add a dependency to gcc
Quoted 11 lines
= 5.6.
Thanks!
Thomas
--
Thomas Petazzoni, CTO, Bootlin (formerly Free Electrons) Embedded Linux and Kernel engineering
https://bootlin.com
Best Regards,
Fabrice
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20180812/bcbbd526/attachment.html>