From: No Wayman <iarchivedmywholelife@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: acorallo@gnu.org, 64226@debbugs.gnu.org
Subject: bug#64226: 30.0.50; emacs-lisp-native-compile-and-load permission error
Date: Sat, 01 Jul 2023 15:14:16 -0400 [thread overview]
Message-ID: <87bkgvwe05.fsf@gmail.com> (raw)
In-Reply-To: <83r0prprki.fsf@gnu.org>
Eli Zaretskii <eliz@gnu.org> writes:
> perhaps you could describe how to
> reproduce starting from "emacs -Q" (and loading any packages or
> features you need for the minimal reproduction recipe). The way
> you
> were showing the problem until now obviously depends on your
> local
> setup, which is impossible to reproduce without knowing the
> details.
The instructions I gave here:
https://lists.gnu.org/archive/html/bug-gnu-emacs/2023-06/msg01224.html
reproduce the error on my end from emacs -Q with a minimal file.
To be crystal clear:
1. Save the following file to $HOME/test.el (or any path where the
user has write permissions):
--8<---------------cut here---------------start------------->8---
;; -*- lexical-binding: t; -*-
(defun +test () (message "PASS"))
--8<---------------cut here---------------end--------------->8---
2. emacs -Q $HOME/test.el
3. M-x emacs-lisp-native-compile-compile-and-load
4. Error is printed to message buffer.
I'm not sure how I can meaningfully pare it down from there.
> The main aspect of this which is completely unclear is: how come
> Emacs
> tries to write in the /usr/lib tree when compiling Lisp files
> from
> your home directory. This is not supposed to happen: Emacs
> should
> write to the eln-cache subdirectory of your ~/.emacs.d/
> directory.
That makes sense to me and I agree.
It looks like the critical path is in the file
`comp-spill-lap-function' method.
The comp-ctxt-output slot is set to (car (last
native-comp-eln-load-path)).
I don't know enough about the native-comp machinery to say whether
or not this is the appropriate solution, but let-binding
`native-compile-target-directory' to the car of
native-comp-eln-load-path in emacs-lisp-native-compile-and-load
compiles in the correct directory and avoids the error:
(defun emacs-lisp-native-compile-and-load ()
"Native-compile synchronously the current file (if it has
changed).
Load the compiled code when finished.
Use `emacs-lisp-byte-compile-and-load' in combination with
`native-comp-jit-compilation' set to t to achieve asynchronous
native compilation."
(interactive nil emacs-lisp-mode)
(emacs-lisp--before-compile-buffer)
(let ((byte+native-compile t)
(native-compile-target-directory (car
native-comp-eln-load-path))
(byte-to-native-output-buffer-file nil))
(when-let ((eln (native-compile buffer-file-name)))
(load (file-name-sans-extension (comp-write-bytecode-file
eln))))))
I'll leave the work of a proper patch to someone who is more
familiar with the system.
next prev parent reply other threads:[~2023-07-01 19:14 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-21 16:58 bug#64226: 30.0.50; emacs-lisp-native-compile-and-load permission error No Wayman
2023-06-22 15:34 ` Eli Zaretskii
2023-06-22 15:44 ` No Wayman
2023-06-22 16:12 ` Eli Zaretskii
2023-06-22 16:22 ` No Wayman
2023-06-22 17:16 ` Eli Zaretskii
2023-06-22 17:21 ` No Wayman
2023-06-22 17:53 ` Eli Zaretskii
2023-06-25 15:02 ` Andrea Corallo
2023-07-01 8:36 ` Eli Zaretskii
2023-07-01 15:28 ` No Wayman
2023-07-01 15:41 ` Eli Zaretskii
2023-07-01 19:14 ` No Wayman [this message]
2023-07-02 5:59 ` Eli Zaretskii
2023-07-02 6:08 ` No Wayman
2023-07-03 8:50 ` Andrea Corallo
2023-08-09 13:22 ` Andrea Corallo
2023-08-09 15:24 ` No Wayman
2023-08-09 16:29 ` Eli Zaretskii
2023-08-12 9:19 ` Eli Zaretskii
2023-08-12 15:42 ` Andrea Corallo
2023-08-12 16:56 ` Andrea Corallo
2023-08-12 17:22 ` Eli Zaretskii
2023-06-25 14:44 ` Andrea Corallo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87bkgvwe05.fsf@gmail.com \
--to=iarchivedmywholelife@gmail.com \
--cc=64226@debbugs.gnu.org \
--cc=acorallo@gnu.org \
--cc=eliz@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.