Skip to content

Commit

Permalink
(pkgsStatic.perl): Patch Perl to avoid duplicate symbols with musl.
Browse files Browse the repository at this point in the history
This commit backports a commit introduced on Perl 5.39.2 to allow
`pkgs.pkgsStatic.perl` to compile without raising errors about duplicate
symbols being defined during the linking process.

This fixes NixOS#295608

| Tested on | Status |
| --- | --- |
| M1 Mac (aarch64-darwin) | Failed due to other issues* |
| NixOS VM (x86_64-linux) | Compiled |
| Nix (aarch64-linux) | Compiled |

**Test method**:

```sh
nix repl -I nixpkgs=$PWD
nix repl> pkgs = import <nixpkgs> {}
nix repl> :b pkgs.perl
nix repl> :b pkgs.pkgsStatic.perl
```

Despite the upstream commit being scoped to all environments, we are only
applying this patch only on the `pkgsStatic` context to avoid rebuilding all of
NixOS packages by changing Perl.

It includes an additional build flag [also used upstream](Perl/perl5#22052)
for configuring static builds.

*MacOS: `pkgsStatic.perl` still fails to compile after this change due to MacOS
case-insensitiviness affecting the build recipe under /tmp, as
`perl-cross/configure` is copied over `perl/Configure` file, as well as not
finding `readelf` for the `configurePhase`.

NixOS#113985 (comment)
NixOS/nix#1446
NixOS/nix#9318
NixOS/nix#8995
  • Loading branch information
bltavares committed Mar 28, 2024
1 parent ccae573 commit fe777ed
Show file tree
Hide file tree
Showing 2 changed files with 555 additions and 1 deletion.
5 changes: 4 additions & 1 deletion pkgs/development/interpreters/perl/intepreter.nix
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@ stdenv.mkDerivation (rec {
# Enable TLS/SSL verification in HTTP::Tiny by default
lib.optional (lib.versionOlder version "5.38.0") ./http-tiny-verify-ssl-by-default.patch

# Fix duplicated symbol identification on pkgsStatic - Already fixed in 5.39.2+
++ lib.optional (lib.versionOlder version "5.39.2" && stdenv.hostPlatform.isStatic) ./static-stdenv-5.39.2.patch

# Do not look in /usr etc. for dependencies.
++ lib.optional (lib.versionOlder version "5.38.0") ./no-sys-dirs-5.31.patch
++ lib.optional (lib.versionAtLeast version "5.38.0") ./no-sys-dirs-5.38.0.patch
Expand Down Expand Up @@ -110,7 +113,7 @@ stdenv.mkDerivation (rec {
++ lib.optional stdenv.isSunOS "-Dcc=gcc"
++ lib.optional enableThreading "-Dusethreads"
++ lib.optional (!enableCrypt) "-A clear:d_crypt_r"
++ lib.optional stdenv.hostPlatform.isStatic "--all-static"
++ lib.optionals stdenv.hostPlatform.isStatic [ "--all-static" "-Uusedl" ]
++ lib.optionals (!crossCompiling) [
"-Dprefix=${placeholder "out"}"
"-Dman1dir=${placeholder "out"}/share/man/man1"
Expand Down

0 comments on commit fe777ed

Please sign in to comment.