pbouda / buildroot-qt-dev

A Buildroot config to build an environment for Qt5 development on embedded systems.
GNU General Public License v3.0
63 stars 24 forks source link

SOLVED - Error while compiling ncurses #6

Closed andrew87me closed 7 years ago

andrew87me commented 8 years ago

Maybe I wasn't able to change default compiler (using 5.x instad 4.9.x) , so I get this output at compilation time:

In file included from ../ncurses/curses.priv.h:283:0, from ../ncurses/lib_gen.c:19: _18606.c:835:15: error: expected ‘)’ before ‘int’ ../include/curses.h:1594:56: note: in definition of macro ‘mouse_trafo’

define mouse_trafo(y,x,to_screen) wmouse_trafo(stdscr,y,x,to_screen)

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:

--- a/ncurses/base/MKlib_gen.sh
+++ b/ncurses/base/MKlib_gen.sh
@@ -474,11 +474,22 @@ sed -n -f $ED1 \
    -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 \
-   -e 's/  / /g' \
-   -e 's/^ //' \
-   -e 's/_Bool/NCURSES_BOOL/g' \
+| sed -f $ED1 \
 | $AWK -f $AW2 \
 | sed -f $ED3 \
 | sed \

I hope this will help anyone could have the same problem.

companion-vu commented 7 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

sameerag commented 6 years ago

This works for me too. Thanks so much.

warhawk-avg commented 6 years ago

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.

Krellan commented 5 years ago

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.

FraLaz1971 commented 4 years ago

thank you very much! This patch saved me a lot of time!

pardeike commented 1 year ago

This helped me to compile ncurses 5.9 with --with-versioned-syms on our rhel machines to run swift without warnings

michaelstepner commented 2 months ago

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