Doom emacs on WSL2 unable to load after async-native-complation after latest doom upgrade

What happened?

After running doom up in my terminal on my WSL2 machine doom is unable to load after native compilation finishes. Specificallly, it seems to be that the second time I open it after updating leads to this error (see my attempted troubleshooting below). The frame appears as if I ran emacs -Q, except I am met with a suite of errors.

The error in my terminal when launching emacs is:

Eager macro-expansion failure: (invalid-function ((bytecomp "Symbol’s function definition is void: gv-setter" :error "*Compile-Log*")))

Within emacs, the warnings buffer reads:

Error (use-package): Failed to parse package general: Invalid function: ((bytecomp "Symbol’s function definition is void: gv-setter" :error "*Compile-Log*")) Disable showing Disable logging
Error (use-package): Failed to parse package which-key: Invalid function: ((bytecomp "Symbol’s function definition is void: gv-setter" :error "*Compile-Log*")) Disable showing Disable logging
Error (use-package): Failed to parse package hl-line: Invalid function: ((bytecomp "Symbol’s function definition is void: gv-setter" :error "*Compile-Log*")) Disable showing Disable logging
Error (use-package): Failed to parse package winner: Invalid function: ((bytecomp "Symbol’s function definition is void: gv-setter" :error "*Compile-Log*")) Disable showing Disable logging
Error (use-package): Failed to parse package paren: Invalid function: ((bytecomp "Symbol’s function definition is void: gv-setter" :error "*Compile-Log*")) Disable showing Disable logging
Error (use-package): Failed to parse package all-the-icons: Invalid function: ((bytecomp "Symbol’s function definition is void: gv-setter" :error "*Compile-Log*")) Disable showing Disable logging
Error (use-package): Failed to parse package highlight-numbers: Invalid function: ((bytecomp "Symbol’s function definition is void: gv-setter" :error "*Compile-Log*")) Disable showing Disable logging
Error (use-package): Failed to parse package projectile: Invalid function: ((bytecomp "Symbol’s function definition is void: gv-setter" :error "*Compile-Log*")) Disable showing Disable logging
Error (use-package): Failed to parse package autorevert: Invalid function: ((bytecomp "Symbol’s function definition is void: gv-setter" :error "*Compile-Log*")) Disable showing Disable logging
Error (use-package): Failed to parse package recentf: Invalid function: ((bytecomp "Symbol’s function definition is void: gv-setter" :error "*Compile-Log*")) Disable showing Disable logging
Error (use-package): Failed to parse package savehist: Invalid function: ((bytecomp "Symbol’s function definition is void: gv-setter" :error "*Compile-Log*")) Disable showing Disable logging
Error (use-package): Failed to parse package saveplace: Invalid function: ((bytecomp "Symbol’s function definition is void: gv-setter" :error "*Compile-Log*")) Disable showing Disable logging
Error (use-package): Failed to parse package better-jumper: Invalid function: ((bytecomp "Symbol’s function definition is void: gv-setter" :error "*Compile-Log*")) Disable showing Disable logging
Error (use-package): Failed to parse package dtrt-indent: Invalid function: ((bytecomp "Symbol’s function definition is void: gv-setter" :error "*Compile-Log*")) Disable showing Disable logging
Error (use-package): Failed to parse package helpful: Invalid function: ((bytecomp "Symbol’s function definition is void: gv-setter" :error "*Compile-Log*")) Disable showing Disable logging
Error (use-package): Failed to parse package smartparens: Invalid function: ((bytecomp "Symbol’s function definition is void: gv-setter" :error "*Compile-Log*")) Disable showing Disable logging
Error (use-package): Failed to parse package so-long: Invalid function: ((bytecomp "Symbol’s function definition is void: gv-setter" :error "*Compile-Log*")) Disable showing Disable logging
Error (use-package): Failed to parse package ws-butler: Invalid function: ((bytecomp "Symbol’s function definition is void: gv-setter" :error "*Compile-Log*")) Disable showing Disable logging
Error (use-package): Failed to parse package company: Invalid function: ((bytecomp "Symbol’s function definition is void: gv-setter" :error "*Compile-Log*")) Disable showing Disable logging
Error (use-package): Failed to parse package company-box: Invalid function: ((bytecomp "Symbol’s function definition is void: gv-setter" :error "*Compile-Log*")) Disable showing Disable logging
Error (use-package): Failed to parse package vertico: Invalid function: ((bytecomp "Symbol’s function definition is void: gv-setter" :error "*Compile-Log*")) Disable showing Disable logging
Error (use-package): Failed to parse package orderless: Invalid function: ((bytecomp "Symbol’s function definition is void: gv-setter" :error "*Compile-Log*")) Disable showing Disable logging
Warning (initialization): An error occurred while loading ‘/home/zpb/.emacs.d/lisp/doom-start.el’:

