Turning on native compilation in Emacs

After turning on native compilation via the --with-native-compilation flag in my local build, I ran into an issue bootstrapping straight.el:

 ■  Warning (initialization): An error occurred while loading ‘/Users/jeffkreeftmeijer/.emacs.d/init.el’:

Symbol's value as variable is void: native-comp-deferred-compilation-deny-list

To ensure normal operation, you should investigate and remove the
cause of the error in your initialization file.  Start Emacs with
the ‘--debug-init’ option to view a complete error backtrace.
 ■  Warning (comp): straight.el:5236:33: Warning: ‘native-comp-deferred-compilation-deny-list’ is an obsolete variable (as of 29.1); use ‘native-comp-jit-compilation-deny-list’ instead.
 ■  Warning (comp): straight.el:5234:19: Warning: ‘native-comp-deferred-compilation-deny-list’ is an obsolete variable (as of 29.1); use ‘native-comp-jit-compilation-deny-list’ instead.

This was caused by the native-comp-deferred-compilation-deny-list variable being renamed to native-comp-jit-compilation-deny-list. A path for this already landed in straight.el’s develop branch, but I was on master.

Switch to straight.el’s develop branch by setting straight-repository-branch before the bootstrap code is executed:

(setq straight-repository-branch "develop")

Make sure you’re on ad1b02e or newer. After updating your init file, remove straight’s repository directory to force a package update:

rm -rf ~/.emacs.d/straight/repos/straight.el

The first time Emacs starts, it will natively compile packages. This produces more warnings that were ondoubtedly already present, but are now printed to the *Warnings* buffer during compilation. These are printed on first startup when building the eln-cache:

