Subject: Cross compiler errors with installed includes
To: None <port-sun3@netbsd.org>
From: None <derry.birse@ind.alstom.com>
List: port-sun3
Date: 06/29/1999 14:43:02
I recently built a gcc cross compiler for the sun3 port on a Sparc 20 running
Solaris 2.6. I have compiled several simple test programs with some success. I
created a modified xmkmf and call imake with appropriate options and then I
tried to compile the xfig drawing tool (from original source, not the NetBSD
packages source). I got the following errors.

make -R d_arcbox.o
cc -O     -I/usr/local/m68k-sun3-netbsd1.3.2/lib/X11/config
-I/usr/local/m68k-sun3-netbsd1.3.2/lib/X11/config/exports/include  -DNOSTDHDRS
-DGSBIT -DSMOOTHMOTION  -c  d_arcbox.c
In file included from d_arcbox.c:13:
fig.h:278: warning: `PATH_MAX' redefined
/usr/local/m68k-sun3-netbsd1.3.2/include/sys/syslimits.h:52: warning: this is
the location of the previous definition
In file included from fig.h:220,
                 from d_arcbox.c:13:
/usr/local/m68k-sun3-netbsd1.3.2/include/errno.h:58: warning: const declaration
for `sys_nerr' follows non-const
/usr/local/m68k-sun3-netbsd1.3.2/include/errno.h:59: conflicting types for
`sys_errlist'
/usr/local/m68k-sun3-netbsd1.3.2/include/X11/Xos.h:121: previous declaration of
`sys_errlist'
In file included from d_arcbox.c:13:
fig.h:224: conflicting types for `sys_errlist'
/usr/local/m68k-sun3-netbsd1.3.2/include/errno.h:59: previous declaration of
`sys_errlist'
In file included from d_arcbox.c:16:
object.h:107: `PATH_MAX' undeclared here (not in a function)
*** Error code 1
make: Fatal error: Command failed for target `d_arcbox.o'


The definitions to which the "conflicting types" errors refer are as follows:

usr/local/m68k-sun3-netbsd1.3.2/include/errno.h:59:

#if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE) && !defined(_XOPEN_SOURCE)
extern __const int sys_nerr;
extern __const char *__const sys_errlist[];
#endif

and

/usr/local/m68k-sun3-netbsd1.3.2/include/X11/Xos.h:121:

#if (defined(X_NOT_STDC_ENV) || (defined(sun) && !defined(SVR4)) || defined(macI
I)) && !defined
(__GLIBC__)
#ifndef strerror
extern char *sys_errlist[];
extern int sys_nerr;
#define strerror(n) \
    (((n) >= 0 && (n) < sys_nerr) ? sys_errlist[n] : "unknown error")
#endif
#endif

These do contain different definitions but it may be that my defines are not set
correctly. I am going to run a test piece of code on my NetBSD system to
discover the settings for these defines and compare with the cross compiler.

But whilst I am waiting to try this out can anyone answer the following
question.
Is it absolutely necessary to get the NetBSD distributions for any package I
want to compile or will vanilla distributions do in most cases.


Thanks for any replies.
Derry Birse