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

Re: g++ on FreeBSD

Thread Previous | Thread Next
From:
Nicholas Clark
Date:
April 10, 2007 11:35
Subject:
Re: g++ on FreeBSD
Message ID:
20070410183526.GI69960@plum.flirble.org
On Tue, Apr 10, 2007 at 01:49:03PM -0400, Andy Dougherty wrote:
> On Tue, 10 Apr 2007, Nicholas Clark wrote:


> We at least ought to be able to try.  We just need to convince the hints 
> file to let us.  I don't like hints files that prevent me from trying 
> things. (I hadn't realized you were trying to build with -Dusethreads, so 
> I hadn't patched that branch.)

Fair point.

I didn't actually apply that patch because I'd worked out where that probe
code below was:

> > Was there a flag to get Configure to not delete all its try.c files?
> 
> No, afraid not.  However, here's what it essentially tries to do:
> 
>     void *(*(p()))() { extern void *atof(); return &atof; } 
>     int main() { if(p()) return(0); else return(1); }
> 
> g++ doesn't like that :-(.

But it does like this it if you change it to

    extern "C" void *atof(); void *(*(p()))() { return &atof; } 
    int main() { if(p()) return(0); else return(1); }


Getting it to work nicely was why I didn't reply to myself, ahead of your
message.

The appended change gets me as far as

POSIX.xs: In function `void XS_POSIX_ctermid(PerlInterpreter*, CV*)':
POSIX.xs:1856: error: invalid conversion from `void*' to `char*'

which is

#ifdef HAS_CTERMID_R
        s = safemalloc((size_t) L_ctermid);
#endif

which I will now address.

Nicholas Clark

Change 30897 by nicholas@nicholas-saigo on 2007/04/10 18:30:04

	Make the don't-use-nm symbol table probes work under C++.

Affected files ...

... //depot/perl/Configure#644 edit

Differences ...

==== //depot/perl/Configure#644 (xtext) ====

@@ -7582,18 +7582,21 @@
 esac;
 case "$tx" in
 yes)
+	case "$d_cplusplus" in
+		$define) extern_C=\"C\";;
+	esac;
 	tval=false;
 	if $test "$runnm" = true; then
 		if $contains $tlook $tf >/dev/null 2>&1; then
 			tval=true;
 		elif $test "$mistrustnm" = compile -o "$mistrustnm" = run; then
-			echo "void *(*(p()))$tdc { extern void *$1$tdc; return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
+			echo "extern $extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
 			$cc -o try $optimize $ccflags $ldflags try.c >/dev/null 2>&1 $libs && tval=true;
 			$test "$mistrustnm" = run -a -x try && { $run ./try$_exe >/dev/null 2>&1 || tval=false; };
 			$rm -f try$_exe try.c core core.* try.core;
 		fi;
 	else
-		echo "void *(*(p()))$tdc { extern void *$1$tdc; return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
+		echo "extern $extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
 		$cc -o try $optimize $ccflags $ldflags try.c $libs >/dev/null 2>&1 && tval=true;
 		$rm -f try$_exe try.c;
 	fi;

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