Bug 1666098 - Overspecification in perl -MExtUtils::Embed -e ldopts
Summary: Overspecification in perl -MExtUtils::Embed -e ldopts
Keywords:
Status: ASSIGNED
Alias: None
Product: Fedora
Classification: Fedora
Component: perl
Version: 31
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Jitka Plesnikova
QA Contact: Fedora Extras Quality Assurance
URL: https://rt.perl.org/Ticket/Display.ht...
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2019-01-14 21:57 UTC by Michael Schwendt
Modified: 2019-10-31 20:23 UTC (History)
11 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed:


Attachments (Terms of Use)

Description Michael Schwendt 2019-01-14 21:57:18 UTC
The following command is supposed to return the ldflags that are needed to link with libperl. Instead, it returns everything that has been specified when building libperl itself. Not limited to Fedora's global flags and several libraries that aren't needed when linking shared. As a result, programs relink also with those libs instead of just libperl.

$ perl -MExtUtils::Embed -e ldopts
-Wl,--enable-new-dtags -Wl,-z,relro -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -Wl,-z,relro -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -fstack-protector-strong -L/usr/local/lib  -L/usr/lib64/perl5/CORE -lperl -lpthread -lresolv -ldl -lm -lcrypt -lutil -lc

Please clean up the flags and return only -L/usr/lib64/perl5/CORE -lperl.

Comment 1 Petr Pisar 2019-01-15 07:17:37 UTC
The unneeded libraries are there because of this:

ExtUtils::Embed adds $Config{perllibs} to ldopts:

$ perl -MConfig -e 'print qq{$Config{perllibs}\n}'
-lpthread -lresolv -ldl -lm -lcrypt -lutil -lc

and perllibs is documented as:

        The list of libraries needed by Perl only (any libraries needed by
        extensions only will by dropped, if using dynamic loading).

The perllibs documentation is not clear (as always) whether the flags are for linking with Perl or linking the Perl.
The perllibs value suggests its for linking the Perl.

ExtUtils::Embed documents ldopts like this:

        Output arguments for linking the Perl library and extensions to your
        application.

I will forward this discrepancy to upstream, but do not hope in any action. Upstream is very reluctant to touching this code and any downstream changes always makes angry one or another party depending on which misfeature we remove and they rely on.

The other options are there because perl enforces its ABI to applications that use perl. That's upstream's deliberate decision and that fix will be very painful. (No, it's not about rewriting ExtUtils::Embed, that's only a symptom. The real issue is Perl's build system that's hindered by a compatibility with the whole CPAN.)

Comment 2 Ben Cotton 2019-08-13 16:59:25 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 31 development cycle.
Changing version to '31'.

Comment 3 Ben Cotton 2019-08-13 19:37:31 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 31 development cycle.
Changing version to 31.


Note You need to log in before you can comment on or make changes to this bug.