unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Andrea Corallo <akrl@sdf.org>
To: 55305@debbugs.gnu.org
Cc: rswgnu@gmail.com, monnier@iro.umontreal.ca, akrl@sdf.com, rsw@gnu.org
Subject: bug#55305: 28.0.50: With async nativecomp, package manager fails to load hyperbole-autoloads.el before compilation
Date: Mon, 16 May 2022 09:34:02 +0000	[thread overview]
Message-ID: <xjf35h9akj9.fsf@ma.sdf.org> (raw)
In-Reply-To: <jwvee0ug7up.fsf-monnier+emacs@gnu.org> (Stefan Monnier via's message of "Sun, 15 May 2022 11:59:05 -0400")

Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of
text editors" <bug-gnu-emacs@gnu.org> writes:

> 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 dossier de ce type, el-mock
>
> I also noticed the following warning in *Messages*:
>
>     hibtypes:0: Warning: Not registering prefix "pa".  Affects: ("parse-label-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:
>       … => (load "hbut.el") => (macroexpand-all …) => (macroexpand (eval-and-compile …)) => (load "hbdata.el") => (load "hgnus.el") => (load "hvar.el") => (load "hsettings.el") => (load "hui-em-but.el") => (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 <temp-file>
>
> where <temp-file>'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-compile-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-eln-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

Hi Stefan,

thanks for having debugged this.

I see no harm in propagating `package-user-dir' `package-directory-list'
to the async worker if it's useful, but I'm with Eli in not calling
`package-activate-all' when compiling.

An idea would be that if the code being compiled needs that it could
leverage `native-comp-async-env-modifier-form' for that.

Best Regards

  Andrea





  parent reply	other threads:[~2022-05-16  9:34 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-07 20:05 bug#55305: 28.0.50: With async nativecomp, package manager fails to load hyperbole-autoloads.el before compilation Robert Weiner
2022-05-08  5:09 ` Eli Zaretskii
2022-05-12  5:14   ` Robert Weiner
2022-05-12  5:51     ` Eli Zaretskii
2022-05-12  6:21       ` Robert Weiner
2022-05-12  7:22         ` Eli Zaretskii
2022-05-14 14:47           ` Robert Weiner
2022-05-14 15:05             ` Eli Zaretskii
2022-05-14 22:40               ` Robert Weiner
2022-05-15  5:15                 ` Eli Zaretskii
2022-05-15 15:59 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-05-15 16:17   ` Eli Zaretskii
2022-05-15 16:22     ` Eli Zaretskii
2022-05-15 16:47       ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-05-15 17:01         ` Eli Zaretskii
2022-05-15 17:15           ` Eli Zaretskii
2022-05-15 20:12           ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-05-16  2:31             ` Eli Zaretskii
2022-05-16 16:40               ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-05-16 16:57                 ` Eli Zaretskii
2022-05-16 17:17                   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-05-15 20:39           ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-05-16  2:33             ` Eli Zaretskii
2022-05-16  9:34   ` Andrea Corallo [this message]
2022-05-16 16:42     ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-05-16 16:59       ` Eli Zaretskii
2022-05-16 22:27         ` Robert Weiner
2022-05-17  2:27           ` Eli Zaretskii
2023-06-07 21:36             ` 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

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=xjf35h9akj9.fsf@ma.sdf.org \
    --to=akrl@sdf.org \
    --cc=55305@debbugs.gnu.org \
    --cc=akrl@sdf.com \
    --cc=monnier@iro.umontreal.ca \
    --cc=rsw@gnu.org \
    --cc=rswgnu@gmail.com \
    /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 public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).