Error in a Doom module: modules/completion/vertico/config.el, (void-function define-key!)

Using emacs --debug-init produces:

Debugger entered--Lisp error: (invalid-function ((bytecomp "Symbol’s function definition is void: gv-setter" :error "*Compile-Log*")))
  ((bytecomp "Symbol’s function definition is void: gv-setter" :error "*Compile-Log*"))(#s(
  cl--generic-make-next-function(#s(
  cl--generic-make-function(#s(
  cl-generic-define-method(\(setf\ seq-elt\) nil (store (sequence array) n) nil #f(compiled-function (store sequence n) #<bytecode -0x1d67862086490644>))
  byte-code("\300\301\302\303#\210\304\305\306\305\307\310#\311#\210\312\305\310\307\310\313%\210\312\314\310\315\310\316%\210\312\314\310\317\310\320%\210\304\321\306\321\322\310#\323#\210..." [put seq-setq edebug-form-spec (sexp form) defalias seq-elt cl-generic-define (sequence n) nil "Return Nth element of SEQUENCE.\n\n(fn SEQUENCE N)" cl-generic-define-method #f(compiled-function (sequence n) #<bytecode 0x18055cba909654cf>) \(setf\ seq-elt\) (store (sequence array) n) #f(compiled-function (store sequence n) #<bytecode -0x1d67862086490644>) (store (sequence cons) n) #f(compiled-function (store sequence n) #<bytecode -0x1d67872427f09658>) seq-length (sequence) "Return the number of elements of SEQUENCE.\n\n(fn SE..." #f(compiled-function (sequence) #<bytecode -0x47e8175a7f02ab8>)] 6)
  require(seq)
  byte-code("\300\301!\210\300\302!\207" [require cl-lib seq] 2)
  cl-some(identity (nil nil nil nil nil))
  use-package-normalize-keywords(general (:init (defalias 'define-key! #'general-def) (defalias 'undefine-key! #'general-unbind) :config (add-hook 'doom-after-init-modules-hook #'general-auto-unbind-keys)))
  #f(compiled-function (name &rest args) "Declare an Emacs package by specifying a group of configuration options.\n\nFor full documentation, please see the README file that came with\nthis file.  Usage:\n\n  (use-package package-name\n     [:keyword [option]]...)\n\n:init            Code to run before PACKAGE-NAME has been loaded.\n:config          Code to run after PACKAGE-NAME has been loaded.  Note that\n                 if loading is deferred for any reason, this code does not\n                 execute until the lazy load has occurred.\n:preface         Code to be run before everything except `:disabled'; this\n                 can be used to define functions for use in `:if', or that\n                 should be seen by the byte-compiler.\n\n:mode            Form to be added to `auto-mode-alist'.\n:magic           Form to be added to `magic-mode-alist'.\n:magic-fallback  Form to be added to `magic-fallback-mode-alist'.\n:interpreter     Form to be added to `interpreter-mode-alist'.\n\n:commands        Define autoloads for commands that will be defined by the\n                 package.  This is useful if the package is being lazily\n                 loaded, and you wish to conditionally call functions in your\n                 `:init' block that are defined in the package.\n:hook            Specify hook(s) to attach this package to.\n\n:bind            Bind keys, and define autoloads for the bound commands.\n:bind*           Bind keys, and define autoloads for the bound commands,\n                 *overriding all minor mode bindings*.\n:bind-keymap     Bind a key prefix to an auto-loaded keymap defined in the\n                 package.  This is like `:bind', but for keymaps.\n:bind-keymap*    Like `:bind-keymap', but overrides all minor mode bindings\n\n:defer           Defer loading of a package -- this is implied when using\n                 `:commands', `:bind', `:bind*', `:mode', `:magic', `:hook',\n                 `:magic-fallback', or `:interpreter'.  This can be an integer,\n                 to force loading after N seconds of idle time, if the package\n                 has not already been loaded.\n:after           Delay the use-package declaration until after the named modules\n                 have loaded. Once load, it will be as though the use-package\n                 declaration (without `:after') had been seen at that moment.\n:demand          Prevent the automatic deferred loading introduced by constructs\n                 such as `:bind' (see `:defer' for the complete list).\n\n:if EXPR         Initialize and load only if EXPR evaluates to a non-nil value.\n:disabled        The package is ignored completely if this keyword is present.\n:defines         Declare certain variables to silence the byte-compiler.\n:functions       Declare certain functions to silence the byte-compiler.\n:load-path       Add to the `load-path' before attempting to load the package.\n:diminish        Support for diminish.el (if installed).\n:delight         Support for delight.el (if installed).\n:custom          Call `Custom-set' or `set-default' with each variable\n                 definition without modifying the Emacs `custom-file'.\n                 (compare with `custom-set-variables').\n:custom-face     Call `custom-set-faces' with each face definition.\n:ensure          Loads the package using package.el if necessary.\n:pin             Pin the package to an archive." #<bytecode -0x1538d1be206bf279>)(general :init (defalias 'define-key! #'general-def) (defalias 'undefine-key! #'general-unbind) :config (add-hook 'doom-after-init-modules-hook #'general-auto-unbind-keys))
  macroexpand((use-package general :init (defalias 'define-key! #'general-def) (defalias 'undefine-key! #'general-unbind) :config (add-hook 'doom-after-init-modules-hook #'general-auto-unbind-keys)))
  internal-macroexpand-for-load((use-package general :init (defalias 'define-key! #'general-def) (defalias 'undefine-key! #'general-unbind) :config (add-hook 'doom-after-init-modules-hook #'general-auto-unbind-keys)) nil)
  eval-buffer(#<buffer  *load*-626011> nil "/home/zpb/.emacs.d/lisp/doom-keybinds.el" nil t)  ; Reading at buffer position 4269
  load-with-code-conversion("/home/zpb/.emacs.d/lisp/doom-keybinds.el" "/home/zpb/.emacs.d/lisp/doom-keybinds.el" nil nil)
  require(doom-keybinds)
  doom-initialize-core-modules()
  (if no-config-p nil (if (or init-file-debug noninteractive) (progn (let ((inhibit-message (not init-file-debug))) (message "%s" (propertize (format (concat "* [%.06f] " "Initializing core modules") (float-time ...)) 'face 'font-lock-doc-face))))) (doom-initialize-core-modules))
  (progn (setq doom-init-modules-p t) (if no-config-p nil (if (or init-file-debug noninteractive) (progn (let ((inhibit-message (not init-file-debug))) (message "%s" (propertize (format ... ...) 'face 'font-lock-doc-face))))) (doom-initialize-core-modules)) (let* ((init-p (and t (condition-case e (load (let ... ...) t 'nomessage) ((debug doom-error) (signal ... ...)) ((debug error) (doom--handle-load-error e ... doom-user-dir)))))) (if init-p (progn (if (or init-file-debug noninteractive) (progn (let (...) (message "%s" ...)))) (maphash (doom-module-loader doom-module-init-file) doom-modules) (doom-run-hooks 'doom-before-init-modules-hook) (if no-config-p nil (maphash (doom-module-loader doom-module-config-file) doom-modules) (doom-run-hooks 'doom-init-modules-hook) (condition-case e (load (let ... ...) t 'nomessage) ((debug doom-error) (signal ... ...)) ((debug error) (doom--handle-load-error e ... doom-user-dir))) (if custom-file (progn (load custom-file ... ...))))) nil)))
  (if (or force-p (not doom-init-modules-p)) (progn (setq doom-init-modules-p t) (if no-config-p nil (if (or init-file-debug noninteractive) (progn (let ((inhibit-message ...)) (message "%s" (propertize ... ... ...))))) (doom-initialize-core-modules)) (let* ((init-p (and t (condition-case e (load ... t ...) (... ...) (... ...))))) (if init-p (progn (if (or init-file-debug noninteractive) (progn (let ... ...))) (maphash (doom-module-loader doom-module-init-file) doom-modules) (doom-run-hooks 'doom-before-init-modules-hook) (if no-config-p nil (maphash (doom-module-loader doom-module-config-file) doom-modules) (doom-run-hooks 'doom-init-modules-hook) (condition-case e (load ... t ...) (... ...) (... ...)) (if custom-file (progn ...)))) nil))))
  doom-initialize-modules()
  eval-buffer(#<buffer  *load*> nil "/home/zpb/.emacs.d/lisp/doom-start.el" nil t)  ; Reading at buffer position 9574
  load-with-code-conversion("/home/zpb/.emacs.d/lisp/doom-start.el" "/home/zpb/.emacs.d/lisp/doom-start.el" t nil)
  load("/home/zpb/.emacs.d/lisp/doom-start" noerror nomessage)
  #f(compiled-function (arg1 &optional arg2 arg3) #<bytecode 0x1c8d26bc029f5aa7>)((closure ((args #f(compiled-function () #<bytecode 0x10058f7aeb862674>) #f(compiled-function () #<bytecode -0x1f3c686ddc0ca9b5>) t) (init-file . "/home/zpb/.emacs.d/lisp/doom-start") t) nil (or init-file (expand-file-name "init.el" user-emacs-directory))) (closure ((args #f(compiled-function () #<bytecode 0x10058f7aeb862674>) #f(compiled-function () #<bytecode -0x1f3c686ddc0ca9b5>) t) (init-file . "/home/zpb/.emacs.d/lisp/doom-start") t) nil (expand-file-name "safe-mode@static/init.el" doom-profiles-dir)) t)
  apply(#f(compiled-function (arg1 &optional arg2 arg3) #<bytecode 0x1c8d26bc029f5aa7>) ((closure ((args #f(compiled-function () #<bytecode 0x10058f7aeb862674>) #f(compiled-function () #<bytecode -0x1f3c686ddc0ca9b5>) t) (init-file . "/home/zpb/.emacs.d/lisp/doom-start") t) nil (or init-file (expand-file-name "init.el" user-emacs-directory))) (closure ((args #f(compiled-function () #<bytecode 0x10058f7aeb862674>) #f(compiled-function () #<bytecode -0x1f3c686ddc0ca9b5>) t) (init-file . "/home/zpb/.emacs.d/lisp/doom-start") t) nil (expand-file-name "safe-mode@static/init.el" doom-profiles-dir)) t))
  startup--load-user-init-file(#f(compiled-function () #<bytecode 0x10058f7aeb862674>) #f(compiled-function () #<bytecode -0x1f3c686ddc0ca9b5>) t)
  command-line()
  normal-top-level()

The message line at the bottom of the screen says:

Symbol's value as variable is void: general-override-mode-map

What did you expect to happen?

Perform doom up, run emacs and have doom load as usual.

Steps to reproduce

  1. Use WSL2.
  2. Run doom up and allow process to complete.
  3. Open emacs using emacs in shell.
  4. (Not sure if necessary) Close emacs shortly after first run.
  5. Open emacs and the error will appear.

Attempted Troubleshooting

My amateurish attempts to fix this include the following:

  1. Reboot both WSL2 session and Windows 10 desktop.
  2. Attempt doom up for latest 22.04 LTS Ubuntu or openSUSE Tumbleweed (both under WSL2)
  3. Because of indication of error in :vertico in the initial error, change :completion vertico to :completion ivy
  4. doom clean && doom build && doom sync -u
  5. Delete .local/straight/ and doom sync -u
  6. Delete all of .emacs.d/ then git pull doomemacs and run doom install
  7. Adding to my init.el (setq native-comp-async-jobs-number 1). (It just took longer to compile, then failed to work.)

When performing (6), I find that doom loads the first time when I call emacs, and continues to work as long as I have the frame open, but after closing (C-x C-c) subsequent uses of emacs doom fails to load.

On my native openSUSE Tumbleweed desktop, this error does not occur so it may be related to WSL2.

May be related to the changes in tweak: disable ahead-of-time native compilation · doomemacs/doomemacs@3853dff · GitHub discussed here Warnings and slowness at startup due to native-compilation ?

I am unable to load doom/sandbox to try booting vanilla doom.

System information


Loading data dump...

Happy to share my init.el and config.el if necessary.

In case an image is useful, this is what the application looks like upon opening. This is true for both Ubuntu WSL2 and openSUSE Tumbleweed WSL2.

A little more information about my troubleshooting experience.

I have found that this error appears after the second time I allow native-compilation to proceed.

To be specific, here is what I need to do to reproduce the error:

  1. Using WSL2, install doom emacs.
  2. Open emacs, and allow native compilation to complete.
  3. Close emacs (C-c C-x)
  4. Open emacs again, this will work normally. Allow native compilation to complete.
  5. Close emacs (C-c C-x)
  6. Open emacs a third time. This time the error will occur, and every time it is opened thereafter.

This is likely caused by some breaking commits in the past week (Doom is in the middle of a bumpy transition to 3.0). I’ve pushed another batch just today, which includes a slew of bugfixes. See if updating Doom resolves your issue.

If doom upgrade doesn’t work, you may have to update manually:

cd ~/.emacs.d
git pull
doom sync -u

I am also having this exact issue on WSL 1. I performed a manual update, but the behavior is the same.

Updating did not solve my issue (either by doom up or how you mentioned above). This seems to be a very strange bug to me, even when I run Ubuntu in a Hyper-V VM this appears. My desktop OpenSUSE Tumbleweed computer works with the same .doom.d/ directory.

I had the same issue after a doom upgrade late last week. No matter what I did I could not make it work. Even a complete deinstallation and reinstallation didn’t help.

I had to copy the .emacs.d and the .doom.d folders from the computer where it still worked to the one that had the problem. That solved the issue.

I hope this issue will go away once 3.0 is released.

1 Like

I’m getting this same error as well on OpenSuse (tumbleweed), emacs 28.1

If I completely do git clean -xffd in the doom emacs directory (wiping away the entire .local directory) and rebuild it’s fine, but when I restart Emacs it doesn’t work…most of the time.

I get the same error as @dillydogg, where it finds gv-setter as an invalid function definition despite that being part of Emacs, iirc.

This apparently is not unknown.

For those interested, there is a sister complaint on the doomemacs github at the following link:

In my hands, reverting to b36931dd453d18f62be77cf1440e94d0510096d5 reverted the regression. (fix(lib): doom-exec-process use doom-print--format · doomemacs/doomemacs@b36931d · GitHub)

Others in that thread have said that reverting to 5ebc2528d88aafcb1f2606bbb212170c35daad7f also works. (perf(lib): use symbol plist for fn! lookup table · doomemacs/doomemacs@5ebc252 · GitHub)

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.