From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#55305: 28.0.50: With async nativecomp, package manager fails to load hyperbole-autoloads.el before compilation Date: Sun, 15 May 2022 11:59:05 -0400 Message-ID: References: Reply-To: Stefan Monnier Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="4881"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) Cc: rswgnu@gmail.com, Andrea Corallo , 55305@debbugs.gnu.org To: Robert Weiner Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun May 15 18:01:44 2022 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nqGgh-00014R-CQ for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 15 May 2022 18:01:43 +0200 Original-Received: from localhost ([::1]:60378 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nqGgg-0000iA-3Y for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 15 May 2022 12:01:42 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:49020) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nqGf4-0000TM-RY for bug-gnu-emacs@gnu.org; Sun, 15 May 2022 12:00:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:56592) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nqGf4-0007TY-HH for bug-gnu-emacs@gnu.org; Sun, 15 May 2022 12:00:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nqGf4-0002cz-E6 for bug-gnu-emacs@gnu.org; Sun, 15 May 2022 12:00:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 15 May 2022 16:00:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 55305 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: moreinfo Original-Received: via spool by 55305-submit@debbugs.gnu.org id=B55305.165263035710015 (code B ref 55305); Sun, 15 May 2022 16:00:02 +0000 Original-Received: (at 55305) by debbugs.gnu.org; 15 May 2022 15:59:17 +0000 Original-Received: from localhost ([127.0.0.1]:50489 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nqGeL-0002bS-0U for submit@debbugs.gnu.org; Sun, 15 May 2022 11:59:17 -0400 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:1896) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nqGeJ-0002bE-Ad for 55305@debbugs.gnu.org; Sun, 15 May 2022 11:59:15 -0400 Original-Received: from pmg2.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 7F5FB806F8; Sun, 15 May 2022 11:59:09 -0400 (EDT) Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 49EE480543; Sun, 15 May 2022 11:59:07 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1652630347; bh=PBXxYLblmXjLrssLVXMlIxyE9gGEIDmSWG8BOgkYiYY=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=DdhTaLub4YMggMH3o0P5j16fUwBEk2EJ6pUj66lSxI1a3ovuWqdezHuT7tf/tae4y dklWfZEwFL4h/VhWH/bEypViiNdsMFTj32E7Y6muGF5uosIi2DgH9mc94YXaxKzyK5 5FgAOPAoWjYb14zuI8G4QMT8VD5+tpstLqYNwkad4/wY/aoq3VXYtaNzye36fNWTLG x+yjHvkfE2BGrHM3kXkgj6bYvJlexYzFX8LYC05y3616QKA8yY0O4u1CNnHPvGLmZ0 wPXjjhbhQs4iI/fUpTnXLRfZSuQPzftH7AUVAThllt0cvDM4mJ6bGnPRSobDXu2ejw BGpjp6p/roqlA== Original-Received: from pastel (unknown [45.72.221.51]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id E71F21205FF; Sun, 15 May 2022 11:59:06 -0400 (EDT) In-Reply-To: (Robert Weiner's message of "Sat, 7 May 2022 16:05:17 -0400") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:232329 Archived-At: First, sorry for not chiming in earlier (I don't subscribe to the emacs-bugs list, so I only see those bugs that are explicitly forwarded to me). Robert Weiner [2022-05-07 16:05:17] wrote: > Tested under Emacs 28.1 and a recent tip of the Emacs git repo for Emacs > 29 with asynchronous native compilation enabled: > > M-x package-install RET hyperbole RET Hmm... I tried to reproduce it here, with `emacs -Q` this gives me (during the normal compilation), among a bunch of lesser warnings: Compiling file ~/.emacs.d/elpa/hyperbole-8.0.0/test/kexport-tests.el at= Sun May 15 11:01:59 2022 kexport-tests.el:20:2: Error: Cannot open load file: Aucun fichier ou d= ossier de ce type, el-mock I also noticed the following warning in *Messages*: hibtypes:0: Warning: Not registering prefix "pa". Affects: ("parse-lab= el-and-file" "pathname" "pathname-line-and-column" "patch-msg") which points at some namespace uncleanliness in your code. Oh, and: Warning: Eager macro-expansion skipped due to cycle: =E2=80=A6 =3D> (load "hbut.el") =3D> (macroexpand-all =E2=80=A6) =3D>= (macroexpand (eval-and-compile =E2=80=A6)) =3D> (load "hbdata.el") =3D> (l= oad "hgnus.el") =3D> (load "hvar.el") =3D> (load "hsettings.el") =3D> (load= "hui-em-but.el") =3D> (load "hbut.el") Waiting for git... [2 times] You might wan to try and fix this one. > fails to load the hyperbole-autoloads.el file before the > async native compiler and byte compiler produce these errors since > the autoloaded var:append function is not defined: Indeed. > Warning (comp): ~/.emacs.d/elpa/hyperbole-8.0.0/hui-em-but.el: Error: > Symbol's function definition is void var:append Disable showing Disable > logging It took a bit of while to get there (many other things to native-compile before this, apparently), but yes, I'm able to reproduce it. Looking at `comp-run-async-workers` in `comp.el`, I see that the async compilation basically does: emacs -q -l where 's content is basically the `expr` below: do (let* ((expr `((require 'comp) ,(when (boundp 'backtrace-line-length) `(setf backtrace-line-length ,backtrace-line-= length)) (setf comp-file-preloaded-p ,comp-file-preloaded= -p native-compile-target-directory ,native-co= mpile-target-directory native-comp-speed ,native-comp-speed native-comp-debug ,native-comp-debug native-comp-verbose ,native-comp-verbose comp-libgccjit-reproducer ,comp-libgccjit-= reproducer comp-async-compilation t native-comp-eln-load-path ',native-comp-el= n-load-path native-comp-compiler-options ',native-comp-compiler-options native-comp-driver-options ',native-comp-driver-options load-path ',load-path warning-fill-column most-positive-fixnum) ,native-comp-async-env-modifier-form (message "Compiling %s..." ,source-file) (comp--native-compile ,source-file ,(and load t)= ))) so the sync compilation is careful to preserve the current load-path via: load-path ',load-path which is why many of the files can be compiled correctly but it doesn't load the packages's autoloads like a normal session does. I suspect we should add a call to `package-activate-all` somewhere in the above code (and probably preserve `package-directory-list` and `package-user-dir` as well). I just tried to re-trigger the problem after applying the patch below [which also make this part of the code obey our 80-column convention, while at it] and it appears to be fixed (e.g. `hui-em-but.el` was successfully compiled). Andrea, any comment? Stefan diff --git a/lisp/emacs-lisp/comp.el b/lisp/emacs-lisp/comp.el index 237de52884b..aa49607462c 100644 --- a/lisp/emacs-lisp/comp.el +++ b/lisp/emacs-lisp/comp.el @@ -3926,22 +3926,27 @@ comp-run-async-workers (file-newer-than-file-p source-file (comp-el-to-eln-filename source-file))) do (let* ((expr `((require 'comp) - ,(when (boundp 'backtrace-line-length) - `(setf backtrace-line-length ,backtrace-line= -length)) - (setf comp-file-preloaded-p ,comp-file-preloade= d-p - native-compile-target-directory ,native-c= ompile-target-directory - native-comp-speed ,native-comp-speed - native-comp-debug ,native-comp-debug - native-comp-verbose ,native-comp-verbose - comp-libgccjit-reproducer ,comp-libgccjit= -reproducer - comp-async-compilation t - native-comp-eln-load-path ',native-comp-e= ln-load-path - native-comp-compiler-options - ',native-comp-compiler-options - native-comp-driver-options - ',native-comp-driver-options - load-path ',load-path - warning-fill-column most-positive-fixnum) + (setq comp-async-compilation t) + (setq warning-fill-column most-positive-fixnum) + ,(let ((set (list 'setq))) + (dolist (var '(comp-file-preloaded-p + native-compile-target-directo= ry + native-comp-speed + native-comp-debug + native-comp-verbose + comp-libgccjit-reproducer + native-comp-eln-load-path + native-comp-compiler-options + native-comp-driver-options + load-path + backtrace-line-length + package-user-dir + package-directory-list)) + (when (boundp var) + (push var set) + (push `',(symbol-value var) set))) + (nreverse set)) + (package-activate-all) ,native-comp-async-env-modifier-form (message "Compiling %s..." ,source-file) (comp--native-compile ,source-file ,(and load t= )))) @@ -3994,7 +3999,7 @@ comp-run-async-workers (run-hooks 'native-comp-async-all-done-hook) (with-current-buffer (get-buffer-create comp-async-buffer-name) (save-excursion - (let ((buffer-read-only nil)) + (let ((inhibit-read-only t)) (goto-char (point-max)) (insert "Compilation finished.\n")))) ;; `comp-deferred-pending-h' should be empty at this stage.