Subject: pkg/33094: comms/minicom build failure on MacOS X 10.4.5
To: None <pkg-manager@netbsd.org, gnats-admin@netbsd.org,>
From: None <jdbaker@mylinuxisp.com>
List: pkgsrc-bugs
Date: 03/17/2006 10:25:01
>Number: 33094
>Category: pkg
>Synopsis: comms/minicom build failure on MacOS X 10.4.5
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: pkg-manager
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Fri Mar 17 10:25:01 +0000 2006
>Originator: John D. Baker
>Release: MacOS X 10.4.5, pkgsrc-current
>Organization:
>Environment:
Darwin pm8500.local 8.5.0 Darwin Kernel Version 8.5.0: Sun Jan 22 10:38:46 PST 2006; root:xnu-792.6.61.obj~1/RELEASE_PPC Power Macintosh powerpc
>Description:
Build of comms/minicom on MacOS X 10.4.5 with XCode 2.2/GCC4.0.1 fails
as follows:
gcc -pipe -DHAVE_CONFIG_H -I. -I. -I.. -no-cpp-precomp -I/usr/pkg/include -I/usr/include -I../lib -O2 -I/usr/pkg/include -I/usr/include -Wall -W -c window.c
window.c:65: error: static declaration of 'BC' follows non-static declaration
/usr/include/termcap.h:59: error: previous declaration of 'BC' was here
gnumake[2]: *** [window.o] Error 1
gnumake[1]: *** [all-recursive] Error 1
gnumake: *** [all-recursive-am] Error 2
*** Error code 2
Stop.
bmake: stopped in /usr/pkgsrc/comms/minicom
>How-To-Repeat:
On MacOS X 10.4.x with XCode 2.2, using GCC 4.0.1, do:
cd .../pkgsrc/comms/minicom
bmake
>Fix:
GCC4 is much stricter about scope and linkage than GCC3.x. The file:
work/minicom-2.1/src/window.c
declares a number of static variables, one of which, "BC" conflicts
with a previous non-static (and apparently unrelated) definition in
/usr/include/termcap.h, which is included by way of the local header
file "port.h".
Since the variable is declared static in window.c, it is guaranteed
not to be referenced by other compilation units and it will not
be visible outside the resulting object module. Therefore, we can
rename it to any non-conflicting name we desire as long as all
references within its source file are changed to match.
The following patch to window.c solves the problem on MacOS X 10.4 with
XCode 2.x and GCC4.x and should also work for other platforms adopting
GCC4.x. Ideally, this bug should be reported back to minicom's
developers so the code can be brought into compliance with scope
and linkage semantics.
--- work/minicom-2.1/src/window.c.orig 2006-03-17 03:41:33.000000000 -0600
+++ work/minicom-2.1/src/window.c 2006-03-17 03:54:19.000000000 -0600
@@ -62,7 +62,7 @@
static char *CS, *SF, *SR, *VB, *BL;
static char *VE, *VI, *KS, *KE;
static char *CD, *CL, *IC, *DC;
-static char *BC, *CR, *NL;
+static char *mcBC, *CR, *NL;
#if ST_LINE
static char *TS, *FS, *DS;
#endif
@@ -322,8 +322,8 @@
else if (NL != CNULL && x == 0 && x == curx && y == cury + 1)
outstr(NL);
#endif
- else if (BC != CNULL && y == cury && x == curx - 1)
- outstr(BC);
+ else if (mcBC != CNULL && y == cury && x == curx - 1)
+ outstr(mcBC);
else
outstr(tgoto(CM, x, y));
curx = x;
@@ -1918,7 +1918,7 @@
CL = tgetstr("cl", &_tptr);
IC = tgetstr("ic", &_tptr);
DC = tgetstr("dc", &_tptr);
- BC = tgetstr("bc", &_tptr);
+ mcBC = tgetstr("bc", &_tptr);
CR = tgetstr("cr", &_tptr);
NL = tgetstr("nl", &_tptr);
AC = tgetstr("ac", &_tptr);
@@ -1967,10 +1967,10 @@
_has_am = tgetflag("am");
_mv_standout = tgetflag("ms");
if (tgetflag("bs")) {
- if (BC == CNULL) BC = "\b";
+ if (mcBC == CNULL) mcBC = "\b";
}
else
- BC = CNULL;
+ mcBC = CNULL;
/* Special IBM box-drawing characters */
D_UL = 201;