develooper Front page | perl.perl5.porters | Postings from March 2007

Re: g++ on FreeBSD

Thread Previous | Thread Next
From:
Andy Dougherty
Date:
March 27, 2007 11:33
Subject:
Re: g++ on FreeBSD
Message ID:
Pine.LNX.4.62.0703271420010.17133@fractal.phys.lafayette.edu
On Mon, 19 Feb 2007, Nicholas Clark wrote:

> If I try to build blead with g++ on FreeBSD I don't get very far:
> 
>           CCCMD =  ccache g++ -DPERL_CORE -c -DHAS_FPSETMASK -DHAS_FLOATINGPOINT_H -DDEBUGGING -fno-strict-aliasing -pipe -I/usr/local/include  -g -Wall -Wno-unused-variable -Wno-unused-parameter
> In file included from perlio.h:65,
>                  from iperlsys.h:51,
>                  from perl.h:3229,
>                  from miniperlmain.c:36:
> /usr/include/stdio.h:343: error: conflicting declaration 'const int sys_nerr'
> perl.h:1277: error: 'sys_nerr' has a previous declaration as `int sys_nerr'
> /usr/include/stdio.h:343: error: type mismatch with previous external decl of `const int sys_nerr'
> perl.h:1277: error: previous external decl of `int sys_nerr'
> /usr/include/stdio.h:343: error: conflicting declaration 'const int sys_nerr'
> perl.h:1277: error: 'sys_nerr' has a previous declaration as `int sys_nerr'
> /usr/include/stdio.h:344: error: conflicting declaration 'const char* const sys_errlist[]'
> perl.h:1278: error: 'sys_errlist' has a previous declaration as `char*sys_errlist[]'
> /usr/include/stdio.h:344: error: type mismatch with previous external decl of `const char* const sys_errlist[]'
> perl.h:1278: error: previous external decl of `char*sys_errlist[]'
> /usr/include/stdio.h:344: error: conflicting declaration 'const char* const sys_errlist[]'
> perl.h:1278: error: 'sys_errlist' has a previous declaration as `char*sys_errlist[]'

> Problem is here:
> 
> #    ifdef HAS_SYS_ERRLIST
> 	extern int sys_nerr;
> 	extern char *sys_errlist[];
> #       ifndef Strerror
> #           define Strerror(e) \
> 		((e) < 0 || (e) >= sys_nerr ? "(unknown)" : sys_errlist[e])
> #       endif
> 
> 
> and HAS_SYS_ERRLIST is defined:
> 
> $ grep SYS_ERR config.h
> /* HAS_SYS_ERRLIST:
> #define HAS_SYS_ERRLIST /**/
> 
> 
> On Linux I can build with g++ yet HAS_SYS_ERRLIST is also defined:
> 
> $ grep SYS_ERR config.h
> /* HAS_SYS_ERRLIST:
> #define HAS_SYS_ERRLIST /**/

One reason Linux can get away with this is that it HAS_STRERROR is 
defined, so this section of perl.h never gets invoked.

On FreeBSD, with g++, what do you get for

	grep err config.sh

(I'm particularly interested in d_strerror, but may eventually wonder 
about the others too, so I might as well see them all at once.)

> The code in question in perl.h is from change 1:
> 
> http://public.activestate.com/cgi-bin/perlbrowse?filename=perl.h&show_blame=Show+Annotated+File

I think it's a holdover from perl2, more or less.  But yes, it's old.

> Do we need some sort of Configure check for whether sys_nerr and sys_errlist
> are declared in system headers, and if so not try to declare them ourselves?

That would, of course, be the ultimate idea, but initially, I'm curious 
why we're not finding strerror().  That might be indicative of a broader 
problem.

-- 
    Andy Dougherty		doughera@lafayette.edu

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About