■  Warning (comp): evil-vars.el:406:2: Warning: defvar `evil-inhibit-esc' docstring has wrong usage of unescaped single quotes (use \= or different quoting)
■  Warning (comp): evil-vars.el:1241:2: Warning: custom-declare-variable `evil-ex-search-vim-style-regexp' docstring has wrong usage of unescaped single quotes (use \= or different quoting)
■  Warning (comp): evil-vars.el:1289:2: Warning: custom-declare-variable `evil-ex-search-incremental' docstring has wrong usage of unescaped single quotes (use \= or different quoting)
■  Warning (comp): evil-vars.el:1312:2: Warning: custom-declare-variable `evil-ex-substitute-global' docstring has wrong usage of unescaped single quotes (use \= or different quoting)
■  Warning (comp): evil-vars.el:1800:2: Warning: defvar `evil-fold-list' docstring has wrong usage of unescaped single quotes (use \= or different quoting)
■  Warning (comp): evil-vars.el:1969:2: Warning: defvar `evil-ex-search-direction' docstring has wrong usage of unescaped single quotes (use \= or different quoting)
■  Warning (comp): evil-vars.el:2090:2: Warning: defvar `evil-redo-function' docstring has wrong usage of unescaped single quotes (use \= or different quoting)
■  Warning (comp): evil-common.el:136:2: Warning: docstring has wrong usage of unescaped single quotes (use \= or different quoting)
■  Warning (comp): evil-common.el:1114:2: Warning: docstring has wrong usage of unescaped single quotes (use \= or different quoting)
■  Warning (comp): evil-common.el:1125:2: Warning: docstring has wrong usage of unescaped single quotes (use \= or different quoting)
■  Warning (comp): evil-common.el:1132:2: Warning: docstring has wrong usage of unescaped single quotes (use \= or different quoting)
■  Warning (comp): evil-common.el:2776:2: Warning: docstring has wrong usage of unescaped single quotes (use \= or different quoting)
■  Warning (comp): evil-common.el:3113:2: Warning: docstring has wrong usage of unescaped single quotes (use \= or different quoting)
■  Warning (comp): evil-common.el:3144:2: Warning: docstring has wrong usage of unescaped single quotes (use \= or different quoting)
■  Warning (comp): evil-common.el:3336:2: Warning: docstring has wrong usage of unescaped single quotes (use \= or different quoting)
■  Warning (comp): evil-common.el:3770:2: Warning: docstring has wrong usage of unescaped single quotes (use \= or different quoting)
■  Warning (comp): evil-common.el:3880:2: Warning: docstring has wrong usage of unescaped single quotes (use \= or different quoting)
■  Warning (comp): evil-core.el:555:2: Warning: docstring has wrong usage of unescaped single quotes (use \= or different quoting)
■  Warning (comp): evil-core.el:603:2: Warning: docstring has wrong usage of unescaped single quotes (use \= or different quoting)
■  Warning (comp): evil-core.el:946:2: Warning: docstring has wrong usage of unescaped single quotes (use \= or different quoting)
■  Warning (comp): evil-core.el:1002:2: Warning: docstring has wrong usage of unescaped single quotes (use \= or different quoting)
■  Warning (comp): evil-repeat.el:235:2: Warning: docstring wider than 80 characters
■  Warning (comp): evil-repeat.el:342:2: Warning: docstring wider than 80 characters
■  Warning (comp): evil-macros.el:167:2: Warning: docstring has wrong usage of unescaped single quotes (use \= or different quoting)
■  Warning (comp): evil-ex.el:144:26: Warning: docstring has wrong usage of unescaped single quotes (use \= or different quoting)
■  Warning (comp): evil-ex.el:675:2: Warning: docstring has wrong usage of unescaped single quotes (use \= or different quoting)
■  Warning (comp): evil-search.el:305:2: Warning: docstring has wrong usage of unescaped single quotes (use \= or different quoting)
■  Warning (comp): evil-command-window.el:167:47: Warning: Unused lexical argument `ignored'
■  Warning (comp): evil-search.el:325:2: Warning: docstring has wrong usage of unescaped single quotes (use \= or different quoting)
■  Warning (comp): evil-search.el:420:2: Warning: docstring has wrong usage of unescaped single quotes (use \= or different quoting)
■  Warning (comp): evil-search.el:822:2: Warning: docstring has wrong usage of unescaped single quotes (use \= or different quoting)
■  Warning (comp): evil-search.el:944:2: Warning: docstring has wrong usage of unescaped single quotes (use \= or different quoting)
■  Warning (comp): evil-search.el:1270:2: Warning: docstring has wrong usage of unescaped single quotes (use \= or different quoting)
■  Warning (comp): evil-commands.el:297:2: Warning: docstring has wrong usage of unescaped single quotes (use \= or different quoting)
■  Warning (comp): evil-commands.el:593:2: Warning: docstring has wrong usage of unescaped single quotes (use \= or different quoting)
■  Warning (comp): evil-commands.el:2957:2: Warning: docstring has wrong usage of unescaped single quotes (use \= or different quoting)
■  Warning (comp): evil-commands.el:3756:2: Warning: docstring has wrong usage of unescaped single quotes (use \= or different quoting)
■  Warning (comp): org.el:18654:21: Warning: reference to free variable ‘org-agenda-restrict’
■  Warning (comp): org.el:18674:42: Warning: reference to free variable ‘org-agenda-restrict-begin’
■  Warning (comp): org.el:18675:42: Warning: reference to free variable ‘org-agenda-restrict-end’
■  Warning (comp): org-roam.el:149:2: Warning: custom-declare-variable `org-roam-list-files-commands' docstring wider than 80 characters
■  Warning (comp): org-roam.el:149:2: Warning: custom-declare-variable `org-roam-list-files-commands' docstring has wrong usage of unescaped single quotes (use \= or different quoting)
■  Warning (comp): org-roam.el:212:29: Warning: the function ‘org-roam-descendant-of-p’ is not known to be defined.
■  Warning (comp): org-roam-utils.el:75:12: Warning: Unused lexical variable `c'
■  Warning (comp): org-roam-utils.el:88:27: Warning: ‘point-at-bol’ is an obsolete function (as of 29.1); use ‘line-beginning-position’ or ‘pos-bol’ instead.
■  Warning (comp): org-roam-db.el:199:22: Warning: variable ‘_’ not left unused
■  Warning (comp): org-roam-db.el:198:31: Warning: ‘emacsql-process’ is an obsolete function (as of Emacsql 4.0.0); underlying slot is for internal use only.
■  Warning (comp): org-roam-db.el:377:6: Warning: ‘org-format-time-string’ is an obsolete function (as of 9.6); use ‘format-time-string’ instead.
■  Warning (comp): org-roam-db.el:382:6: Warning: ‘org-format-time-string’ is an obsolete function (as of 9.6); use ‘format-time-string’ instead.
■  Warning (comp): org-roam-db.el:410:19: Warning: Unused lexical variable `bounds'
■  Warning (comp): org-roam-node.el:475:4: Warning: ‘org-show-context’ is an obsolete function (as of 9.6); use ‘org-fold-show-context’ instead.
■  Warning (comp): org-roam-node.el:523:2: Warning: docstring wider than 80 characters
■  Warning (comp): org-roam-node.el:1082:17: Warning: Unused lexical variable `crm-separator'
■  Warning (comp): org-roam-id.el:89:6: Warning: ‘org-show-context’ is an obsolete function (as of 9.6); use ‘org-fold-show-context’ instead.
■  Warning (comp): org-roam-id.el:110:29: Warning: reference to free variable ‘org-roam-directory’
■  Warning (comp): org-roam-id.el:111:16: Warning: Unused lexical variable `org-roam-directory'
■  Warning (comp): org-roam-id.el:113:54: Warning: reference to free variable ‘org-roam-verbose’
■  Warning (comp): org-roam-id.el:112:19: Warning: the function ‘org-roam-list-files’ is not known to be defined.
■  Warning (comp): org-roam-id.el:62:47: Warning: the function ‘org-roam-node-point’ is not known to be defined.
■  Warning (comp): org-roam-id.el:56:23: Warning: the function ‘org-roam-node-file’ is not known to be defined.
■  Warning (comp): org-roam-id.el:55:35: Warning: the function ‘org-roam-node-create’ is not known to be defined.
■  Warning (comp): org-roam-id.el:55:16: Warning: the function ‘org-roam-populate’ is not known to be defined.
■  Warning (comp): org-roam-id.el:43:7: Warning: the function ‘org-roam-up-heading-or-point-min’ is not known to be defined.
■  Warning (comp): org-roam-id.el:41:22: Warning: the function ‘org-roam-db-node-p’ is not known to be defined.
■  Warning (comp): org-roam-capture.el:714:19: Warning: variable ‘_’ not left unused
■  Warning (comp): org-roam-mode.el:320:2: Warning: docstring has wrong usage of unescaped single quotes (use \= or different quoting)
■  Warning (comp): org-roam-mode.el:444:30: Warning: ‘org-show-context’ is an obsolete function (as of 9.6); use ‘org-fold-show-context’ instead.
■  Warning (comp): org-roam-mode.el:630:30: Warning: ‘org-show-context’ is an obsolete function (as of 9.6); use ‘org-fold-show-context’ instead.
■  Warning (comp): eww.el.gz:1196:59: Warning: the function ‘imagep’ is not known to be defined.
■  Warning (comp): org-auto-tangle.el:139:34: Warning: Empty let body

More warnings are printed later when opening files that require language modes. Aside from that, everything has been stable.

To hide these warnings, unset native-comp-async-report-warnings-errors in early-init.el, before any packages load:

(setq native-comp-async-report-warnings-errors nil)