Guix Home: Problems with byte-compilation of a specific commit of emacs package

I’m trying to install the new claude-3.7-sonnet branch from emacs-gptel with the following home.scm file:

(use-modules (gnu home)
             (gnu home services)
             (gnu packages)
	     (gnu packages emacs)
             (gnu packages emacs-xyz)
             (gnu packages version-control)
	     (guix transformations)
	     (guix packages)
	     (srfi srfi-1)
             (guix build-system emacs)
	     )

(home-environment
 (packages (list emacs
		 git
		 ((options->transformation
		   '((with-commit . "emacs-gptel=2bb081e")))
		  emacs-gptel))

		 ))

Apparently byte compilation generates issues by looking at the error log, so with some help of an LLM I tried to disable byte compilation:

(use-modules (gnu home)
             (gnu home services)
             (gnu packages)
	     (gnu packages emacs)
             (gnu packages emacs-xyz)
             (gnu packages version-control)
	     (guix transformations)
	     (guix packages)
	     (srfi srfi-1)
             (guix build-system emacs)
	     )

(define transform-gptel
  (options->transformation
   '((with-commit . "emacs-gptel=2bb081e55e33b3df2b60d51d988713d9470e7d6c"))))

(define gptel-without-compilation
  (package
    (inherit (transform-gptel emacs-gptel))
    (build-system emacs-build-system)
    (arguments
     `(#:phases
       (modify-phases %standard-phases
         (delete 'byte-compile))))))


(home-environment
 (packages (list emacs
		 git
		 gptel-without-compilation
		 )))

This also fails, but it is surprising to see that the error also comes from byte compilation (meaning that the changes I did didnt avoid byte compilation)

error: in phase ‘build’: uncaught exception:
%exception #<&invoke-error program: “/gnu/store/gqnr7qdyyf15z2x99p3izwnrhwhc4ym5-emacs-minimal-29.4/bin/emacs” arguments: (“–quick” “–batch” “–eval=(eval '(let ((byte-compile-debug t) (byte+native-compile (native-comp-available-p)) (files (directory-files-recursively "/gnu/store/x4axr6pil7zjwkdz8v649d5i3lj1ah3h-emacs-gptel-git.2bb081e/share/emacs/site-lisp/gptel-git.2bb081e" "\\.el$")) (write-bytecode (and (native-comp-available-p) (progn (require (quote comp)) (if (fboundp (quote comp-write-bytecode-file)) (quote comp-write-bytecode-file) (quote comp–write-bytecode-file)))))) (mapc (lambda (file) (let (byte-to-native-output-buffer-file (eln-dir (and (native-comp-available-p) (cadr native-comp-eln-load-path)))) (if byte+native-compile (native-compile file (comp-el-to-eln-filename (file-relative-name file "/gnu/store/x4axr6pil7zjwkdz8v649d5i3lj1ah3h-emacs-gptel-git.2bb081e/share/emacs/site-lisp/gptel-git.2bb081e") eln-dir)) (byte-compile-file file)) (unless (null byte-to-native-output-buffer-file) (funcall write-bytecode nil)))) files)) nil)”) exit-status: 255 term-signal: #f stop-signal: #f>
phase `build’ failed after 0.4 seconds
command “/gnu/store/gqnr7qdyyf15z2x99p3izwnrhwhc4ym5-emacs-minimal-29.4/bin/emacs” “–quick” “–batch” “–eval=(eval '(let ((byte-compile-debug t) (byte+native-compile (native-comp-available-p)) (files (directory-files-recursively "/gnu/store/x4axr6pil7zjwkdz8v649d5i3lj1ah3h-emacs-gptel-git.2bb081e/share/emacs/site-lisp/gptel-git.2bb081e" "\\.el$")) (write-bytecode (and (native-comp-available-p) (progn (require (quote comp)) (if (fboundp (quote comp-write-bytecode-file)) (quote comp-write-bytecode-file) (quote comp–write-bytecode-file)))))) (mapc (lambda (file) (let (byte-to-native-output-buffer-file (eln-dir (and (native-comp-available-p) (cadr native-comp-eln-load-path)))) (if byte+native-compile (native-compile file (comp-el-to-eln-filename (file-relative-name file "/gnu/store/x4axr6pil7zjwkdz8v649d5i3lj1ah3h-emacs-gptel-git.2bb081e/share/emacs/site-lisp/gptel-git.2bb081e") eln-dir)) (byte-compile-file file)) (unless (null byte-to-native-output-buffer-file) (funcall write-bytecode nil)))) files)) nil)” failed with status 255
build process 16 exited with status 256

Any ideas on how to fix this?

So a solution is to bypass byte-compilation by using the copy build system instead like the following:

(use-modules 
             (gnu home)
             (gnu home services)
             (gnu packages)
             (gnu packages emacs)
             (gnu packages emacs-xyz)
             (gnu packages version-control)
             (guix transformations)
             (guix build-system copy)
	     )

(define transform-gptel
  (options->transformation
   '((with-commit . "emacs-gptel=2bb081e55e33b3df2b60d51d988713d9470e7d6c"))))

(define gptel-package
  (transform-gptel emacs-gptel))

(define gptel-without-compilation
  (package
    (inherit gptel-package)
    (build-system copy-build-system)
    (arguments
     `(#:install-plan
       '(("." "share/emacs/site-lisp/"))))))  ;; Copy the entire directory

(home-environment
 (packages (list emacs
		 git
		 gptel-without-compilation
		 )))

1 Like