11.0-CURRENT -r276514's ncurses .vs gcc5-based buildworld: the generated lib_gen.c has problems

Mark Millard markmi at dsl-only.net
Sun Mar 22 06:50:54 UTC 2015


Basic context (more details later):

I ran into the below while exploring FreeBSD via a powerpc64 context. But unlike most things I've run into this is probably not powerpc64 (or powerpc) context specific. Nor does it appear to be as simple as the out-of-order and/or incomplete includes issue that I ran into.

gcc5 use is not likely where anyone is focused either.

Still I figured I'd send out this note about the oddity as a FYI.

> # dmesg | head
> ...
> FreeBSD 11.0-CURRENT #1 r279514M: Sat Mar 21 05:15:23 PDT 2015
>     root at FBSDG5C0:/usr/obj/usr/srcC/sys/GENERIC64vtsc-NODEBUG powerpc
> gcc version 4.9.1 (FreeBSD Ports Collection for powerpc64) 
> ...

(I used powerpc64-xtoolchain-gcc in a powerpc64 context to self-host, WITHOUT_CLANG= WITHOUT_LLDB= WITHOUT_GCC= WITHOUT_GNUCXX= WITHOUT_BOOT= WITHOUT_LIB32= .)

> # freebsd-version -ku; uname -apKU                                                                                                                                                                      11.0-CURRENT
> 11.0-CURRENT
> FreeBSD FBSDG5C0 11.0-CURRENT FreeBSD 11.0-CURRENT #1 r279514M: Sat Mar 21 05:15:23 PDT 2015     root at FBSDG5C0:/usr/obj/usr/srcC/sys/GENERIC64vtsc-NODEBUG  powerpc powerpc64 1100062 1100062


> make -j 8 \
> WITHOUT_CLANG_BOOTSTRAP= WITHOUT_CLANG= WITHOUT_CLANG_IS_CC= \
> WITHOUT_LLDB= \
> WITH_GCC_BOOTSTRAP= WITH_GCC= WITHOUT_GNUCXX= \
> WITH_BOOT= WITH_LIB32= \
> buildworld buildkernel \
> KERNCONF=GENERIC64vtsc-NODEBUG
> TARGET=powerpc TARGET_ARCH=powerpc64


For the context set by the following in order to use gcc5/g++5/... :

> # more /etc/src.conf 
> NO_WERROR=
> WITH_LIBCPLUSPLUS=
> #
> #
> # For trying gcc5...
> #
> CC=/usr/local/bin/gcc5
> CXX=/usr/local/bin/g++5
> CPP=/usr/local/bin/cpp5
> AS=/usr/local/powerpc64-portbld-freebsd11.0/bin/as
> R=/usr/local/powerpc64-portbld-freebsd11.0/bin/ar
> LD=/usr/local/powerpc64-portbld-freebsd11.0/bin/ld
> NM=/usr/local/powerpc64-portbld-freebsd11.0/bin/nm
> OBJCOPY=/usr/local/powerpc64-portbld-freebsd11.0/bin/objcopy
> OBJDUMP=/usr/local/powerpc64-portbld-freebsd11.0/bin/objdump
> RANLIB=/usr/local/powerpc64-portbld-freebsd11.0/bin/ranlib
> SIZE=/usr/local/powerpc64-portbld-freebsd11.0/bin/size
> STRINGS=/usr/local/powerpc64-portbld-freebsd11.0/bin/strings





The problem when gcc5 was used:

> /usr/local/bin/gcc5  -O2 -pipe   -I. -I/usr/obj/usr/srcC/lib/ncurses/ncurses/../ncurses -I/usr/srcC/lib/ncurses/ncurses/../ncurses -I/usr/srcC/lib/ncurses/ncurses/../ncurses -I/usr/srcC/lib/ncurses/ncurses/../../../contrib/ncurses/include -I/usr/srcC/lib/ncurses/ncurses/../../../contrib/ncurses/ncurses -Wall -DNDEBUG -DHAVE_CONFIG_H -DFREEBSD_NATIVE -DTERMIOS -std=gnu99 -fstack-protector -Wsystem-headers -Wall -Wno-format-y2k -W -Wno-unused-parameter -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wno-uninitialized -Wno-pointer-sign   -c lib_gen.c -o lib_gen.o

