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

g++ on FreeBSD

Thread Next
From:
Nicholas Clark
Date:
February 19, 2007 15:06
Subject:
g++ on FreeBSD
Message ID:
20070219230628.GB5748@plum.flirble.org
If I try to build blead with g++ on FreeBSD I don't get very far:

`sh  cflags "optimize='-g'" miniperlmain.o`  miniperlmain.c
          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[]'
miniperlmain.c: In function `int main(int, char**, char**)':
miniperlmain.c:129: error: `environ' was not declared in this scope
*** Error code 1

Stop in /home/nick/p4perl/perl.

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 /**/


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

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?

Nicholas Clark

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