NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
18.06k stars 14.04k forks source link

emacsPackages: elpa2nix fails with older Emacs versions #352907

Open akirak opened 2 hours ago

akirak commented 2 hours ago

Describe the bug

ELPA packages fail to compile with Emacs 26.3 or before. It raises the following error in installPhase:

Symbol's function definition is void: string-empty-p

The dependency on string-empty-p has been introduced at 2f7cc5a, and the function is available when package is loaded in recent Emacs versions, but not in older versions of Emacs.

To make it work consistently, you have to explicitly require subr-x where the function is defined in those versions.

Steps To Reproduce

Steps to reproduce the behavior:

  1. Clone nixpkgs-snapshot-update-1730451898 branch of nix-emacs-ci
  2. In the cloned repository, run the following command:
nix build .#checks.x86_64-linux.emacs-26-3

The derivation fails to build with the following error message:

error: builder for '/nix/store/id1j0bqm4bam405b3p7n8hpqpwgw0dc5-emacs-seq-2.24.drv' failed with exit code 255; last 19 log lines: Running phase: unpackPhase unpacking source archive /nix/store/c8l1xdpi33z78c8lb3d4k5jxkxnx6j9k-seq-2.24.tar source root is seq-2.24 removed 'seq-2.24/tests/seq-tests.el' seq-2.24/ seq-2.24/seq-24.el seq-2.24/tests/ seq-2.24/seq.el seq-2.24/seq-pkg.el seq-2.24/seq-25.el setting SOURCE_DATE_EPOCH to timestamp 1711878823 of file seq-2.24/seq-pkg.el Running phase: patchPhase Running phase: updateAutotoolsGnuConfigScriptsPhase Running phase: configurePhase no configure script, doing nothing Running phase: buildPhase no Makefile or custom buildPhase, doing nothing Running phase: installPhase Symbol's function definition is void: string-empty-p For full logs, run 'nix log /nix/store/id1j0bqm4bam405b3p7n8hpqpwgw0dc5-emacs-seq-2.24.drv'. error: 1 dependencies of derivation '/nix/store/33a9rcd1hsnscndnjpy37dr1pz48a1b8-emacs-compat-30.0.0.0.drv' failed to build error: 1 dependencies of derivation '/nix/store/6fnqjlc6gkwjj080g08nrv83paxys103-emacs-with-packages-26-3.drv' failed to build error: 1 dependencies of derivation '/nix/store/bs3gqhfn7194lsm7z42pfg0y9dykrcqd-test.drv' failed to build

You can confirm string-empty-p is not loaded by running the following commands:

$ nix run .#emacs-27-1 -- -batch -eval "(progn (require 'package) (princ (fboundp 'string-empty-p)))" t

$ nix run .#emacs-26-3 -- -batch -eval "(progn (require 'package) (princ (fboundp 'string-empty-p)))" nil

Expected behavior

The derivation .#checks.x86_64-linux.emacs-26-3 should build successfully.

Screenshots

If applicable, add screenshots to help explain your problem.

Additional context

This issue blocks https://github.com/purcell/nix-emacs-ci/pull/319.

Notify maintainers

@jian-lin for #343925.

Metadata


Add a :+1: reaction to issues you find important.

jian-lin commented 1 hour ago

Thanks for reporting this. I have proposed https://github.com/NixOS/nixpkgs/pull/352915 as a fix.