From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-4.2 required=3.0 tests=ALL_TRUSTED,BAYES_00, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, T_SCC_BODY_TEXT_LINE shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id 8F53C1F59D for ; Sun, 4 Sep 2022 07:43:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=80x24.org; s=selector1; t=1662277433; bh=ik7E4dhuGEJQIVTejhgMovGpI+1vTzLh3zTfNF8M2rM=; h=From:To:Subject:Date:In-Reply-To:References:From; b=vmdKPcJACoeL1tjBevlf/h2TfAwTF0ui/UzzMeWX+tB8CzKcUJIDTkvcEw1+EHTv3 gZu+s3XazXq+HsX/sWQgqssD8Z0yiXZpxHTqjYgjcJN2h/WPBcdoAqhkiVSC36xVwg ooDvgXwb9fD57bovXsM+bQDHLfaQd77fNVrsXH6k= From: Eric Wong To: mwrap-perl@80x24.org Subject: [PATCH 1/2] Makefile.PL: check for execinfo on FreeBSD Date: Sun, 4 Sep 2022 07:44:41 +0000 Message-Id: <20220904074442.26051-2-mwrap-perl@80x24.org> In-Reply-To: <20220904074442.26051-1-mwrap-perl@80x24.org> References: <20220904074442.26051-1-mwrap-perl@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: This is required for it to work reliably in FreeBSD if we hit a code path which calls backtrace_symbols before BOOT:. This will allow the next commit to setup `totals' rculfhash earlier in the constructor, rather than BOOT, allowing allocations to be tracked as early as possible. --- Makefile.PL | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/Makefile.PL b/Makefile.PL index c3caf6c..7ea7929 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -32,6 +32,37 @@ END chomp(my $INC = `$pkg_config --cflags liburcu-cds liburcu-bp`); my @writemakefile_args = (); +use IO::Handle; +STDOUT->autoflush(1); +require ExtUtils::CBuilder; +require File::Temp; +my $cb = ExtUtils::CBuilder->new(quiet => $ENV{V} ? 0 : 1); +my $d = File::Temp->newdir('mwrap-perl-build-XXXX'); +my $olderr; +print '# checking for -lexecinfo... '; +{ + use autodie; + open my $fh, '>', "$d/execinfo.c"; + print $fh < +int main(void) { return backtrace_symbols ? 1 : 0; } +EOM + close $fh; + open $olderr, '+>&', *STDERR{IO}; + open STDERR, '>', "$d/err.log"; +} +eval { + my $obj = $cb->compile(source => "$d/execinfo.c"); + $cb->link(objects => $obj, extra_linker_flags => '-lexecinfo'); + $LIBS .= ' -lexecinfo'; + say " yes on $^O"; +}; +say " no on $^O" if $@; +{ + use autodie; + open STDERR, '+>&', $olderr or die "dup stderr: $!"; +} + # See lib/ExtUtils/MakeMaker.pm for details of how to influence # the contents of the Makefile that is written. push @writemakefile_args, (