> _2624.c:754:3: error: "_Bool" after # is not a positive integer
> In file included from /usr/srcC/lib/ncurses/ncurses/../../../contrib/ncurses/ncurses/curses.priv.h:313:0,
>                  from lib_gen.c:19:
> _2624.c:755:2: error: expected ')' before 'int'
> *** Error code 1
> 
> Stop.
> make[4]: stopped in /usr/srcC/lib/ncurses/ncurses
> *** Error code 1

Comparing the tail of the generated lib_gen.c from another 11.0-CURRENT (non-gcc5) tree that I have around...

First the tail from that other tree (the normal one):

> # tail -20 lib_gen.c | more
>         T((T_CALLED("getmaxy(%p)"), (const void *)z)); returnCode(((z) ? ((z)->_maxy + 1) : (-1)));
> }
> 
> 
> NCURSES_EXPORT(int) (getparx) (const WINDOW * z)
> {
>         T((T_CALLED("getparx(%p)"), (const void *)z)); returnCode(((z) ? (z)->_parx : (-1)));
> }
> 
> 
> NCURSES_EXPORT(int) (getpary) (const WINDOW * z)
> {
>         T((T_CALLED("getpary(%p)"), (const void *)z)); returnCode(((z) ? (z)->_pary : (-1)));
> }
> 
> 
> NCURSES_EXPORT(NCURSES_BOOL) (mouse_trafo) (int * a1, int * a2, NCURSES_BOOL z)
> {
>         T((T_CALLED("mouse_trafo(%p,%p,%#lx)"), (const void *)a1, (const void *)a2, (long)z)); returnBool(wmouse_trafo(stdscr,a1,a2,z));
> }

Then the tail for the generated file from the gcc5 based tree (the odd one):

> # tail -20 lib_gen.c
> 
> 
> NCURSES_EXPORT(int) (getpary) (const WINDOW * z)
> {
> 	T((T_CALLED("getpary(%p)"), (const void *)z)); returnCode(((z) ? (z)->_pary : (-1)));
> }
> 
> 
> 
> # 753 "_2624.c" 3 4
> NCURSES_BOOL 
> # 753 "_2624.c"
>  mouse_trafo (int * a1, int * a2, 
> # 753 "_2624.c" 3 4
>  NCURSES_BOOL 
> # 753 "_2624.c"
>  z)
> {
> 	T((T_CALLED("mouse_trafo(%p,%p,%#lx)"), (const void *)a1, (const void *)a2, (long)z)); returnBool(wmouse_trafo(stdscr,a1,a2,z));
> }




Context details:

# more /etc/make.conf
WRKDIRPREFIX=/usr/obj/portswork
#WITH_DEBUG=
MALLOC_PRODUCTION=

# svnlite info /usr/srcC/
Path: /usr/srcC
Working Copy Root Path: /usr/srcC
URL: https://svn0.us-west.freebsd.org/base/head
Relative URL: ^/head
Repository Root: https://svn0.us-west.freebsd.org/base
Repository UUID: ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Revision: 279514
Node Kind: directory
Schedule: normal
Last Changed Author: adrian
Last Changed Rev: 279514
Last Changed Date: 2015-03-01 18:27:25 -0800 (Sun, 01 Mar 2015)

# svnlite info /usr/ports/lang/gcc5
Path: /usr/ports/lang/gcc5
Working Copy Root Path: /usr/ports
URL: https://svn0.us-west.freebsd.org/ports/head/lang/gcc5
Relative URL: ^/head/lang/gcc5
Repository Root: https://svn0.us-west.freebsd.org/ports
Repository UUID: 35697150-7ecd-e111-bb59-0022644237b5
Revision: 381120
Node Kind: directory
Schedule: normal
Last Changed Author: gerald
Last Changed Rev: 380943
Last Changed Date: 2015-03-10 10:00:25 -0700 (Tue, 10 Mar 2015)

===
Mark Millard
markmi at dsl-only.net



More information about the freebsd-toolchain mailing list