Allow linking to versioned libperl#19
Merged
ambs merged 1 commit intoambs:masterfrom Nov 10, 2025
OldManYellsAtCloud:master
Merged
Allow linking to versioned libperl#19ambs merged 1 commit intoambs:masterfrom OldManYellsAtCloud:master
ambs merged 1 commit intoambs:masterfrom
OldManYellsAtCloud:master
Conversation
ambs
reviewed
Nov 6, 2025
Owner
ambs
left a comment
There was a problem hiding this comment.
Thanks for the patch.
It looks good, but... are we sure a library name will never have a dot on it?
lib/Config/AutoConf.pm
Outdated
| my $libperl = $Config{libperl}; | ||
| $libperl =~ s/^lib//; | ||
| $libperl =~ s/\.[^\.]*$//; | ||
| $libperl =~ s/^([^\.]*)\..*$/$1/; |
Owner
There was a problem hiding this comment.
Is the dot clearly not part of any library name?
Contributor
Author
There was a problem hiding this comment.
Hmmm... how about explicitly cutting off everything after the start of .so and/or .so.?
ambs
reviewed
Nov 7, 2025
When trying to link to the perlapi, the module gets the library name
from $Config{libperl}, and then performs some transformations to
convert the value into a linker flag.
This transformation expects an unversioned library name (libperl.so) during this
transformation:
Cut off the first "lib", and remove everything after the last dot: libperl.so -> perl
This transformation doesn't work in case the library is versioned, e.g libperl.so.5.40.2.
In this case the linker flag becomes "perl.so.5.40", which is not a valid library name,
and the linking fails.
To avoid it, this patch changes the second step of the transformation logic:
cut off the ".so" at the end (if it exists), or cut off everything from the start of
".so." substring, if there is anything.
Signed-off-by: Gyorgy Sarvari <skandigraun@gmail.com>
Co-authored-by: Alberto Simões <ambs@cpan.org>
ambs
approved these changes
Nov 10, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When trying to link to the perlapi, the module gets the library name from $Config{libperl}, and then performs some transformations to convert the value into a linker flag.
This transformation expects an unversioned library name (e.g. libperl.so) during this transformation:
Cut off the first "lib", and remove everything after the last dot: libperl.so -> perl
This transformation doesn't work in case the library is versioned, e.g
libperl.so.5.40.2. In this case the linker flag becomesperl.so.5.40, which is not a valid library name, and the linking fails.To avoid it, this patch changes the second step of the transformation logic: instead of cutting off everything after the last dot, cut off everything after the first one.