Discussion:
Problem compiling 3.0.3/3.0.4 on NetBSD 1.6.1
(too old to reply)
Brad Everman
2004-02-27 06:50:44 UTC
Permalink
Having an issue compiling Angband 3.0.3 and 3.0.4 on a NetBSD 1.6.1
system. Get the following message regardless of what configure options I
use:

/angband-3.0.4-beta1/src/main-gcu.c:1030: undefined reference to
`can_change_color'

Some searching reveals an old problem with ncurses on some BSD systems,
but I can't find anything current.

Any ideas?
Joshua Rodman
2004-02-27 09:46:28 UTC
Permalink
Post by Brad Everman
Having an issue compiling Angband 3.0.3 and 3.0.4 on a NetBSD 1.6.1
system. Get the following message regardless of what configure options I
/angband-3.0.4-beta1/src/main-gcu.c:1030: undefined reference to
`can_change_color'
Hmm, Not sure if this is useful but it's certainly defined by ncurses:

color(3NCURSES) color(3NCURSES)

NAME
start_color, init_pair, init_color, has_colors, can_change_color,
color_content, pair_content,
COLOR_PAIR - curses color manipulation routines

SYNOPSIS
# include <curses.h>
int start_color(void);
[...]
bool can_change_color(void);
[...]
The routines has_colors and can_change_color return TRUE or FALSE,
depending on whether the terminal has color capabilities and whether the
programmer can change the colors.
[...]
The has_colors routine requires no arguments. It returns TRUE if the
terminal can manipulate colors; otherwise, it returns FALSE. This
routine facilitates writing terminal-independent pro- grams. For example, a
programmer can use it to decide whether to use color or some other video
attribute.

The can_change_color routine requires no arguments. It returns TRUE if the
terminal supports col- ors and can change their definitions; other, it
returns FALSE. This routine facilitates writing terminal-independent
programs.


Sadly, I don't know enough ncurses to know if these are totally
equivalent and if you can check for the other. Finding historical docs
unlikely to be tainted by any influence from my environment (Debian
Linux) are hard to find, especially with curses/ncurses devleopment
being so twisty.

If I assume the manpage to be vanilly, it seems like you don't have a
current generic dickey ncurses curses.h.

-josh
Robert Ruehlmann
2004-02-27 18:47:00 UTC
Permalink
Post by Brad Everman
Having an issue compiling Angband 3.0.3 and 3.0.4 on a NetBSD 1.6.1
system. Get the following message regardless of what configure options I
/angband-3.0.4-beta1/src/main-gcu.c:1030: undefined reference to
`can_change_color'
Some searching reveals an old problem with ncurses on some BSD systems,
but I can't find anything current.
Any ideas?
I'm not sure why your (n)curses library doesn't contain the
can_change_color() function. But you could try to just disable the
color-changing code by commenting out the "REDEFINE_COLORS" #define at the
beginning of 'src/main-gcu.c'. The game should compile and run fine then.

I'll try to add a check for that function to the configure script.
--
Robert Ruehlmann ( ***@thangorodrim.net )
"Thangorodrim - The Angband Page" : http://www.thangorodrim.net/
Visit the #angband chat channel at irc.worldirc.org
Brad Everman
2004-02-27 22:17:42 UTC
Permalink
Post by Robert Ruehlmann
I'm not sure why your (n)curses library doesn't contain the
can_change_color() function. But you could try to just disable the
color-changing code by commenting out the "REDEFINE_COLORS" #define at the
beginning of 'src/main-gcu.c'. The game should compile and run fine then.
I already did that and the code compiled fine...thanks. What does this
function do exactly? I am not very familiar with ncurses. As far as the
"bug" goes, you posted a fix for 2.9.3 on Thangordorim for almost the
exact same issue. I find it hard to believe the *BSD guys have yet to fix
a problem with their ncurses implementation...
Post by Robert Ruehlmann
I'll try to add a check for that function to the configure script.
Sweet. Maybe you can just have a configure option called --brokenBSD or
something.
Joshua Rodman
2004-02-28 00:54:48 UTC
Permalink
Post by Brad Everman
Post by Robert Ruehlmann
I'm not sure why your (n)curses library doesn't contain the
can_change_color() function. But you could try to just disable the
color-changing code by commenting out the "REDEFINE_COLORS" #define at the
beginning of 'src/main-gcu.c'. The game should compile and run fine then.
I already did that and the code compiled fine...thanks. What does this
function do exactly? I am not very familiar with ncurses. As far as the
"bug" goes, you posted a fix for 2.9.3 on Thangordorim for almost the
exact same issue. I find it hard to believe the *BSD guys have yet to fix
a problem with their ncurses implementation...
The docs say it's a test to determine if the 'definitions' of colors can
be changed. This is a prereq for using init_color() to change the color
defintions. It returns TRUE or FALSE depending upon your curses
capabilities. init_color() changes a given color entry to an RGB value.

By default there are eight standard colors (black, red, green, yellow,
blue, magenta, cyan, and white), and there may be up to N colors defined
by a global var COLORS. To change the colors from these defaults or to
set up colors beyond the basic 8, you need init_color(), the
functionality of which is tested for with can_change_color()

You could just try defining it as a macro:

#define can_change_color(x) TRUE

to see what happens.
-josh
Brad Everman
2004-02-28 21:37:24 UTC
Permalink
Post by Joshua Rodman
#define can_change_color(x) TRUE
to see what happens.
In the NetBSD group, I got the answer that can_change_colors() is
implemented in the standard ncurses for their distribution. I'm assuming
the extraneous s is the problem...
Brad Everman
2004-02-28 21:53:24 UTC
Permalink
Post by Brad Everman
In the NetBSD group, I got the answer that can_change_colors() is
implemented in the standard ncurses for their distribution. I'm assuming
the extraneous s is the problem...
Just to check it, I edited line 1030 in main-gcu.c to read:

can_fix_color = (can_use_color && can_change_colors() && ...

and it compiled just fine.

I've asked why the ncurses implementation has this misspelling, so I'll
wait and see what they say. I don't particularly think a broken lib is a
good thing.
Thomas Dickey
2004-02-29 20:30:17 UTC
Permalink
Post by Brad Everman
Post by Brad Everman
In the NetBSD group, I got the answer that can_change_colors() is
implemented in the standard ncurses for their distribution. I'm assuming
the extraneous s is the problem...
can_fix_color = (can_use_color && can_change_colors() && ...
and it compiled just fine.
I've asked why the ncurses implementation has this misspelling, so I'll
wait and see what they say. I don't particularly think a broken lib is a
good thing.
I answered the question: NetBSD doesn't provide ncurses. They have their
own version, using features from X/Open curses and ncurses. NetBSD's
curses has some bugs (the one you noticed). Reading the CVS last night,
it appears that while this bug was fixed, it's not yet in a release of
NetBSD.
--
Thomas E. Dickey
http://invisible-island.net
ftp://invisible-island.net
Continue reading on narkive:
Loading...