79 lines
2.6 KiB
Diff
79 lines
2.6 KiB
Diff
From 2e2114556330296d7451b7dd11f9ead7d0b40b4f Mon Sep 17 00:00:00 2001
|
|
From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com>
|
|
Date: Wed, 26 Jul 2023 13:21:20 +0200
|
|
Subject: [PATCH] No special linker flags for checking for PL_infix_plugin
|
|
MIME-Version: 1.0
|
|
Content-Type: text/plain; charset=UTF-8
|
|
Content-Transfer-Encoding: 8bit
|
|
|
|
$Config{libs} lists all discovered libraries for optional perl
|
|
extensions. If perl is built dynamically, there is no need to link an
|
|
executable to all the libraries. For this purpose there is
|
|
$Config{perllibs}.
|
|
|
|
Actually the extensions can be uninstalled when building
|
|
XS-Parse-Keyword and the check would fail like this:
|
|
|
|
Checking for PL_infix_plugin...
|
|
test-56-1.c: In function 'main':
|
|
test-56-1.c:6:29: warning: variable 'def' set but not used [-Wunused-but-set-variable]
|
|
6 | struct Perl_custom_infix def;
|
|
| ^~~
|
|
/usr/bin/ld: cannot find -lgdbm: No such file or directory
|
|
/usr/bin/ld: cannot find -ldb: No such file or directory
|
|
|
|
$Config{perllibs} should be used instead.
|
|
|
|
In reality both $Config{libs} and $Config{perllibs} are wrong because
|
|
they list libraries used for building perl. The only library needed for
|
|
building perl extensions is -lperl itself. Unfortunately %Config does
|
|
not make the distinction and does not provide any variable which would
|
|
contain only required flags (i.e. -lperl and additional libraries
|
|
necessary for a statically linked perl).
|
|
|
|
At the end, the Keyword.so is also not linked to all the libraries.
|
|
|
|
In the actual reallity, the check program does use any perl function
|
|
or variable, hence strictely speaking the program does not have to
|
|
link to libper.so at all and @linker_flags should be empty.
|
|
|
|
That's what this patch does.
|
|
|
|
It might breaks what upstream fixed in 0.24, but for dynamic ELF
|
|
systems it's the best solution.
|
|
|
|
Signed-off-by: Petr Písař <ppisar@redhat.com>
|
|
---
|
|
Build.PL | 10 ----------
|
|
1 file changed, 10 deletions(-)
|
|
|
|
diff --git a/Build.PL b/Build.PL
|
|
index 27aa208..560dc75 100644
|
|
--- a/Build.PL
|
|
+++ b/Build.PL
|
|
@@ -40,21 +40,11 @@ EOF
|
|
{
|
|
print "Checking for PL_infix_plugin...\n";
|
|
|
|
- # Teach $cc how to find and link to libperl
|
|
- require Config;
|
|
- require Text::ParseWords;
|
|
-
|
|
- my @linker_flags = (
|
|
- "-L" . File::Spec->catdir($Config::Config{archlibexp}, "CORE"),
|
|
- "-lperl", Text::ParseWords::shellwords( $Config::Config{libs} ),
|
|
- );
|
|
-
|
|
my $have_pl_infix_plugin = 0;
|
|
|
|
$have_pl_infix_plugin = 1 if grep { $_ eq "--have-pl_infix_plugin" } @ARGV;
|
|
|
|
$have_pl_infix_plugin ||= $cc->try_compile_run(
|
|
- extra_linker_flags => \@linker_flags,
|
|
source => <<'EOF'
|
|
#include "EXTERN.h"
|
|
#include "perl.h"
|
|
--
|
|
2.41.0
|
|
|