Skip to content

Conversation

@Tux
Copy link
Contributor

@Tux Tux commented May 4, 2020

In a 64bit environment, force 64bit locations before 32bit locations.
This will move /usr/lib64 in front of /usr/lib and /lib64 in front of
/lib. This is important if a module uses $Config{libpth} to find a
library to load, like FFI::CheckLib does. If a library is installed in
both locations, it is likely to pick the wrong one if the order is not
showing the correct architecture first
As this clutch only looks at trailing 64, it will have no impact on
locations differing completely, as /usr/lib vs /usr/lib/i386-linux-gnu/
like on debian.

Also just include existing PATH elements and filter duplicates.

@toddr toddr requested review from atoomic and toddr and removed request for atoomic and toddr May 6, 2020 16:06
@toddr toddr added this to the 5.33.1 milestone May 19, 2020
@xsawyerx xsawyerx added the do not merge Don't merge this PR, at least for now label Jun 20, 2020
In a 64bit environment, force 64bit locations *before* 32bit locations.
This will move /usr/lib64 in front of /usr/lib and /lib64 in front of
/lib.  This is important if a module uses $Config{libpth} to find a
library to load, like FFI::CheckLib does. If a library is installed in
both locations, it is likely to pick the wrong one if the order is not
showing the correct architecture first
As this clutch only looks at trailing 64, it will have no impact on
locations differing completely, as /usr/lib vs /usr/lib/i386-linux-gnu/
like on debian.

Also just include existing PATH elements and filter duplicates.
@jkeenan jkeenan force-pushed the smoke-me/tux-dynaloader64order branch from 207393c to 8c7ed71 Compare January 26, 2021 02:08
@jkeenan
Copy link
Contributor

jkeenan commented Jan 26, 2021

@Tux, this p.r. was submitted as a draft last May. I have rebased it on blead, thereby resolving merge conflicts. Would you like it to enter code review?

Thank you very much.
Jim Keenan

@Tux
Copy link
Contributor Author

Tux commented Jan 26, 2021

(still) looks fine to me. I vote +1, but that won't surprise you

@Leont
Copy link
Contributor

Leont commented Jan 26, 2021

This feels like the wrong place to fix this. If the order is wrong, why not fix it in Configure?

@Tux
Copy link
Contributor Author

Tux commented Jan 27, 2021

@Leont because the development environment on the box where perl was built (and distributed from) might be completely different from the box where this eventually is used. The moment of actual use might have access to many more resource locations than what is done inside Configure, so it needs to be as dynamic as possible and as late as possible.
Every module's Makefile.PL (or wharever is used) may add resource locations, and when you do this in Configure, you cannot fix that anymore

@Leont
Copy link
Contributor

Leont commented Jan 27, 2021

Why are there 32bit and 64bit entries in the same libpth? That doesn't make sense, one can't link to both. Isn't that the real (Configure) issue?

@Tux
Copy link
Contributor Author

Tux commented Jan 28, 2021

Because not all systems have separated them nicely. /lib and /usr/lib might be 32bit or 64bit (or both in case of AIX). /usr/lib64 (and variations like /usr/lib/hpux64 and /usr/lib/pa20_64) were introduced when *ux started to support both. On AIX a .a will host both 32bit and 64bit (neither of which you can see from the outside without options or environment settings) and on HP-UX, (shared) libs in /usr/lib will/might point to either /usr/lib/hpux32 or /usr/lib/hpux64 (and all variations). There is no rule there.
So when building 64-bit perl, /usr/lib should be included.
Furthermore, building perl might have a diffent content for /lib and /usr/lib than a system where perl will be installed and run, so you will need both when building (additional) XS.

@Leont
Copy link
Contributor

Leont commented Jan 28, 2021

Because not all systems have separated them nicely. /lib and /usr/lib might be 32bit or 64bit (or both in case of AIX). /usr/lib64 (and variations like /usr/lib/hpux64 and /usr/lib/pa20_64) were introduced when *ux started to support both. On AIX a .a will host both 32bit and 64bit (neither of which you can see from the outside without options or environment settings) and on HP-UX, (shared) libs in /usr/lib will/might point to either /usr/lib/hpux32 or /usr/lib/hpux64 (and all variations). There is no rule there.
So when building 64-bit perl, /usr/lib should be included.

This still sounds like a Configure issue. There shouldn't be any paths in libpth that can't be used for finding libraries.

Furthermore, building perl might have a diffent content for /lib and /usr/lib than a system where perl will be installed and run, so you will need both when building (additional) XS.

Franky, this is not a situation that we have ever supported. Maybe we want to support it on some systems, but I don't think we want to force it upon everyone else. Like much of DynaLoader_pm.PL, such code should be optional.

@rjbs
Copy link
Member

rjbs commented Jul 16, 2021

It's the unanimous opinion of the PSC that this problem is not Perl's to fix, it's effectively an unsupported configuration.

@rjbs rjbs closed this Jul 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

do not merge Don't merge this PR, at least for now hasConflicts

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants