Skip to content

Hardcoded / stored compiler and compiler flags may cause inability to build perl modules #18939

Open
@mojca

Description

@mojca

(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 and Config_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 and clang versions as packages and the older OS versions nowadays use nearly the latest clang 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 like perl). 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 to Config_heavy.pl:

libspath=' /opt/local/lib /Library/Developer/CommandLineTools/usr/lib/clang/12.0.0/lib /Library/Developer/CommandLineTools/SDKs/MacOSX11.0.sdk/usr/lib /Library/Developer/CommandLineTools/usr/lib /usr/lib'

but the path to SDK basically changes with every single "security update". It started with MacOSX11.0.sdk, then goes to MacOSX11.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 same stdlibc++) is being used, choosing an arbitrary version of clang 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 the perl developers.

@jmroot, @ryandesign, @kencu

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions