Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 30 Jan 2014 07:11:41 -0500 (EST)
From:      Chris Nehren <cnehren@pobox.com>
To:        FreeBSD-gnats-submit@freebsd.org
Subject:   ports/186272: Incorrect application of CPPFLAGS for games/angband causes build failure
Message-ID:  <20140130121141.12A0E624CB@b-sasl-quonix.pobox.com>
Resent-Message-ID: <201401301220.s0UCK0Av013078@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         186272
>Category:       ports
>Synopsis:       Incorrect application of CPPFLAGS for games/angband causes build failure
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Jan 30 12:20:00 UTC 2014
>Closed-Date:
>Last-Modified:
>Originator:     apeiron
>Release:        FreeBSD 9.2-RELEASE amd64
>Organization:
>Environment:
System: FreeBSD eschaton.local 9.2-RELEASE FreeBSD 9.2-RELEASE #0 r255898: Thu Sep 26 22:50:31 UTC 2013 root@bake.isc.freebsd.org:/usr/obj/usr/src/sys/GENERIC amd64

Latest ports tree as of this morning (2014-01-30 ~ 0700 GMT-0500)
>Description:

games/angband fails to find ncursesw headers with the current
ports Makefile because it instructs the compiler to look in
/usr/local/include/ncurses/ for header files, but the angband
code includes ncurses/ as a prefix in the header files for
ncurses. This means that it fails to find ncurses, resulting in
an empty array in main.c that breaks compilation.

Here's the configure output:

checking for ncursesw5-config... (cached) true
checking for ncurses - wide char support... no
*** Could not run ncurses test program, checking why...
*** The test program failed to compile or link. See the file config.log for the
*** exact error that occured. This usually means ncursesw was incorrectly
*** installed or that you have moved ncursesw since it was installed. In the
*** latter case, you may want to edit the ncursesw5-config script:
*** true
checking for mvwaddnwstr... yes
checking for use_default_colors... yes
checking for can_change_color... yes
configure: creating ./config.status
config.status: creating mk/buildsys.mk
config.status: creating mk/extra.mk
config.status: creating mk/sinclude.mk
config.status: creating src/autoconf.h

Configuration:

  Install path:                           /usr/local
  binary path:                            /usr/local/bin
  config path:                            /usr/local/etc/angband/
  lib path:                               /usr/local/share/angband/
  doc path:                               /usr/local/share/doc/angband/
  var path:                               (not used)
  (with private save and score files in ~/.angband/Angband/)

-- Frontends --
- Curses                                  No; missing libraries
[...]

Here's the build output:

gmake[3]: Entering directory `/usr/ports/games/angband/work/angband-v3.5.0/src'
cc -nostdlib -Wl,-r -o angband.o attack.o birth.o cave.o cmd-cave.o cmd-context.o cmd-know.o cmd-misc.o cmd-obj.o cmd-pickup.o cmd-process.o death.o debug.o dungeon.o effects.o files.o game-cmd.o game-event.o generate.o grafmode.o guid.o history.o init.o keymap.o load.o monster/mon-init.o monster/melee1.o monster/melee2.o monster/mon-list.o monster/mon-lore.o monster/mon-make.o monster/mon-msg.o monster/mon-power.o monster/mon-spell.o monster/mon-timed.o monster/mon-util.o object/chest.o object/identify.o object/obj-desc.o object/obj-flag.o object/obj-info.o object/obj-list.o object/obj-make.o object/obj-power.o object/obj-ui.o object/obj-util.o object/pval.o object/randart.o object/slays.o option.o parser.o randname.o pathfind.o prefs.o player/calcs.o player/class.o player/player.o player/race.o player/spell.o player/timed.o player/p-util.o quest.o score.o signals.o save.o savefile.o spells1.o spells2.o squelch.o store.o tables.o target.o trap.o ui.o ui-birth.o ui-event.o ui-knowled
 ge.o ui-menu.o ui-options.o ui-spell.o util.o variable.o wiz-spoil.o wiz-stats.o wizard.o x-spell.o xtra2.o xtra3.o borg/borg1.o borg/borg2.o borg/borg3.o borg/borg4.o borg/borg5.o borg/borg6.o borg/borg7.o borg/borg8.o borg/borg9.o buildid.o z-bitflag.o z-file.o z-form.o z-msg.o z-quark.o z-queue.o z-rand.o z-set.o z-term.o z-type.o z-util.o z-virt.o z-textblock.o
printf "Compiling main.c...\r"
gmake[3]: Nothing to be done for `locales'.
if cc -O2 -pipe -fno-omit-frame-pointer -fno-strict-aliasing -DHAVE_CONFIG_H -W -Wall -Wextra -Wno-unused-parameter -pedantic -Wno-missing-field-initializers -DBUILD_ID=v3.5.0 -I. -std=c99 -Wdeclaration-after-statement  -I/usr/local/include/ncurses -I. -c -o main.o main.c; then \
        printf "Successfully compiled main.c.\n"; \
else \
        err=$?; printf "Failed to compile main.c!\n"; exit $err; \
fi
main.c:64: warning: ISO C forbids empty initializer braces
main.c:43: error: zero or negative size array 'modules'
      LINK angband.o
Failed to compile main.c!
gmake[3]: *** [main.o] Error 1

Here's the offending section of main.c:

/*
 * List of the available modules in the order they are tried.
 */
static const struct module modules[] =
{
#ifdef USE_X11
        { "x11", help_x11, init_x11 },
#endif /* USE_X11 */

#ifdef USE_SDL
        { "sdl", help_sdl, init_sdl },
#endif /* USE_SDL */

#ifdef USE_GCU
        { "gcu", help_gcu, init_gcu },
#endif /* USE_GCU */

#ifdef USE_TEST
        { "test", help_test, init_test },
#endif /* !USE_TEST */

#ifdef USE_STATS
        { "stats", help_stats, init_stats },
#endif /* USE_STATS */
};

None of those macros is defined (USE_GCU is the one for ncurses)
so the array is empty and the build fails.

>How-To-Repeat:
Disable SDL and X11 options in games/angband, try to build.
>Fix:

The patch below fixes things for me.

--- Makefile	2014-01-30 06:54:59.000000000 -0500
+++ Makefile.fixed	2014-01-30 07:01:37.000000000 -0500
@@ -20,7 +20,6 @@
 CONFIGURE_ENV=	ac_cv_path_NCURSES_CONFIG=${TRUE}
 CONFIGURE_ARGS=	--localstatedir=/var
 
-CPPFLAGS+=	-I${NCURSESINC}
 LDFLAGS+=	-L${NCURSESLIB} -lncursesw
 
 SDL_USE=		SDL=image,mixer,ttf,sdl
>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20140130121141.12A0E624CB>