Closed andrew87me closed 8 years ago
Thanks a lot. It works! I used it for ncurses-5.9. Just two comments: 1) The link to the patch is down 2) The numbering has changed (about minus 20) and I had to change it by hand
This works for me too. Thanks so much.
Link above was incorrect for me I found it by copying the text and not using the shortcut https://github.com/chef/omnibus-software/blob/master/config/patches/ncurses/ncurses-5.9-gcc-5.patch
I touched a file in ~/buildroot/package/ncurses/ncurses-5.9-gcc-5.patch then pasted the text from the link in it and saved. Compiled cleanly.
Thanks! Finding this page saved me a lot of time. I'm trying to recompile an old Buildroot archive of the kernel we use in our product, and this patch helped me deal with this bit rot in ncurses.
thank you very much! This patch saved me a lot of time!
This helped me to compile ncurses 5.9 with --with-versioned-syms on our rhel machines to run swift without warnings
In case it's helpful to anyone else who is trying to build ncurses 5.9 and comes across this page...I needed to make a few more modifications on my Ubuntu 24.04 system to build successfully. Here's a script that incorporates the patches I needed to make:
#!/bin/bash
cd /tmp
git clone --branch v5.9 --single-branch https://github.com/mirror/ncurses.git
cat <<'EOF' > ncurses-5.9-gcc-5.patch
--- a/ncurses/base/MKlib_gen.sh
+++ b/ncurses/base/MKlib_gen.sh
@@ -437,11 +437,25 @@
-e 's/gen_$//' \
-e 's/ / /g' >>$TMP
+cat >$ED1 <<EOF
+s/ / /g
+s/^ //
+s/ $//
+s/P_NCURSES_BOOL/NCURSES_BOOL/g
+EOF
+
+# A patch discussed here:
+# https://gcc.gnu.org/ml/gcc-patches/2014-06/msg02185.html
+# introduces spurious #line markers. Work around that by ignoring the system's
+# attempt to define "bool" and using our own symbol here.
+sed -e 's/bool/P_NCURSES_BOOL/g' $TMP > $ED2
+cat $ED2 >$TMP
+
$preprocessor $TMP 2>/dev/null \
+| sed -f $ED1 \
+| $AWK -f $AW2 \
+| sed -f $ED3 \
| sed \
- -e 's/ / /g' \
- -e 's/^ //' \
- -e 's/_Bool/NCURSES_BOOL/g' \
| $AWK -f $AW2 \
| sed -f $ED3 \
| sed \
EOF
cat <<'EOF' > ncurses-5.9-const.patch
--- a/c++/cursesf.h
+++ b/c++/cursesf.h
@@ -381,7 +381,7 @@
uptr->m_user = user;
}
- inline void *get_user() {
+ inline void *get_user() const {
UserHook* uptr = reinterpret_cast<UserHook*>(::form_userptr (form));
assert (uptr != 0 && uptr->m_back==this && uptr->m_owner==form);
return uptr->m_user;
--- a/c++/cursesm.h
+++ b/c++/cursesm.h
@@ -242,7 +242,7 @@
uptr->m_user = user;
}
- inline void *get_user() {
+ inline void *get_user() const {
UserHook* uptr = STATIC_CAST(UserHook*)(::menu_userptr (menu));
assert (uptr != 0 && uptr->m_back==this && uptr->m_owner==menu);
return uptr->m_user;
--- a/c++/cursesp.h
+++ b/c++/cursesp.h
@@ -58,7 +58,7 @@
const PANEL* m_owner; // the panel itself
} UserHook;
- inline UserHook *UserPointer()
+ inline UserHook *UserPointer() const
{
UserHook* uptr = reinterpret_cast<UserHook*>(
const_cast<void *>(::panel_userptr (p)));
@@ -77,7 +77,7 @@
}
// Set the user pointer of the panel.
- void *get_user()
+ void *get_user() const
{
UserHook* uptr = UserPointer();
void *result = 0;
EOF
cd ncurses
patch -p1 < ../ncurses-5.9-gcc-5.patch
patch -p1 < ../ncurses-5.9-const.patch
./configure CXXFLAGS="-std=c++11" --with-shared --without-normal --without-debug --with-termlib
make
sudo make install
Maybe I wasn't able to change default compiler (using 5.x instad 4.9.x) , so I get this output at compilation time:
But I solved this error by applying the patch found https://github.com/chef/omnibus-software/blob/master/config/patches/ncurses/ncurses-5.9-gcc-5.patch
It was simple, just edit the this file: (buildroot-path)/buildroot-2015.05/output/build/host-ncurses-5.9/ncurses/base/MKlib_gen.sh
With the following modifications:
I hope this will help anyone could have the same problem.