-
Notifications
You must be signed in to change notification settings - Fork 584
Hardcoded / stored compiler and compiler flags may cause inability to build perl modules #18939
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
This is another case of "Apple breaking basic expectations of how unix toolchains work", they're making a habit out of it :-/. Though to be honest, the piece of code that uses these library paths is a mistake of our own. I suspect we'll have to rewrite that to dynamically get the include paths from the compiler (essentially the same code that we use in |
In our case the include paths cannot really be deduced from compiler alone, but from a combination of At the moment I believe we are looking at two separate tasks:
Do you have any reasonable suggestions for the first one, or any time estimation for the second one (even if it counts in years)? We could do various cleanups or hard-core patches for the first part (workaround), but I'm still not sure about the best way to solve this one, for example: timeincl='/Library/Developer/CommandLineTools/SDKs/MacOSX11.0.sdk/usr/include/sys/time.h ' |
This pull request might solve your issue. I haven't really tested it yet though, beyond "the unit tests pass". |
To clarify a bit more: there are two problematic things:
Regarding the flags, here are all the problematic variables that currently contain
so it's not just about the Meanwhile I discovered that there is apparently a symlink pointing from For reference, this is the full invocation (including env. variables) when we build perl:
I will do a bit more investigation about what can best be done about all those This is about one type of flags. There are occasionally other problematic flags (see https://trac.macports.org/ticket/50894#comment:4). I will test your patch on macOS 11 with perl 5.34 next, I just doubt that it will address the complete issue. |
Looks like a step in the right direction, but I don't think it addresses everything here. AIUI, there are a number of config variables that reference a specific SDK path or compiler path, which simply may not exist at runtime (either because the user updated their toolchain since building perl, or the perl binary was built on a different system.) Some related work: Python had pretty much the same issues, and their solutions are thus:
|
Fair, but that would be the most immediate problem. To be honest, I think
|
I still have no clue what I'm happy to change that part of the code if I get some suggestions about how to properly address "cross-compilations". (We generally want to allow building perl universally for multiple architectures in the same binary, but then allow building perl modules for any subset of those architectures depending on user preferences for that particular module.) So, out of curiosity: when is specifying |
In Xcode 12.5 and later. See https://trac.macports.org/ticket/63139.
Absolutely. If we must bake an sdk path into perl config files, it would be most robust to bake in the path to the unversioned MacOSX.sdk since that should always exist. |
@Leont: I tested the patch, but I see absolutely no difference. I'm not saying that the patch isn't useful, all I'm saying is that in my case I haven't seen any changes in @ryandesign: we don't need to bake the sdk path into the config files. Perl will just happily store whatever we pass to its own build flags. If we remove all the references to SDKs when building Perl, none should end up in the config files. I hope. There are still a bunch of random other flags that sometimes end up in the config files (like There are some consequences though:
|
It shouldn't affect Config_heavy.pl, but it should fix any breakage related to libpth.
What would the consequences of that be? |
Any program that checks for features at build time (only) needs to be built against the SDK matching the oldest OS version that the program is intended to run on. Otherwise it will crash when attempting to call any function that was in the SDK but is not present at runtime. If you're not on the very latest OS version, Apple's toolchain has a good chance of defaulting to using the SDK for a newer OS version. This is because the Apple Way is to always build against the very latest SDK, using |
Last I checked
@mojca - does MacPorts use the base |
We try to avoid using the system We gravitate towards What exactly is strange in the above example (other than As a temporary workaround many of the hardcoded values are now filtered out, but we really hope that this will be addressed properly in the perl core: macports/macports-ports@f35a2c5 |
Uh oh!
There was an error while loading. Please reload this page.
(I'm sorry for violating the template, but my case doesn't fit too well into the prescribed module.)
Request
We really need a way to avoid using hardcoded paths to compiler and some other options in perl.
Some tickets for reference:
While I understand why perl does what it does when storing options to
Config.pm
andConfig_heavy.pl
, that approach causes some headaches for us.Background
We are packaging
perl
inside a package manager for macOS (MacPorts) that basically supports anything from Tiger 10.4 up to the latest version, and anything from powerpc to arm64.The latest macOS versions usually use the default compiler (as provided by Xcode), but we ship a wide range of
gcc
andclang
versions as packages and the older OS versions nowadays use nearly the latestclang
compiler by default, so that we can properly support the latest C++ standards.Every now and then we increase the version of the default compiler on those ancient systems (which means that at some point we start using
/opt/local/bin/clang-mp-9.0
instead of/opt/local/bin/clang-mp-7.0
for example, but at the same time we don't recompile existing packages likeperl
). The users might have already removed the older compiler from their system, or maybe they never had it installed in the first place: they might have downloaded the package in binary form from the server which used an older compiler for building.At the other side of the spectrum, whenever the developer tools on the latest macOS version get an update, the compiler name stays the same (
/usr/bin/clang
), but the compiler version changes, and the supported compiler options change. And most annoyingly, the path to SDK changes. For example, at the time of compiling perl for macOS 11 for the first time, the following flags were stored toConfig_heavy.pl
:but the path to SDK basically changes with every single "security update". It started with
MacOSX11.0.sdk
, then goes toMacOSX11.1.sdk
,MacOSX11.2.sdk
, etc. Needless to say, we don't recompile all the package with every OS update.We often mix-and-match compilers. Sure, not all random combinations of compilers work together, but as long as the same
libc++
(or the samestdlibc++
) is being used, choosing an arbitrary version ofclang
seems to do the job for us. Perl modules get compiled by the package manager as well, and the package manager is pretty rigorous about providing all the necessary flags (specifying full path to the compiler, full path to libraries, etc.).Problem Description
Whenever something on the system changes, either due to updates from Apple, or due to our own updates like deciding to use a newer compiler by default, building perl modules becomes broken.
Ideally I would like to see the build of perl modules to respect
CC
/CXX
env. variables when they are defined. Or provide some alternative mechanism for specifying the flags.At the moment a significant portion of our perl ecosystem is broken on macOS 11 due to hardcoded paths.
We can "manually" mess with
Configue.pm
(I'll probably do that very soon, else too many modules remain broken), but I would really like to find the best solution together with theperl
developers.@jmroot, @ryandesign, @kencu
The text was updated successfully, but these errors were encountered: