#18301: ncurses fails to build with GCC 5.x
----------------------------------+-------------------------------------
   Reporter:  leif                |            Owner:  leif
       Type:  defect              |           Status:  new
   Priority:  critical            |        Milestone:  sage-6.7
  Component:  packages: standard  |         Keywords:  syntax error, cpp
  Merged in:                      |          Authors:  Leif Leonhardy
  Reviewers:                      |  Report Upstream:  N/A
Work issues:                      |           Branch:
     Commit:                      |     Dependencies:
   Stopgaps:                      |
----------------------------------+-------------------------------------
 {{{
 ...
 gcc-5.1 -DHAVE_CONFIG_H -I../ncurses -I../../ncurses -I. -I../include
 -I../../ncurses/../include -I/foo/sage-6.6-gcc-5.1.0/local/include
 -D_GNU_SOURCE -DNDEBUG -O2 --param max-inline-insns-single=1200 -fPIC -c
 ../ncurses/lib_gen.c -o ../obj_s/lib_gen.o
 In file included from ../../ncurses/curses.priv.h:321:0,
                  from ../ncurses/lib_gen.c:19:
 _3081.c:837:15: error: expected ')' before 'int'
 ../include/curses.h:1622:56: note: in definition of macro 'mouse_trafo'
  #define mouse_trafo(y,x,to_screen) wmouse_trafo(stdscr,y,x,to_screen)
                                                         ^
 Makefile:1323: recipe for target '../obj_s/lib_gen.o' failed
 make[1]: *** [../obj_s/lib_gen.o] Error 1
 make[1]: Leaving directory '/tmp/sage-build-
 tmp/ncurses-5.9.20131221/src/narrow/ncurses'
 Makefile:111: recipe for target 'all' failed
 make: *** [all] Error 2
 Error building ncurses (narrow).
 }}}

 
(`build/pkgs/ncurses/patches/ncurses-5.9.20131221_work_around_broken_GNU_cpp_5.x.patch`,
 self-explanatory:)
 {{{
 #!patch
 Building ncurses with GCC 5.1 (or more precisely, with its 'cpp') fails
 with
 a syntax error, caused by earlier preprocessing.

 (I'm not entirely sure whether it's a GCC bug or rather caused by a new
 feature which breaks further processing with 'awk' and 'sed';  I *think*
 at least the 'awk' inline script "AW2" simply isn't prepared for the
 changed
 output of 'cpp' w.r.t. line directives [1].  Anyway, the patch fixes the
 issue.)

 [1] https://gcc.gnu.org/gcc-5/porting_to.html


 --- ncurses-5.9.20131221/ncurses/base/MKlib_gen.sh      2011-06-04
 21:14:08.000000000 +0200
 +++ ncurses-5.9.20131221/ncurses/base/MKlib_gen.sh      2015-04-26
 00:47:06.911680782 +0200
 @@ -62,7 +62,15 @@
  if test "${LC_CTYPE+set}"    = set; then LC_CTYPE=C;    export LC_CTYPE;
 fi
  if test "${LC_COLLATE+set}"  = set; then LC_COLLATE=C;  export
 LC_COLLATE;  fi

 -preprocessor="$1 -DNCURSES_INTERNALS -I../include"
 +# Work around "unexpected" output of GCC 5.1.0's cpp w.r.t. #line
 directives
 +# by simply suppressing them:
 +case `$1 -dumpversion 2>/dev/null` in
 +    5.[01].*)  # assume a "broken" one
 +        preprocessor="$1 -P -DNCURSES_INTERNALS -I../include"
 +        ;;
 +    *)
 +        preprocessor="$1 -DNCURSES_INTERNALS -I../include"
 +esac
  AWK="$2"
  USE="$3"

 }}}

--
Ticket URL: <http://trac.sagemath.org/ticket/18301>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica, 
and MATLAB

-- 
You received this message because you are subscribed to the Google Groups 
"sage-trac" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/d/optout.

Reply via email to