all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#55657: libgccjit is unusable
@ 2022-05-26 13:07 Liliana Marie Prikler
  2022-06-04 14:07 ` Remco van 't Veer
                   ` (3 more replies)
  0 siblings, 4 replies; 44+ messages in thread
From: Liliana Marie Prikler @ 2022-05-26 13:07 UTC (permalink / raw)
  To: 55657

Hi Guix,

with the release of Emacs 28.1, there has been some demand to enable
native-compilation.  While trying to set that up, I've come to realize
that no matter how I slice it, I can't make libgccjit usable.

My test:

$ cd /tmp
$ # fetch the "Hello World" [1] and insert it into gccjit-test.c
$ guix shell --pure gcc-toolchain@9 libgccjit@9 -- \
  gcc gccjit-test.c -o gccjit-test -lgccjit
$ ./gccjit-test
x86_64-unknown-linux-gnu-gcc-9.4.0: fatal error: cannot execute 'as':
execvp: No such file or directory
compilation terminated.

Welp, okay, so maybe testing gccjit outside of its installation does
not work.  What if we try it inside the shell (we can always propagate
libgccjit, no?)

guix shell gcc-toolchain@9 libgccjit@9 -- ./gccjit-test            
ld: cannot find crtbeginS.o: Datei oder Verzeichnis nicht gefunden
ld: cannot find -lgcc
ld: cannot find -lgcc
collect2: Fehler: ld gab 1 als Ende-Status zurück
libgccjit.so: error: error invoking gcc driver
NULL result

For the record, Emacs 28 fails with a different error during
configuration, though interestingly they use a smaller program and
appear to omit -lgccjit.
./conftest: error while loading shared libraries: libgccjit.so.0:
cannot open shared object file: No such file or directory

I'm at a loss.  Is there any way to make libgccjit actually usable?

[1] https://gcc.gnu.org/onlinedocs/jit/intro/tutorial01.html




^ permalink raw reply	[flat|nested] 44+ messages in thread

* bug#55657: libgccjit is unusable
  2022-05-26 13:07 bug#55657: libgccjit is unusable Liliana Marie Prikler
@ 2022-06-04 14:07 ` Remco van 't Veer
  2022-06-04 14:22 ` Tobias Geerinckx-Rice via Bug reports for GNU Guix
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 44+ messages in thread
From: Remco van 't Veer @ 2022-06-04 14:07 UTC (permalink / raw)
  To: Liliana Marie Prikler; +Cc: 55657

2022/05/26 15:07, Liliana Marie Prikler:

> Hi Guix,
>
> with the release of Emacs 28.1, there has been some demand to enable
> native-compilation.  While trying to set that up, I've come to realize
> that no matter how I slice it, I can't make libgccjit usable.

The guixrus channel has an emacs which seems to support gccjit.  I have
not tried it myself.

  https://git.sr.ht/~whereiseveryone/guixrus/

Especially:

  https://git.sr.ht/~whereiseveryone/guixrus/tree/master/item/guixrus/packages/emacs.scm
  https://git.sr.ht/~whereiseveryone/guixrus/tree/master/item/guixrus/packages/gcc.scm

Maybe you can borrow some knowledge there? ;-)

Cheers,
Remco




^ permalink raw reply	[flat|nested] 44+ messages in thread

* bug#55657: libgccjit is unusable
  2022-05-26 13:07 bug#55657: libgccjit is unusable Liliana Marie Prikler
  2022-06-04 14:07 ` Remco van 't Veer
@ 2022-06-04 14:22 ` Tobias Geerinckx-Rice via Bug reports for GNU Guix
  2022-06-04 14:25   ` Tobias Geerinckx-Rice via Bug reports for GNU Guix
  2022-06-28  0:53 ` John Kehayias via Bug reports for GNU Guix
  2022-08-09 18:37 ` bug#55657: [PATCH 0/6] Add native compilation to Emacs Liliana Marie Prikler
  3 siblings, 1 reply; 44+ messages in thread
From: Tobias Geerinckx-Rice via Bug reports for GNU Guix @ 2022-06-04 14:22 UTC (permalink / raw)
  To: 55657, liliana.prikler

Lily,

I think a lot of people are using emacs-native-comp from here: https://github.com/flatwhatson/guix-channel/blob/master/flat/packages/emacs.scm

I don't know if I've updated mine since your failed experiments, but it has worked forever...

Kind regards,

T G-R

Sent on the go.  Excuse or enjoy my brevity.




^ permalink raw reply	[flat|nested] 44+ messages in thread

* bug#55657: libgccjit is unusable
  2022-06-04 14:22 ` Tobias Geerinckx-Rice via Bug reports for GNU Guix
@ 2022-06-04 14:25   ` Tobias Geerinckx-Rice via Bug reports for GNU Guix
  2022-06-04 15:14     ` Liliana Marie Prikler
  0 siblings, 1 reply; 44+ messages in thread
From: Tobias Geerinckx-Rice via Bug reports for GNU Guix @ 2022-06-04 14:25 UTC (permalink / raw)
  To: 55657, liliana.prikler

Meant to include link to https://github.com/flatwhatson/guix-channel/blob/657da22f0229b978b7bf4e4d476f59f17f6a175f/flat/packages/gcc.scm#L27 which is where the majic happens

Kind regards,

T G-R

Sent on the go.  Excuse or enjoy my brevity.




^ permalink raw reply	[flat|nested] 44+ messages in thread

* bug#55657: libgccjit is unusable
  2022-06-04 14:25   ` Tobias Geerinckx-Rice via Bug reports for GNU Guix
@ 2022-06-04 15:14     ` Liliana Marie Prikler
  0 siblings, 0 replies; 44+ messages in thread
From: Liliana Marie Prikler @ 2022-06-04 15:14 UTC (permalink / raw)
  To: Tobias Geerinckx-Rice, 55657

Am Samstag, dem 04.06.2022 um 14:25 +0000 schrieb Tobias Geerinckx-
Rice:
> Meant to include link to
> https://github.com/flatwhatson/guix-channel/blob/657da22f0229b978b7bf4e4d476f59f17f6a175f/flat/packages/gcc.scm#L27
>  which is where the majic happens
I'm not personally using that channel, but I noticed this issue by
trying to adapt that recipe towards master.  Now there's a chance that
I've made an error in my copypasta game, but I'm pretty sure the
current state of libgccjit is not a good one regardless.

Cheers




^ permalink raw reply	[flat|nested] 44+ messages in thread

* bug#55657: libgccjit is unusable
  2022-05-26 13:07 bug#55657: libgccjit is unusable Liliana Marie Prikler
  2022-06-04 14:07 ` Remco van 't Veer
  2022-06-04 14:22 ` Tobias Geerinckx-Rice via Bug reports for GNU Guix
@ 2022-06-28  0:53 ` John Kehayias via Bug reports for GNU Guix
  2022-06-28  4:17   ` Liliana Marie Prikler
  2022-08-09 18:37 ` bug#55657: [PATCH 0/6] Add native compilation to Emacs Liliana Marie Prikler
  3 siblings, 1 reply; 44+ messages in thread
From: John Kehayias via Bug reports for GNU Guix @ 2022-06-28  0:53 UTC (permalink / raw)
  To: 55657@debbugs.gnu.org
  Cc: Andrew Whatson, Tobias Geerinckx-Rice, remco@remworks.net,
	Liliana Marie Prikler

Hello,

I currently use the flatwhatson channel (cc'ed on this email, hope that is okay Andrew!) and it has worked well for Emacs, though never tried anything else with libgccjit. It would be great to get this upstreamed in Guix, especially since libgccjit is a beast to build (more than emacs if I remember correctly).

Happy to help test and work on this, let me know anything I can do.

Thanks,
John




^ permalink raw reply	[flat|nested] 44+ messages in thread

* bug#55657: libgccjit is unusable
  2022-06-28  0:53 ` John Kehayias via Bug reports for GNU Guix
@ 2022-06-28  4:17   ` Liliana Marie Prikler
  2022-06-28  5:16     ` John Kehayias via Bug reports for GNU Guix
  0 siblings, 1 reply; 44+ messages in thread
From: Liliana Marie Prikler @ 2022-06-28  4:17 UTC (permalink / raw)
  To: John Kehayias, 55657@debbugs.gnu.org
  Cc: Andrew Whatson, Tobias Geerinckx-Rice, remco@remworks.net

Hi,

Am Dienstag, dem 28.06.2022 um 00:53 +0000 schrieb John Kehayias:
> Hello,
> 
> I currently use the flatwhatson channel (cc'ed on this email, hope
> that is okay Andrew!) and it has worked well for Emacs, though never
> tried anything else with libgccjit. It would be great to get this
> upstreamed in Guix, especially since libgccjit is a beast to build
> (more than emacs if I remember correctly).
Keyword here is "has worked for emacs".  I've tried porting the logic
from flatwhatson's channel over, but regardless of what I do, it
already fails in the configure step of Emacs (in a manner that's
reproducible outside as well).  Thus, I think this is a bug in
libgccjit (or perhaps our packaging of it) that simply happened to be
ignored during development of Emacs 28, but no longer in the release.

Cheers




^ permalink raw reply	[flat|nested] 44+ messages in thread

* bug#55657: libgccjit is unusable
  2022-06-28  4:17   ` Liliana Marie Prikler
@ 2022-06-28  5:16     ` John Kehayias via Bug reports for GNU Guix
  2022-08-03 21:13       ` John Kehayias via Bug reports for GNU Guix
  0 siblings, 1 reply; 44+ messages in thread
From: John Kehayias via Bug reports for GNU Guix @ 2022-06-28  5:16 UTC (permalink / raw)
  To: Liliana Marie Prikler
  Cc: Andrew Whatson, Tobias Geerinckx-Rice, remco@remworks.net,
	55657@debbugs.gnu.org

Hi,

------- Original Message -------
On Tuesday, June 28th, 2022 at 12:17 AM, Liliana Marie Prikler wrote:

> Keyword here is "has worked for emacs". I've tried porting the logic
> from flatwhatson's channel over, but regardless of what I do, it
> already fails in the configure step of Emacs (in a manner that's
> reproducible outside as well). Thus, I think this is a bug in
> libgccjit (or perhaps our packaging of it) that simply happened to be
> ignored during development of Emacs 28, but no longer in the release.
>

Sorry, I should be extra clear that I mean has in the past and continues to work for Emacs. I've been using emacs-pgtk-native-comp through the flatwhatson channel from well before v28 was released. Currently I'm using emacs-pgtk-native-comp-28.1.50-223.3ddccb5. Everything has built, installed, and run fine for as long as I have been using it. Just in case that was in question, and as a point of reference.

Anyway, I'll try to reproduce when I can (tomorrow likely) what you reported in the first message using this setup, if that is of use.

Appreciate the efforts from everyone working on this!
John




^ permalink raw reply	[flat|nested] 44+ messages in thread

* bug#55657: libgccjit is unusable
  2022-06-28  5:16     ` John Kehayias via Bug reports for GNU Guix
@ 2022-08-03 21:13       ` John Kehayias via Bug reports for GNU Guix
  2022-08-04  4:26         ` Liliana Marie Prikler
  0 siblings, 1 reply; 44+ messages in thread
From: John Kehayias via Bug reports for GNU Guix @ 2022-08-03 21:13 UTC (permalink / raw)
  To: Liliana Marie Prikler
  Cc: Andrew Whatson, Tobias Geerinckx-Rice, remco@remworks.net,
	55657@debbugs.gnu.org

Hi everyone,

Found out some useful info and a work around for the original reported issue of the simple "hello world" of gccjit not working.


------- Original Message -------
On Tuesday, June 28th, 2022 at 1:16 AM, John Kehayias wrote:

> Hi,
>
> ------- Original Message -------
> On Tuesday, June 28th, 2022 at 12:17 AM, Liliana Marie Prikler wrote:
>
> > Keyword here is "has worked for emacs". I've tried porting the logic
> > from flatwhatson's channel over, but regardless of what I do, it
> > already fails in the configure step of Emacs (in a manner that's
> > reproducible outside as well). Thus, I think this is a bug in
> > libgccjit (or perhaps our packaging of it) that simply happened to be
> > ignored during development of Emacs 28, but no longer in the release.
>
>
> Sorry, I should be extra clear that I mean has in the past and continues to work for Emacs. I've been using emacs-pgtk-native-comp through the flatwhatson channel from well before v28 was released. Currently I'm using emacs-pgtk-native-comp-28.1.50-223.3ddccb5. Everything has built, installed, and run fine for as long as I have been using it. Just in case that was in question, and as a point of reference.
>
> Anyway, I'll try to reproduce when I can (tomorrow likely) what you reported in the first message using this setup, if that is of use.
>

I was able to reproduce the original error, though I used the libgccjit package from the flatwhatson channel, at v11.3.0 (along with GCC at that version). For good measure, I also used the tutorial at that version, just in case https://gcc.gnu.org/onlinedocs/gcc-11.3.0/jit/intro/tutorial01.html  I chose this version since that is what emacs-native-comp from that channel is built with.

Searching for these error messages of missing libraries/files, I found

https://ref.strikr.io/jit/internals/index.html#environment-variables

and a bug report at https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87808

I didn't dive into the details and I'm not expert here, but it gave me the clues to work around it. Seems that where gccjit looks for things has some assumptions (bugs?) which we can fix at runtime with:

LIBRARY_PATH=$GUIX_ENVIRONMENT/lib/gcc/x86_64-unknown-linux-gnu/11.3.0:$LIBRARY_PATH ./gccjittest

The errors reported before were solved with this LIBRARY_PATH addition of the lib/gcc subdirectory. So, the test program runs in

guix shell gcc-toolchain@11 libgccjit@11 --pure

where I compiled to gccjittest following the tutorial directions (no change to LIBRARY_PATH).

So, looking at the emacs-native-comp definition in flatwhatson, we can see that a phase is used to set LIBRARY_PATH before configure just as I did here: https://github.com/flatwhatson/guix-channel/blob/master/flat/packages/emacs.scm#L65

Hope this is helpful and unblocks libgccjit and emacs-native-comp for Guix!

John




^ permalink raw reply	[flat|nested] 44+ messages in thread

* bug#55657: libgccjit is unusable
  2022-08-03 21:13       ` John Kehayias via Bug reports for GNU Guix
@ 2022-08-04  4:26         ` Liliana Marie Prikler
  2022-08-04  4:48           ` Andrew Whatson
  0 siblings, 1 reply; 44+ messages in thread
From: Liliana Marie Prikler @ 2022-08-04  4:26 UTC (permalink / raw)
  To: John Kehayias
  Cc: Andrew Whatson, Tobias Geerinckx-Rice, remco@remworks.net,
	55657@debbugs.gnu.org

Hi John,

Am Mittwoch, dem 03.08.2022 um 21:13 +0000 schrieb John Kehayias:
> I didn't dive into the details and I'm not expert here, but it gave
> me the clues to work around it. Seems that where gccjit looks for
> things has some assumptions (bugs?) which we can fix at runtime with:
> 
> LIBRARY_PATH=$GUIX_ENVIRONMENT/lib/gcc/x86_64-unknown-linux-
> gnu/11.3.0:$LIBRARY_PATH ./gccjittest
> 
> The errors reported before were solved with this LIBRARY_PATH
> addition of the lib/gcc subdirectory. So, the test program runs in
> 
> guix shell gcc-toolchain@11 libgccjit@11 --pure
> 
> where I compiled to gccjittest following the tutorial directions (no
> change to LIBRARY_PATH).
while this does help insofar as I now know which snippet I forgot to
copy, I do still think that this leaves us with two unreasonable
options if we want to use emacs to compile other packages:

1. Propagate gcc-toolchain from emacs.
2. Patch LIBRARY_PATH not just before configuration, but also via a
wrapper.

At the very least I don't see how Emacs would be able to compile other
packages to native code without either of the above.

WDYT?




^ permalink raw reply	[flat|nested] 44+ messages in thread

* bug#55657: libgccjit is unusable
  2022-08-04  4:26         ` Liliana Marie Prikler
@ 2022-08-04  4:48           ` Andrew Whatson
  2022-08-04 16:52             ` Liliana Marie Prikler
  0 siblings, 1 reply; 44+ messages in thread
From: Andrew Whatson @ 2022-08-04  4:48 UTC (permalink / raw)
  To: Liliana Marie Prikler
  Cc: John Kehayias, Tobias Geerinckx-Rice, remco@remworks.net,
	55657@debbugs.gnu.org

Hi John, Liliana,

Sorry I haven't jumped in before now, I appreciate your efforts to
bring emacs native-comp to guix!

On Thu, 4 Aug 2022 at 04:26, Liliana Marie Prikler
<liliana.prikler@gmail.com> wrote:
>
> while this does help insofar as I now know which snippet I forgot to
> copy, I do still think that this leaves us with two unreasonable
> options if we want to use emacs to compile other packages:
>
> 1. Propagate gcc-toolchain from emacs.
> 2. Patch LIBRARY_PATH not just before configuration, but also via a
> wrapper.
>
> At the very least I don't see how Emacs would be able to compile other
> packages to native code without either of the above.
>
> WDYT?

The solution used in the package-definition in my channel is to patch
`comp.el` to directly reference the necessary gcc/glibc paths instead
of relying on the environment.  This occurs in the
"patch-driver-options" step immediately after the "set-libgccjit-path"
step mentioned earlier.  This makes gcc-toolchain part of emacs
closure, without requiring it to be propagated into the profile.

If I understand the problem correctly, that should suffice?

Cheers,
Andrew




^ permalink raw reply	[flat|nested] 44+ messages in thread

* bug#55657: libgccjit is unusable
  2022-08-04  4:48           ` Andrew Whatson
@ 2022-08-04 16:52             ` Liliana Marie Prikler
  2022-08-05  0:59               ` Andrew Whatson
  0 siblings, 1 reply; 44+ messages in thread
From: Liliana Marie Prikler @ 2022-08-04 16:52 UTC (permalink / raw)
  To: Andrew Whatson
  Cc: John Kehayias, Tobias Geerinckx-Rice, remco@remworks.net,
	55657@debbugs.gnu.org

Am Donnerstag, dem 04.08.2022 um 04:48 +0000 schrieb Andrew Whatson:
> Hi John, Liliana,
> 
> Sorry I haven't jumped in before now, I appreciate your efforts to
> bring emacs native-comp to guix!
> 
> On Thu, 4 Aug 2022 at 04:26, Liliana Marie Prikler
> <liliana.prikler@gmail.com> wrote:
> > 
> > while this does help insofar as I now know which snippet I forgot
> > to
> > copy, I do still think that this leaves us with two unreasonable
> > options if we want to use emacs to compile other packages:
> > 
> > 1. Propagate gcc-toolchain from emacs.
> > 2. Patch LIBRARY_PATH not just before configuration, but also via a
> > wrapper.
> > 
> > At the very least I don't see how Emacs would be able to compile
> > other
> > packages to native code without either of the above.
> > 
> > WDYT?
> 
> The solution used in the package-definition in my channel is to patch
> `comp.el` to directly reference the necessary gcc/glibc paths instead
> of relying on the environment.  This occurs in the
> "patch-driver-options" step immediately after the "set-libgccjit-
> path" step mentioned earlier.  This makes gcc-toolchain part of emacs
> closure, without requiring it to be propagated into the profile.
> 
> If I understand the problem correctly, that should suffice?
But if I read your recipe correctly, you're not resolving %host-type in
those options.  Does that really suffice?




^ permalink raw reply	[flat|nested] 44+ messages in thread

* bug#55657: libgccjit is unusable
  2022-08-04 16:52             ` Liliana Marie Prikler
@ 2022-08-05  0:59               ` Andrew Whatson
  2022-08-05 18:44                 ` Liliana Marie Prikler
  0 siblings, 1 reply; 44+ messages in thread
From: Andrew Whatson @ 2022-08-05  0:59 UTC (permalink / raw)
  To: Liliana Marie Prikler
  Cc: John Kehayias, Tobias Geerinckx-Rice, remco@remworks.net,
	55657@debbugs.gnu.org

On Thu, 4 Aug 2022 at 16:52, Liliana Marie Prikler
<liliana.prikler@gmail.com> wrote:
>
> > The solution used in the package-definition in my channel is to patch
> > `comp.el` to directly reference the necessary gcc/glibc paths instead
> > of relying on the environment.  This occurs in the
> > "patch-driver-options" step immediately after the "set-libgccjit-
> > path" step mentioned earlier.  This makes gcc-toolchain part of emacs
> > closure, without requiring it to be propagated into the profile.
> >
> > If I understand the problem correctly, that should suffice?
>
> But if I read your recipe correctly, you're not resolving %host-type in
> those options.  Does that really suffice?

Ah, yes that is a little confusing.  This is a quirk of the different
behaviour of the LIBRARY_PATH environment variable and the -B flag to
gcc.

I recommend reading about "-Bprefix" in `man gcc`, but in short it
tries those paths with and without "machine/version" appended for the
target machine and compiler version.  We *could* hard-code those, but
it isn't necessary, and it seemed like that might cause problems if
someone's brave enough to attempt cross-compilation of native-comp
emacs.

A major benefit of patching "comp.el" directly is that it avoids
leaking gcc into the user's environment.  It's possible that someone
is running emacs in a profile with a specific version of gcc, maybe
without libgccjit support (eg. while hacking on some legacy code), so
having emacs insist on a libgccjit-compatible gcc present in the
environment at runtime would cause lots of problems.

The other important bit is the libgccjit package.  The one in guix
mainline works fine, it should be possible to get a working libgccjit
as-is.  I updated the package definition on my channel for the
following reasons:

a) Support newer gcc versions

While developing native-comp support for emacs, Andrea found and fixed
some libgccjit bugs which made their way into subsequent releases of
gcc.  The native-comp library includes work-arounds for these
problems, but produces faster/smaller code with a fresher libgccjit.

b) Reduce compilation time

The definition in guix is basically the standard gcc build, but with
libgccjit also enabled.  This results in an arduous double-bootstrap
and building a bunch of compilers and libraries that are completely
unnecessary and unused by libgccjit.  I've disabled all the
unnecessary stuff and depend on the main gcc package to build
libgccjit, relying on the fact that it's already properly
bootstrapped.  It's much quicker to build, which is important if you
don't have substitutes.

Hope this helps,
Andrew




^ permalink raw reply	[flat|nested] 44+ messages in thread

* [bug#57086] [PATCH 1/6] gnu: Parameterize libgccjit.
  2022-08-09 18:37 ` bug#55657: [PATCH 0/6] Add native compilation to Emacs Liliana Marie Prikler
  2022-08-05  3:29   ` [bug#57086] [PATCH v3 1/7] gnu: Parameterize libgccjit Liliana Marie Prikler
@ 2022-08-05  3:29   ` Liliana Marie Prikler
  2022-08-05 18:27   ` [bug#57086] [PATCH 2/6] gnu: libgccjit: Build with bootstrapped gcc Liliana Marie Prikler
                     ` (12 subsequent siblings)
  14 siblings, 0 replies; 44+ messages in thread
From: Liliana Marie Prikler @ 2022-08-05  3:29 UTC (permalink / raw)
  To: 57086

* gnu/packages/gcc.scm (make-libgccjit): New variable.
(libgccjit): Define in terms of make-libgccjit.
---
 gnu/packages/gcc.scm | 38 +++++++++++++++++++++-----------------
 1 file changed, 21 insertions(+), 17 deletions(-)

diff --git a/gnu/packages/gcc.scm b/gnu/packages/gcc.scm
index 4c496e31b2..66f0766646 100644
--- a/gnu/packages/gcc.scm
+++ b/gnu/packages/gcc.scm
@@ -968,31 +968,33 @@ (define-public gdc-11
    (custom-gcc gcc-11 "gdc" '("d")
                %generic-search-paths)))
 
-(define-public libgccjit
+(define-public (make-libgccjit gcc)
   (package
-    (inherit gcc-9)
+    (inherit gcc)
     (name "libgccjit")
     (outputs (delete "lib" (package-outputs gcc)))
     (properties (alist-delete 'hidden? (package-properties gcc)))
     (arguments
-     (substitute-keyword-arguments `(#:modules ((guix build gnu-build-system)
-                                                (guix build utils)
-                                                (ice-9 regex)
-                                                (srfi srfi-1)
-                                                (srfi srfi-26))
-                                     ,@(package-arguments gcc))
+     (substitute-keyword-arguments (package-arguments gcc)
+       ((#:modules _ '())
+        '((guix build gnu-build-system)
+          (guix build utils)
+          (ice-9 regex)
+          (srfi srfi-1)
+          (srfi srfi-26)))
        ((#:configure-flags flags)
-        `(append `("--enable-host-shared"
-                   ,(string-append "--enable-languages=jit"))
+        #~(cons* "--enable-host-shared"
+                 "--enable-languages=jit"
                  (remove (cut string-match "--enable-languages.*" <>)
-                         ,flags)))
+                         #$flags)))
        ((#:phases phases)
-        `(modify-phases ,phases
-           (add-after 'install 'remove-broken-or-conflicting-files
-             (lambda* (#:key outputs #:allow-other-keys)
-               (for-each delete-file
-                         (find-files (string-append (assoc-ref outputs "out") "/bin")
-                                     ".*(c\\+\\+|cpp|g\\+\\+|gcov|gcc|gcc-.*)"))))))))
+        #~(modify-phases #$phases
+            (add-after 'install 'remove-broken-or-conflicting-files
+              (lambda* (#:key outputs #:allow-other-keys)
+                (for-each delete-file
+                          (find-files
+                           (string-append (assoc-ref outputs "out") "/bin")
+                           ".*(c\\+\\+|cpp|g\\+\\+|gcov|gcc|gcc-.*)"))))))))
     (synopsis "GCC library generating machine code on-the-fly at runtime")
     (description
      "This package is part of the GNU Compiler Collection and provides an
@@ -1003,6 +1005,8 @@ (define-public libgccjit
 compilers.  The just-in-time (jit) part of the name is now something of a
 misnomer.")))
 
+(define-public libgccjit (make-libgccjit gcc-9))
+
 (define (make-gccgo gcc)
   "Return a gccgo package based on GCC."
   (let ((gccgo (custom-gcc gcc "gccgo" '("go") %generic-search-paths)))
-- 
2.37.0





^ permalink raw reply related	[flat|nested] 44+ messages in thread

* [bug#57086] [PATCH v3 1/7] gnu: Parameterize libgccjit.
  2022-08-09 18:37 ` bug#55657: [PATCH 0/6] Add native compilation to Emacs Liliana Marie Prikler
@ 2022-08-05  3:29   ` Liliana Marie Prikler
  2022-08-05  3:29   ` [bug#57086] [PATCH 1/6] " Liliana Marie Prikler
                     ` (13 subsequent siblings)
  14 siblings, 0 replies; 44+ messages in thread
From: Liliana Marie Prikler @ 2022-08-05  3:29 UTC (permalink / raw)
  To: 57086

* gnu/packages/gcc.scm (make-libgccjit): New variable.
(libgccjit): Define in terms of make-libgccjit.
---
 gnu/packages/gcc.scm | 38 +++++++++++++++++++++-----------------
 1 file changed, 21 insertions(+), 17 deletions(-)

diff --git a/gnu/packages/gcc.scm b/gnu/packages/gcc.scm
index 4c496e31b2..66f0766646 100644
--- a/gnu/packages/gcc.scm
+++ b/gnu/packages/gcc.scm
@@ -968,31 +968,33 @@ (define-public gdc-11
    (custom-gcc gcc-11 "gdc" '("d")
                %generic-search-paths)))
 
-(define-public libgccjit
+(define-public (make-libgccjit gcc)
   (package
-    (inherit gcc-9)
+    (inherit gcc)
     (name "libgccjit")
     (outputs (delete "lib" (package-outputs gcc)))
     (properties (alist-delete 'hidden? (package-properties gcc)))
     (arguments
-     (substitute-keyword-arguments `(#:modules ((guix build gnu-build-system)
-                                                (guix build utils)
-                                                (ice-9 regex)
-                                                (srfi srfi-1)
-                                                (srfi srfi-26))
-                                     ,@(package-arguments gcc))
+     (substitute-keyword-arguments (package-arguments gcc)
+       ((#:modules _ '())
+        '((guix build gnu-build-system)
+          (guix build utils)
+          (ice-9 regex)
+          (srfi srfi-1)
+          (srfi srfi-26)))
        ((#:configure-flags flags)
-        `(append `("--enable-host-shared"
-                   ,(string-append "--enable-languages=jit"))
+        #~(cons* "--enable-host-shared"
+                 "--enable-languages=jit"
                  (remove (cut string-match "--enable-languages.*" <>)
-                         ,flags)))
+                         #$flags)))
        ((#:phases phases)
-        `(modify-phases ,phases
-           (add-after 'install 'remove-broken-or-conflicting-files
-             (lambda* (#:key outputs #:allow-other-keys)
-               (for-each delete-file
-                         (find-files (string-append (assoc-ref outputs "out") "/bin")
-                                     ".*(c\\+\\+|cpp|g\\+\\+|gcov|gcc|gcc-.*)"))))))))
+        #~(modify-phases #$phases
+            (add-after 'install 'remove-broken-or-conflicting-files
+              (lambda* (#:key outputs #:allow-other-keys)
+                (for-each delete-file
+                          (find-files
+                           (string-append (assoc-ref outputs "out") "/bin")
+                           ".*(c\\+\\+|cpp|g\\+\\+|gcov|gcc|gcc-.*)"))))))))
     (synopsis "GCC library generating machine code on-the-fly at runtime")
     (description
      "This package is part of the GNU Compiler Collection and provides an
@@ -1003,6 +1005,8 @@ (define-public libgccjit
 compilers.  The just-in-time (jit) part of the name is now something of a
 misnomer.")))
 
+(define-public libgccjit (make-libgccjit gcc-9))
+
 (define (make-gccgo gcc)
   "Return a gccgo package based on GCC."
   (let ((gccgo (custom-gcc gcc "gccgo" '("go") %generic-search-paths)))
-- 
2.37.2





^ permalink raw reply related	[flat|nested] 44+ messages in thread

* [bug#57086] [PATCH 2/6] gnu: libgccjit: Build with bootstrapped gcc.
  2022-08-09 18:37 ` bug#55657: [PATCH 0/6] Add native compilation to Emacs Liliana Marie Prikler
  2022-08-05  3:29   ` [bug#57086] [PATCH v3 1/7] gnu: Parameterize libgccjit Liliana Marie Prikler
  2022-08-05  3:29   ` [bug#57086] [PATCH 1/6] " Liliana Marie Prikler
@ 2022-08-05 18:27   ` Liliana Marie Prikler
  2022-08-05 18:27   ` [bug#57086] [PATCH v3 2/7] " Liliana Marie Prikler
                     ` (11 subsequent siblings)
  14 siblings, 0 replies; 44+ messages in thread
From: Liliana Marie Prikler @ 2022-08-05 18:27 UTC (permalink / raw)
  To: 57086

* gnu/packages/gcc.scm (make-libgccjit)[#:configure-flags]: Add
“--disable-bootstrap”, “--disable-libatomic”, “--disable-libgomp”,
“--disable-libquadmath”, “--disable-libssp”, and “--enable-checking=release”.
[inputs]: Remove libstdc++.
[native-inputs]: Add gcc.
---
 gnu/packages/gcc.scm | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/gcc.scm b/gnu/packages/gcc.scm
index 66f0766646..4f7076d977 100644
--- a/gnu/packages/gcc.scm
+++ b/gnu/packages/gcc.scm
@@ -983,7 +983,13 @@ (define-public (make-libgccjit gcc)
           (srfi srfi-1)
           (srfi srfi-26)))
        ((#:configure-flags flags)
-        #~(cons* "--enable-host-shared"
+        #~(cons* "--disable-bootstrap"
+                 "--disable-libatomic"
+                 "--disable-libgomp"
+                 "--disable-libquadmath"
+                 "--disable-libssp"
+                 "--enable-host-shared"
+                 "--enable-checking=release"
                  "--enable-languages=jit"
                  (remove (cut string-match "--enable-languages.*" <>)
                          #$flags)))
@@ -995,6 +1001,10 @@ (define-public (make-libgccjit gcc)
                           (find-files
                            (string-append (assoc-ref outputs "out") "/bin")
                            ".*(c\\+\\+|cpp|g\\+\\+|gcov|gcc|gcc-.*)"))))))))
+    (inputs (modify-inputs (package-inputs gcc)
+              (delete "libstdc++")))
+    (native-inputs (modify-inputs (package-native-inputs gcc)
+                     (prepend gcc)))
     (synopsis "GCC library generating machine code on-the-fly at runtime")
     (description
      "This package is part of the GNU Compiler Collection and provides an
-- 
2.37.0





^ permalink raw reply related	[flat|nested] 44+ messages in thread

* [bug#57086] [PATCH v3 2/7] gnu: libgccjit: Build with bootstrapped gcc.
  2022-08-09 18:37 ` bug#55657: [PATCH 0/6] Add native compilation to Emacs Liliana Marie Prikler
                     ` (2 preceding siblings ...)
  2022-08-05 18:27   ` [bug#57086] [PATCH 2/6] gnu: libgccjit: Build with bootstrapped gcc Liliana Marie Prikler
@ 2022-08-05 18:27   ` Liliana Marie Prikler
  2022-08-05 18:30   ` [bug#57086] [PATCH v3 3/7] gnu: libgccjit: Build multiple versions Liliana Marie Prikler
                     ` (10 subsequent siblings)
  14 siblings, 0 replies; 44+ messages in thread
From: Liliana Marie Prikler @ 2022-08-05 18:27 UTC (permalink / raw)
  To: 57086

* gnu/packages/gcc.scm (make-libgccjit)[#:configure-flags]: Add
“--disable-bootstrap”, “--disable-libatomic”, “--disable-libgomp”,
“--disable-libquadmath”, “--disable-libssp”, and “--enable-checking=release”.
[inputs]: Remove libstdc++.
[native-inputs]: Add gcc.
---
 gnu/packages/gcc.scm | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/gcc.scm b/gnu/packages/gcc.scm
index 66f0766646..4f7076d977 100644
--- a/gnu/packages/gcc.scm
+++ b/gnu/packages/gcc.scm
@@ -983,7 +983,13 @@ (define-public (make-libgccjit gcc)
           (srfi srfi-1)
           (srfi srfi-26)))
        ((#:configure-flags flags)
-        #~(cons* "--enable-host-shared"
+        #~(cons* "--disable-bootstrap"
+                 "--disable-libatomic"
+                 "--disable-libgomp"
+                 "--disable-libquadmath"
+                 "--disable-libssp"
+                 "--enable-host-shared"
+                 "--enable-checking=release"
                  "--enable-languages=jit"
                  (remove (cut string-match "--enable-languages.*" <>)
                          #$flags)))
@@ -995,6 +1001,10 @@ (define-public (make-libgccjit gcc)
                           (find-files
                            (string-append (assoc-ref outputs "out") "/bin")
                            ".*(c\\+\\+|cpp|g\\+\\+|gcov|gcc|gcc-.*)"))))))))
+    (inputs (modify-inputs (package-inputs gcc)
+              (delete "libstdc++")))
+    (native-inputs (modify-inputs (package-native-inputs gcc)
+                     (prepend gcc)))
     (synopsis "GCC library generating machine code on-the-fly at runtime")
     (description
      "This package is part of the GNU Compiler Collection and provides an
-- 
2.37.2





^ permalink raw reply related	[flat|nested] 44+ messages in thread

* [bug#57086] [PATCH 3/6] gnu: libgccjit: Build multiple versions.
  2022-08-09 18:37 ` bug#55657: [PATCH 0/6] Add native compilation to Emacs Liliana Marie Prikler
                     ` (4 preceding siblings ...)
  2022-08-05 18:30   ` [bug#57086] [PATCH v3 3/7] gnu: libgccjit: Build multiple versions Liliana Marie Prikler
@ 2022-08-05 18:30   ` Liliana Marie Prikler
  2022-08-05 22:37   ` [bug#57086] [PATCH 4/6] gnu: emacs: Build with native compilation Liliana Marie Prikler
                     ` (8 subsequent siblings)
  14 siblings, 0 replies; 44+ messages in thread
From: Liliana Marie Prikler @ 2022-08-05 18:30 UTC (permalink / raw)
  To: 57086

* gnu/packages/gcc.scm (libgccjit-9, libgccjit-10, libgccjit-11)
(libgccjit-12): New variables.
(libgccjit): Update to libgccjit-10.
---
 gnu/packages/gcc.scm | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/gcc.scm b/gnu/packages/gcc.scm
index 4f7076d977..7e4fb283d8 100644
--- a/gnu/packages/gcc.scm
+++ b/gnu/packages/gcc.scm
@@ -1015,7 +1015,12 @@ (define-public (make-libgccjit gcc)
 compilers.  The just-in-time (jit) part of the name is now something of a
 misnomer.")))
 
-(define-public libgccjit (make-libgccjit gcc-9))
+(define-public libgccjit-9 (make-libgccjit gcc-9))
+(define-public libgccjit-10 (make-libgccjit gcc-10))
+(define-public libgccjit-11 (make-libgccjit gcc-11))
+(define-public libgccjit-12 (make-libgccjit gcc-12))
+
+(define-public libgccjit libgccjit-10)
 
 (define (make-gccgo gcc)
   "Return a gccgo package based on GCC."
-- 
2.37.0





^ permalink raw reply related	[flat|nested] 44+ messages in thread

* [bug#57086] [PATCH v3 3/7] gnu: libgccjit: Build multiple versions.
  2022-08-09 18:37 ` bug#55657: [PATCH 0/6] Add native compilation to Emacs Liliana Marie Prikler
                     ` (3 preceding siblings ...)
  2022-08-05 18:27   ` [bug#57086] [PATCH v3 2/7] " Liliana Marie Prikler
@ 2022-08-05 18:30   ` Liliana Marie Prikler
  2022-08-05 18:30   ` [bug#57086] [PATCH 3/6] " Liliana Marie Prikler
                     ` (9 subsequent siblings)
  14 siblings, 0 replies; 44+ messages in thread
From: Liliana Marie Prikler @ 2022-08-05 18:30 UTC (permalink / raw)
  To: 57086

* gnu/packages/gcc.scm (libgccjit-9, libgccjit-10, libgccjit-11)
(libgccjit-12): New variables.
(libgccjit): Update to libgccjit-10.
---
 gnu/packages/gcc.scm | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/gcc.scm b/gnu/packages/gcc.scm
index 4f7076d977..7e4fb283d8 100644
--- a/gnu/packages/gcc.scm
+++ b/gnu/packages/gcc.scm
@@ -1015,7 +1015,12 @@ (define-public (make-libgccjit gcc)
 compilers.  The just-in-time (jit) part of the name is now something of a
 misnomer.")))
 
-(define-public libgccjit (make-libgccjit gcc-9))
+(define-public libgccjit-9 (make-libgccjit gcc-9))
+(define-public libgccjit-10 (make-libgccjit gcc-10))
+(define-public libgccjit-11 (make-libgccjit gcc-11))
+(define-public libgccjit-12 (make-libgccjit gcc-12))
+
+(define-public libgccjit libgccjit-10)
 
 (define (make-gccgo gcc)
   "Return a gccgo package based on GCC."
-- 
2.37.2





^ permalink raw reply related	[flat|nested] 44+ messages in thread

* bug#55657: libgccjit is unusable
  2022-08-05  0:59               ` Andrew Whatson
@ 2022-08-05 18:44                 ` Liliana Marie Prikler
  2022-08-05 20:01                   ` John Kehayias via Bug reports for GNU Guix
  0 siblings, 1 reply; 44+ messages in thread
From: Liliana Marie Prikler @ 2022-08-05 18:44 UTC (permalink / raw)
  To: Andrew Whatson
  Cc: John Kehayias, Tobias Geerinckx-Rice, remco@remworks.net,
	55657@debbugs.gnu.org

Am Freitag, dem 05.08.2022 um 00:59 +0000 schrieb Andrew Whatson:
> On Thu, 4 Aug 2022 at 16:52, Liliana Marie Prikler
> <liliana.prikler@gmail.com> wrote
> > But if I read your recipe correctly, you're not resolving %host-
> > type in those options.  Does that really suffice?
> 
> Ah, yes that is a little confusing.  This is a quirk of the different
> behaviour of the LIBRARY_PATH environment variable and the -B flag to
> gcc.
> 
> I recommend reading about "-Bprefix" in `man gcc`, but in short it
> tries those paths with and without "machine/version" appended for the
> target machine and compiler version.  We *could* hard-code those, but
> it isn't necessary, and it seemed like that might cause problems if
> someone's brave enough to attempt cross-compilation of native-comp
> emacs.
Fair enough.  The compiler driver does not appear to be the failing
part anyway, though given the status quo I can't exactly claim it is
not failing.

> The other important bit is the libgccjit package.  The one in guix
> mainline works fine, it should be possible to get a working libgccjit
> as-is.  
From my own experience, I doubt that.  Read also the thread title.

> I updated the package definition on my channel for the following
> reasons:
> 
> a) Support newer gcc versions
> 
> While developing native-comp support for emacs, Andrea found and
> fixed some libgccjit bugs which made their way into subsequent
> releases of gcc.  The native-comp library includes work-arounds for
> these problems, but produces faster/smaller code with a fresher
> libgccjit.
> 
> b) Reduce compilation time
> 
> The definition in guix is basically the standard gcc build, but with
> libgccjit also enabled.  This results in an arduous double-bootstrap
> and building a bunch of compilers and libraries that are completely
> unnecessary and unused by libgccjit.  I've disabled all the
> unnecessary stuff and depend on the main gcc package to build
> libgccjit, relying on the fact that it's already properly
> bootstrapped.  It's much quicker to build, which is important if you
> don't have substitutes.
> 
> Hope this helps,
> Andrew
I actually am at a loss, so instead of referring to your code, I shall
share mine.  Note that, style aside, it should actually perform the
same steps as yours, but fails to do so.  I also tried adding the
unversioned lib directory to LIBRARY_PATH and setting LD_LIBRARY_PATH
to little fanfare.  Whatever I do, it seems configure wants to smoke a
different joint.

Cheers

;; gcc.scm

(define-public (make-libgccjit gcc)
  (package
    (inherit gcc)
    (name "libgccjit")
    (outputs (delete "lib" (package-outputs gcc)))
    (properties (alist-delete 'hidden? (package-properties gcc)))
    (arguments
     (substitute-keyword-arguments (package-arguments gcc)
       ((#:modules _ '())
        '((guix build gnu-build-system)
          (guix build utils)
          (ice-9 regex)
          (srfi srfi-1)
          (srfi srfi-26)))
       ((#:configure-flags flags)
        #~(cons* "--disable-bootstrap"
                 "--disable-libatomic"
                 "--disable-libgomp"
                 "--disable-libquadmath"
                 "--disable-libssp"
                 "--enable-host-shared"
                 "--enable-languages=jit"
                 (remove (cut string-match "--enable-languages.*" <>)
                         #$flags)))
       ((#:phases phases)
        #~(modify-phases #$phases
            (add-after 'install 'remove-broken-or-conflicting-files
              (lambda* (#:key outputs #:allow-other-keys)
                (for-each delete-file
                          (find-files
                           (string-append (assoc-ref outputs "out")
"/bin")
                           ".*(c\\+\\+|cpp|g\\+\\+|gcov|gcc|gcc-
.*)"))))))))
    (inputs (modify-inputs (package-inputs gcc)
              (delete "libstdc++")))
    (native-inputs (modify-inputs (package-native-inputs gcc)
                     (prepend gcc)))
    (synopsis "GCC library generating machine code on-the-fly at
runtime")
    (description
     "This package is part of the GNU Compiler Collection and provides
an
embeddable library for generating machine code on-the-fly at runtime. 
This
shared library can then be dynamically-linked into bytecode
interpreters and
other such programs that want to generate machine code on-the-fly at
run-time.
It can also be used for ahead-of-time code generation for building
standalone
compilers.  The just-in-time (jit) part of the name is now something of
a
misnomer.")))

(define-public libgccjit-9 (make-libgccjit gcc-9))
(define-public libgccjit-10 (make-libgccjit gcc-10))
(define-public libgccjit-11 (make-libgccjit gcc-11))
(define-public libgccjit-12 (make-libgccjit gcc-12))

(define-public libgccjit libgccjit-10)

;; emacs.scm

(define-public emacs
  (package
    (name "emacs")
    (version "28.1")
    (source (origin
              (method url-fetch)
              (uri (string-append "mirror://gnu/emacs/emacs-"
                                  version ".tar.xz"))
              (sha256
               (base32
               
"1qbmmmhnjhn4lvzsnyk7l5ganbi6wzbm38jc1a7hhyh3k78b7c98"))
              (patches (search-patches "emacs-exec-path.patch"
                                       "emacs-fix-scheme-indent-
function.patch"
                                       "emacs-source-date-
epoch.patch"))
              (modules '((guix build utils)))
              (snippet
               '(with-directory-excursion "lisp"
                  ;; Delete the bundled byte-compiled elisp files and
generated
                  ;; autoloads.
                  (for-each delete-file
                            (append (find-files "." "\\.elc$")
                                    (find-files "." "loaddefs\\.el$")
                                    (find-files "eshell" "^esh-
groups\\.el$")))

                  ;; Make sure Tramp looks for binaries in the right
places on
                  ;; remote Guix System machines, where 'getconf PATH'
returns
                  ;; something bogus.
                  (substitute* "net/tramp.el"
                    ;; Patch the line after "(defcustom tramp-remote-
path".
                    (("\\(tramp-default-remote-path")
                     (format #f "(tramp-default-remote-path ~s ~s ~s ~s
"
                             "~/.guix-profile/bin" "~/.guix-
profile/sbin"
                             "/run/current-system/profile/bin"
                             "/run/current-system/profile/sbin")))

                  ;; Make sure Man looks for C header files in the
right
                  ;; places.
                  (substitute* "man.el"
                    (("\"/usr/local/include\"" line)
                     (string-join
                      (list line
                            "\"~/.guix-profile/include\""
                           
"\"/var/guix/profiles/system/profile/include\"")
                      " ")))))))
    (build-system glib-or-gtk-build-system)
    (arguments
     (list
      #:tests? #f                      ; no check target
      #:modules `((guix build glib-or-gtk-build-system)
                  (guix build utils)
                  (srfi srfi-1)
                  (ice-9 ftw))
      #:configure-flags #~(list "--with-modules"
                                "--with-cairo"
                                "--with-native-compilation"
                                "--disable-build-details")
      #:make-flags #~(list "NATIVE_FULL_AOT=1")
      #:phases
      #~(modify-phases %standard-phases
          (add-after 'set-paths 'set-libgccjit-path
            (lambda* (#:key inputs #:allow-other-keys)
              (define (first-subdirectory/absolute directory)
                (let ((files (scandir
                              directory
                              (lambda (file)
                                (and (not (member file '("." "..")))
                                     (file-is-directory? (string-append
                                                          directory "/"
                                                          file)))))))
                  (and (not (null? files))
                       (string-append directory "/" (car files)))))

              (let* ((libgccjit-libdir
                      (first-subdirectory/absolute ;; version
                       (first-subdirectory/absolute ;; host type
                        (search-input-directory inputs "lib/gcc")))))
                (setenv "LIBRARY_PATH"
                        (string-append libgccjit-libdir ":"
                                       (getenv "LIBRARY_PATH"))))))
          (add-after 'unpack 'enable-elogind
            (lambda _
              (substitute* "configure.ac"
                (("libsystemd") "libelogind"))
              (when (file-exists? "configure")
                (delete-file "configure"))))
          (add-after 'unpack 'patch-program-file-names
            (lambda* (#:key inputs #:allow-other-keys)
              (substitute* '("src/callproc.c"
                             "lisp/term.el"
                             "lisp/htmlfontify.el"
                             "lisp/textmodes/artist.el"
                             "lisp/progmodes/sh-script.el")
                (("\"/bin/sh\"")
                 (format #f "~s" (search-input-file inputs
"/bin/sh"))))
              (substitute* "lisp/doc-view.el"
                (("\"(gs|dvipdf|ps2pdf|pdftotext)\"" all what)
                 (let ((replacement (false-if-exception
                                     (search-input-file
                                      inputs
                                      (string-append "/bin/" what)))))
                   (if replacement
                       (string-append "\"" replacement "\"")
                       all))))
              ;; match ".gvfs-fuse-daemon-real" and ".gvfsd-fuse-real"
              ;; respectively when looking for GVFS processes.
              (substitute* "lisp/net/tramp-gvfs.el"
                (("\\(tramp-compat-process-running-p \"(.*)\"\\)" all
process)
                 (format #f "(or ~a (tramp-compat-process-running-p
~s))"
                         all (string-append "." process "-real"))))))
          (add-after 'unpack 'patch-compilation-driver
            (lambda _
              (substitute* "lisp/emacs-lisp/comp.el"
                (("\\(defcustom native-comp-driver-options nil")
                 (format
                  #f "(defcustom native-comp-driver-options '(~s ~s ~s
~s)"
                  (string-append
                   "-B" #$(this-package-input "binutils") "/bin/")
                  (string-append
                   "-B" #$(this-package-input "glibc") "/lib/")
                  (string-append
                   "-B" #$(this-package-input "libgccjit") "/lib/")
                  (string-append
                   "-B" #$(this-package-input "libgccjit")
"/lib/gcc/"))))))
          (add-before 'configure 'fix-/bin/pwd
            (lambda _
              ;; Use `pwd', not `/bin/pwd'.
              (substitute* (find-files "." "^Makefile\\.in$")
                (("/bin/pwd")
                 "pwd"))))
          (add-after 'install 'install-site-start
            ;; Use 'guix-emacs' in "site-start.el", which is used
autoload the
            ;; Elisp packages found in EMACSLOADPATH.
            (lambda* (#:key inputs outputs #:allow-other-keys)
              (let* ((out      (assoc-ref outputs "out"))
                     (lisp-dir (string-append out "/share/emacs/site-
lisp"))
                     (emacs    (string-append out "/bin/emacs")))

                ;; This is duplicated from emacs-utils to prevent
coupling.
                (define* (emacs-byte-compile-directory dir)
                  (let ((expr `(progn
                                (setq byte-compile-debug t)
                                (byte-recompile-directory
                                 (file-name-as-directory ,dir) 0 1))))
                    (invoke emacs "--quick" "--batch"
                            (format #f "--eval=~s" expr))))

                (copy-file #$(local-file
                              (search-auxiliary-file "emacs/guix-
emacs.el"))
                           (string-append lisp-dir "/guix-emacs.el"))
                (with-output-to-file (string-append lisp-dir "/site-
start.el")
                  (lambda ()
                    (display
                     (string-append
                      "(when (require 'guix-emacs nil t)\n"
                      "  (guix-emacs-autoload-packages)\n"
                      "  (advice-add 'package-load-all-descriptors"
                      " :after #'guix-emacs-load-package-
descriptors))"))))
                ;; Remove the extraneous subdirs.el file, as it causes
Emacs to
                ;; add recursively all the the sub-directories of a
profile's
                ;; share/emacs/site-lisp union when added to
EMACSLOADPATH,
                ;; which leads to conflicts.
                (delete-file (string-append lisp-dir "/subdirs.el"))
                ;; Byte compile the site-start files.
                (emacs-byte-compile-directory lisp-dir))))
          (add-after 'glib-or-gtk-wrap 'restore-emacs-pdmp
            ;; restore the dump file that Emacs installs somewhere in
            ;; libexec/ to its original state
            (lambda* (#:key outputs target #:allow-other-keys)
              (let* ((libexec (string-append (assoc-ref outputs "out")
                                             "/libexec"))
                     ;; each of these ought to only match a single
file,
                     ;; but even if not (find-files) sorts by string<,
                     ;; so the Nth element in one maps to the Nth
element of
                     ;; the other
                     (pdmp (find-files libexec "\\.pdmp$"))
                     (pdmp-real (find-files libexec "\\.pdmp-real$")))
                (for-each rename-file pdmp-real pdmp))))
          (add-after 'glib-or-gtk-wrap 'strip-double-wrap
            (lambda* (#:key outputs #:allow-other-keys)
              ;; Directly copy emacs-X.Y to emacs, so that it is not
wrapped
              ;; twice.  This also fixes a minor issue, where WMs would
not be
              ;; able to track emacs back to emacs.desktop.
              (with-directory-excursion (assoc-ref outputs "out")
                (copy-file
                 (car (find-files "bin" "^emacs-([0-9]+\\.)+[0-9]+$"))
                 "bin/emacs"))))
          (add-after 'strip-double-wrap 'wrap-emacs-paths
            (lambda* (#:key inputs outputs #:allow-other-keys)
              (let* ((out (assoc-ref outputs "out"))
                     (lisp-dirs (find-files (string-append out
"/share/emacs")
                                            "^lisp$"
                                            #:directories? #t)))
                (for-each
                 (lambda (prog)
                   (wrap-program prog
                     ;; emacs-next and variants rely on uname being in
PATH for
                     ;; Tramp.  Tramp paths can't be hardcoded, because
they
                     ;; need to be portable.
                     `("PATH" suffix
                       ,(map dirname
                             (list (search-input-file inputs
"/bin/gzip")
                                   ;; for coreutils
                                   (search-input-file inputs
"/bin/yes"))))
                     `("EMACSLOADPATH" suffix ,lisp-dirs)))
                 (find-files (string-append out "/bin")
                             ;; Matches versioned and unversioned emacs
binaries.
                             ;; We don't patch emacsclient, because it
takes its
                             ;; environment variables from emacs.
                             ;; Likewise, we don't need to patch helper
binaries
                             ;; like etags, ctags or ebrowse.
                             "^emacs(-[0-9]+(\\.[0-9]+)*)?$"))))))))
    (inputs
     (list gnutls
           ncurses

           ;; For native compilation
           binutils
           glibc
           libgccjit

           ;; Required for "core" functionality, such as dired and
compression.
           coreutils
           gzip

           ;; Avoid Emacs's limited movemail substitute that retrieves
POP3
           ;; email only via insecure channels.
           ;; This is not needed for (modern) IMAP.
           mailutils

           gpm
           libx11
           gtk+
           cairo
           pango
           harfbuzz
           libxft
           libtiff
           giflib
           lcms
           libjpeg-turbo
           libselinux
           acl
           jansson
           gmp
           ghostscript
           poppler
           elogind

           ;; When looking for libpng `configure' links with `-lpng -
lz', so we
           ;; must also provide zlib as an input.
           libpng
           zlib
           (if (target-x86-64?)
               librsvg-bootstrap
               librsvg-2.40)
           libxpm
           libxml2
           libice
           libsm
           alsa-lib
           dbus

           ;; multilingualization support
           libotf
           m17n-lib))
    (native-inputs
     (list autoconf pkg-config texinfo))
    (native-search-paths
     (list (search-path-specification
            (variable "EMACSLOADPATH")
            (files '("share/emacs/site-lisp")))
           (search-path-specification
            (variable "INFOPATH")
            (files '("share/info")))))

    (home-page "https://www.gnu.org/software/emacs/")
    (synopsis "The extensible, customizable, self-documenting text
editor")
    (description
     "GNU Emacs is an extensible and highly customizable text editor. 
It is
based on an Emacs Lisp interpreter with extensions for text editing. 
Emacs
has been extended in essentially all areas of computing, giving rise to
a
vast array of packages supporting, e.g., email, IRC and XMPP messaging,
spreadsheets, remote server editing, and much more.  Emacs includes
extensive
documentation on all aspects of the system, from basic editing to
writing
large Lisp programs.  It has full Unicode support for nearly all human
languages.")
    (license license:gpl3+)))





^ permalink raw reply	[flat|nested] 44+ messages in thread

* bug#55657: libgccjit is unusable
  2022-08-05 18:44                 ` Liliana Marie Prikler
@ 2022-08-05 20:01                   ` John Kehayias via Bug reports for GNU Guix
  2022-08-05 21:31                     ` Liliana Marie Prikler
  0 siblings, 1 reply; 44+ messages in thread
From: John Kehayias via Bug reports for GNU Guix @ 2022-08-05 20:01 UTC (permalink / raw)
  To: Liliana Marie Prikler
  Cc: Andrew Whatson, Tobias Geerinckx-Rice, remco@remworks.net,
	55657@debbugs.gnu.org

Hi,

Looks like the code you sent got line wrapped and I couldn't easily untangle it. The difference that pops out to me is how you are locating the lib/gcc directory, is it maybe picking up from the build system rather than libgccjit? (though I think gcc:lib should be the same here, but not gcc-toolchain)

In any event, I just want to reiterate that the libgccjit and emacs-native-comp from Andrew's channel does indeed work: it compiles, runs, and does native compilations successfully. So hopefully we've narrowed down now that there is some difference in the code you tried and from Andrew's that is leading to different behavior.

John




^ permalink raw reply	[flat|nested] 44+ messages in thread

* bug#55657: libgccjit is unusable
  2022-08-05 20:01                   ` John Kehayias via Bug reports for GNU Guix
@ 2022-08-05 21:31                     ` Liliana Marie Prikler
  2022-08-06  5:37                       ` John Kehayias via Bug reports for GNU Guix
  0 siblings, 1 reply; 44+ messages in thread
From: Liliana Marie Prikler @ 2022-08-05 21:31 UTC (permalink / raw)
  To: John Kehayias
  Cc: Andrew Whatson, Tobias Geerinckx-Rice, remco@remworks.net,
	55657@debbugs.gnu.org

[-- Attachment #1: Type: text/plain, Size: 1230 bytes --]

Am Freitag, dem 05.08.2022 um 20:01 +0000 schrieb John Kehayias:
> Hi,
> 
> Looks like the code you sent got line wrapped and I couldn't easily
> untangle it. The difference that pops out to me is how you are
> locating the lib/gcc directory, is it maybe picking up from the build
> system rather than libgccjit? (though I think gcc:lib should be the
> same here, but not gcc-toolchain)
No: /gnu/store/640hfpr069hvqv9gcs0ayq0is21zfii6-libgccjit-
10.3.0/lib/gcc/x86_64-unknown-linux-gnu/10.3.0

> In any event, I just want to reiterate that the libgccjit and emacs-
> native-comp from Andrew's channel does indeed work: it compiles,
> runs, and does native compilations successfully. So hopefully we've
> narrowed down now that there is some difference in the code you tried
> and from Andrew's that is leading to different behavior.
The style changes are not the only thing at play here, though.  In
particular, I am trying to build Emacs 28.1, whereas Andrew builds
other versions, though notably the newest one ought to include the
smoke test.  You could also try other combinations for libgccjit and
gcc to see if those make a difference – last time I tried it did not.

Attached the definitions as a file this time.

Cheers

[-- Attachment #2: emacs-native-comp-merged.scm --]
[-- Type: text/x-scheme, Size: 15795 bytes --]

;; gcc.scm

(define-public (make-libgccjit gcc)
  (package
    (inherit gcc)
    (name "libgccjit")
    (outputs (delete "lib" (package-outputs gcc)))
    (properties (alist-delete 'hidden? (package-properties gcc)))
    (arguments
     (substitute-keyword-arguments (package-arguments gcc)
       ((#:modules _ '())
        '((guix build gnu-build-system)
          (guix build utils)
          (ice-9 regex)
          (srfi srfi-1)
          (srfi srfi-26)))
       ((#:configure-flags flags)
        #~(cons* "--disable-bootstrap"
                 "--disable-libatomic"
                 "--disable-libgomp"
                 "--disable-libquadmath"
                 "--disable-libssp"
                 "--enable-host-shared"
                 "--enable-languages=jit"
                 (remove (cut string-match "--enable-languages.*" <>)
                         #$flags)))
       ((#:phases phases)
        #~(modify-phases #$phases
            (add-after 'install 'remove-broken-or-conflicting-files
              (lambda* (#:key outputs #:allow-other-keys)
                (for-each delete-file
                          (find-files
                           (string-append (assoc-ref outputs "out") "/bin")
                           ".*(c\\+\\+|cpp|g\\+\\+|gcov|gcc|gcc-.*)"))))))))
    (inputs (modify-inputs (package-inputs gcc)
              (delete "libstdc++")))
    (native-inputs (modify-inputs (package-native-inputs gcc)
                     (prepend gcc)))
    (synopsis "GCC library generating machine code on-the-fly at runtime")
    (description
     "This package is part of the GNU Compiler Collection and provides an
embeddable library for generating machine code on-the-fly at runtime.  This
shared library can then be dynamically-linked into bytecode interpreters and
other such programs that want to generate machine code on-the-fly at run-time.
It can also be used for ahead-of-time code generation for building standalone
compilers.  The just-in-time (jit) part of the name is now something of a
misnomer.")))

(define-public libgccjit-9 (make-libgccjit gcc-9))
(define-public libgccjit-10 (make-libgccjit gcc-10))
(define-public libgccjit-11 (make-libgccjit gcc-11))
(define-public libgccjit-12 (make-libgccjit gcc-12))

(define-public libgccjit libgccjit-10)

;; emacs.scm

(define-public emacs
  (package
    (name "emacs")
    (version "28.1.90")
    (source (origin
              (method url-fetch)
              (uri (string-append "mirror://gnu/emacs/emacs-"
                                  version ".tar.xz"))
              (sha256
               (base32
                "1qbmmmhnjhn4lvzsnyk7l5ganbi6wzbm38jc1a7hhyh3k78b7c98"))
              (patches (search-patches "emacs-exec-path.patch"
                                       "emacs-fix-scheme-indent-function.patch"
                                       "emacs-source-date-epoch.patch"))
              (modules '((guix build utils)))
              (snippet
               '(with-directory-excursion "lisp"
                  ;; Delete the bundled byte-compiled elisp files and generated
                  ;; autoloads.
                  (for-each delete-file
                            (append (find-files "." "\\.elc$")
                                    (find-files "." "loaddefs\\.el$")
                                    (find-files "eshell" "^esh-groups\\.el$")))

                  ;; Make sure Tramp looks for binaries in the right places on
                  ;; remote Guix System machines, where 'getconf PATH' returns
                  ;; something bogus.
                  (substitute* "net/tramp.el"
                    ;; Patch the line after "(defcustom tramp-remote-path".
                    (("\\(tramp-default-remote-path")
                     (format #f "(tramp-default-remote-path ~s ~s ~s ~s "
                             "~/.guix-profile/bin" "~/.guix-profile/sbin"
                             "/run/current-system/profile/bin"
                             "/run/current-system/profile/sbin")))

                  ;; Make sure Man looks for C header files in the right
                  ;; places.
                  (substitute* "man.el"
                    (("\"/usr/local/include\"" line)
                     (string-join
                      (list line
                            "\"~/.guix-profile/include\""
                            "\"/var/guix/profiles/system/profile/include\"")
                      " ")))))))
    (build-system glib-or-gtk-build-system)
    (arguments
     (list
      #:tests? #f                      ; no check target
      #:modules `((guix build glib-or-gtk-build-system)
                  (guix build utils)
                  (srfi srfi-1)
                  (ice-9 ftw))
      #:configure-flags #~(list "--with-modules"
                                "--with-cairo"
                                "--with-native-compilation"
                                "--disable-build-details")
      #:make-flags #~(list "NATIVE_FULL_AOT=1")
      #:phases
      #~(modify-phases %standard-phases
          (add-after 'set-paths 'set-libgccjit-path
            (lambda* (#:key inputs #:allow-other-keys)
              (define (first-subdirectory/absolute directory)
                (let ((files (scandir
                              directory
                              (lambda (file)
                                (and (not (member file '("." "..")))
                                     (file-is-directory? (string-append
                                                          directory "/"
                                                          file)))))))
                  (and (not (null? files))
                       (string-append directory "/" (car files)))))

              (let* ((libgccjit-libdir
                      (first-subdirectory/absolute ;; version
                       (first-subdirectory/absolute ;; host type
                        (search-input-directory inputs "lib/gcc")))))
                (setenv "LIBRARY_PATH"
                        (string-append libgccjit-libdir ":"
                                       (getenv "LIBRARY_PATH"))))))
          (add-after 'unpack 'enable-elogind
            (lambda _
              (substitute* "configure.ac"
                (("libsystemd") "libelogind"))
              (when (file-exists? "configure")
                (delete-file "configure"))))
          (add-after 'unpack 'patch-program-file-names
            (lambda* (#:key inputs #:allow-other-keys)
              (substitute* '("src/callproc.c"
                             "lisp/term.el"
                             "lisp/htmlfontify.el"
                             "lisp/textmodes/artist.el"
                             "lisp/progmodes/sh-script.el")
                (("\"/bin/sh\"")
                 (format #f "~s" (search-input-file inputs "/bin/sh"))))
              (substitute* "lisp/doc-view.el"
                (("\"(gs|dvipdf|ps2pdf|pdftotext)\"" all what)
                 (let ((replacement (false-if-exception
                                     (search-input-file
                                      inputs
                                      (string-append "/bin/" what)))))
                   (if replacement
                       (string-append "\"" replacement "\"")
                       all))))
              ;; match ".gvfs-fuse-daemon-real" and ".gvfsd-fuse-real"
              ;; respectively when looking for GVFS processes.
              (substitute* "lisp/net/tramp-gvfs.el"
                (("\\(tramp-compat-process-running-p \"(.*)\"\\)" all process)
                 (format #f "(or ~a (tramp-compat-process-running-p ~s))"
                         all (string-append "." process "-real"))))))
          (add-after 'unpack 'patch-compilation-driver
            (lambda _
              (substitute* "lisp/emacs-lisp/comp.el"
                (("\\(defcustom native-comp-driver-options nil")
                 (format
                  #f "(defcustom native-comp-driver-options '(~s ~s ~s ~s)"
                  (string-append
                   "-B" #$(this-package-input "binutils") "/bin/")
                  (string-append
                   "-B" #$(this-package-input "glibc") "/lib/")
                  (string-append
                   "-B" #$(this-package-input "libgccjit") "/lib/")
                  (string-append
                   "-B" #$(this-package-input "libgccjit") "/lib/gcc/"))))))
          (add-before 'configure 'fix-/bin/pwd
            (lambda _
              ;; Use `pwd', not `/bin/pwd'.
              (substitute* (find-files "." "^Makefile\\.in$")
                (("/bin/pwd")
                 "pwd"))))
          (add-after 'install 'install-site-start
            ;; Use 'guix-emacs' in "site-start.el", which is used autoload the
            ;; Elisp packages found in EMACSLOADPATH.
            (lambda* (#:key inputs outputs #:allow-other-keys)
              (let* ((out      (assoc-ref outputs "out"))
                     (lisp-dir (string-append out "/share/emacs/site-lisp"))
                     (emacs    (string-append out "/bin/emacs")))

                ;; This is duplicated from emacs-utils to prevent coupling.
                (define* (emacs-byte-compile-directory dir)
                  (let ((expr `(progn
                                (setq byte-compile-debug t)
                                (byte-recompile-directory
                                 (file-name-as-directory ,dir) 0 1))))
                    (invoke emacs "--quick" "--batch"
                            (format #f "--eval=~s" expr))))

                (copy-file #$(local-file
                              (search-auxiliary-file "emacs/guix-emacs.el"))
                           (string-append lisp-dir "/guix-emacs.el"))
                (with-output-to-file (string-append lisp-dir "/site-start.el")
                  (lambda ()
                    (display
                     (string-append
                      "(when (require 'guix-emacs nil t)\n"
                      "  (guix-emacs-autoload-packages)\n"
                      "  (advice-add 'package-load-all-descriptors"
                      " :after #'guix-emacs-load-package-descriptors))"))))
                ;; Remove the extraneous subdirs.el file, as it causes Emacs to
                ;; add recursively all the the sub-directories of a profile's
                ;; share/emacs/site-lisp union when added to EMACSLOADPATH,
                ;; which leads to conflicts.
                (delete-file (string-append lisp-dir "/subdirs.el"))
                ;; Byte compile the site-start files.
                (emacs-byte-compile-directory lisp-dir))))
          (add-after 'glib-or-gtk-wrap 'restore-emacs-pdmp
            ;; restore the dump file that Emacs installs somewhere in
            ;; libexec/ to its original state
            (lambda* (#:key outputs target #:allow-other-keys)
              (let* ((libexec (string-append (assoc-ref outputs "out")
                                             "/libexec"))
                     ;; each of these ought to only match a single file,
                     ;; but even if not (find-files) sorts by string<,
                     ;; so the Nth element in one maps to the Nth element of
                     ;; the other
                     (pdmp (find-files libexec "\\.pdmp$"))
                     (pdmp-real (find-files libexec "\\.pdmp-real$")))
                (for-each rename-file pdmp-real pdmp))))
          (add-after 'glib-or-gtk-wrap 'strip-double-wrap
            (lambda* (#:key outputs #:allow-other-keys)
              ;; Directly copy emacs-X.Y to emacs, so that it is not wrapped
              ;; twice.  This also fixes a minor issue, where WMs would not be
              ;; able to track emacs back to emacs.desktop.
              (with-directory-excursion (assoc-ref outputs "out")
                (copy-file
                 (car (find-files "bin" "^emacs-([0-9]+\\.)+[0-9]+$"))
                 "bin/emacs"))))
          (add-after 'strip-double-wrap 'wrap-emacs-paths
            (lambda* (#:key inputs outputs #:allow-other-keys)
              (let* ((out (assoc-ref outputs "out"))
                     (lisp-dirs (find-files (string-append out "/share/emacs")
                                            "^lisp$"
                                            #:directories? #t)))
                (for-each
                 (lambda (prog)
                   (wrap-program prog
                     ;; emacs-next and variants rely on uname being in PATH for
                     ;; Tramp.  Tramp paths can't be hardcoded, because they
                     ;; need to be portable.
                     `("PATH" suffix
                       ,(map dirname
                             (list (search-input-file inputs "/bin/gzip")
                                   ;; for coreutils
                                   (search-input-file inputs "/bin/yes"))))
                     `("EMACSLOADPATH" suffix ,lisp-dirs)))
                 (find-files (string-append out "/bin")
                             ;; Matches versioned and unversioned emacs binaries.
                             ;; We don't patch emacsclient, because it takes its
                             ;; environment variables from emacs.
                             ;; Likewise, we don't need to patch helper binaries
                             ;; like etags, ctags or ebrowse.
                             "^emacs(-[0-9]+(\\.[0-9]+)*)?$"))))))))
    (inputs
     (list gnutls
           ncurses

           ;; For native compilation
           binutils
           glibc
           libgccjit

           ;; Required for "core" functionality, such as dired and compression.
           coreutils
           gzip

           ;; Avoid Emacs's limited movemail substitute that retrieves POP3
           ;; email only via insecure channels.
           ;; This is not needed for (modern) IMAP.
           mailutils

           gpm
           libx11
           gtk+
           cairo
           pango
           harfbuzz
           libxft
           libtiff
           giflib
           lcms
           libjpeg-turbo
           libselinux
           acl
           jansson
           gmp
           ghostscript
           poppler
           elogind

           ;; When looking for libpng `configure' links with `-lpng -lz', so we
           ;; must also provide zlib as an input.
           libpng
           zlib
           (if (target-x86-64?)
               librsvg-bootstrap
               librsvg-2.40)
           libxpm
           libxml2
           libice
           libsm
           alsa-lib
           dbus

           ;; multilingualization support
           libotf
           m17n-lib))
    (native-inputs
     (list autoconf pkg-config texinfo))
    (native-search-paths
     (list (search-path-specification
            (variable "EMACSLOADPATH")
            (files '("share/emacs/site-lisp")))
           (search-path-specification
            (variable "INFOPATH")
            (files '("share/info")))))

    (home-page "https://www.gnu.org/software/emacs/")
    (synopsis "The extensible, customizable, self-documenting text editor")
    (description
     "GNU Emacs is an extensible and highly customizable text editor.  It is
based on an Emacs Lisp interpreter with extensions for text editing.  Emacs
has been extended in essentially all areas of computing, giving rise to a
vast array of packages supporting, e.g., email, IRC and XMPP messaging,
spreadsheets, remote server editing, and much more.  Emacs includes extensive
documentation on all aspects of the system, from basic editing to writing
large Lisp programs.  It has full Unicode support for nearly all human
languages.")
    (license license:gpl3+)))

^ permalink raw reply	[flat|nested] 44+ messages in thread

* [bug#57086] [PATCH 4/6] gnu: emacs: Build with native compilation.
  2022-08-09 18:37 ` bug#55657: [PATCH 0/6] Add native compilation to Emacs Liliana Marie Prikler
                     ` (5 preceding siblings ...)
  2022-08-05 18:30   ` [bug#57086] [PATCH 3/6] " Liliana Marie Prikler
@ 2022-08-05 22:37   ` Liliana Marie Prikler
  2022-08-05 22:37   ` [bug#57086] [PATCH v3 4/7] " Liliana Marie Prikler
                     ` (7 subsequent siblings)
  14 siblings, 0 replies; 44+ messages in thread
From: Liliana Marie Prikler @ 2022-08-05 22:37 UTC (permalink / raw)
  To: 57086

* gnu/packages/emacs.scm (%emacs-modules): New variable.
(emacs)[arguments]<#:modules>: Use it here.
<#:configure-flags> Add “--with-native-compilation”.
<#:make-flags>: Add “NATIVE_FULL_AOT=1”.
<#:phases>: Add ‘set-libgccjit-path’ and ‘patch-compilation-driver’.
[inputs]: Add explicit ld-wrapper, binutils, glibc, and libgccjit.
(emacs-minimal, emacs-xwidgets, emacs-no-x)
(emacs-no-x-toolkit): Adjust accordingly.
---
 gnu/packages/emacs.scm | 64 ++++++++++++++++++++++++++++++++++++++++--
 1 file changed, 62 insertions(+), 2 deletions(-)

diff --git a/gnu/packages/emacs.scm b/gnu/packages/emacs.scm
index ffd1eda08e..68afdb0446 100644
--- a/gnu/packages/emacs.scm
+++ b/gnu/packages/emacs.scm
@@ -45,6 +45,7 @@ (define-module (gnu packages emacs)
   #:use-module (guix gexp)
   #:use-module (guix download)
   #:use-module (guix git-download)
+  #:use-module (guix build-system)
   #:use-module (guix build-system gnu)
   #:use-module (guix build-system glib-or-gtk)
   #:use-module (gnu packages)
@@ -55,6 +56,7 @@ (define-module (gnu packages emacs)
   #:use-module (gnu packages fontutils)
   #:use-module (gnu packages freedesktop)
   #:use-module (gnu packages fribidi)
+  #:use-module (gnu packages gcc)
   #:use-module (gnu packages gd)
   #:use-module (gnu packages gettext)
   #:use-module (gnu packages ghostscript)
@@ -81,6 +83,13 @@ (define-module (gnu packages emacs)
   #:use-module (ice-9 match)
   #:use-module (srfi srfi-1))
 
+(define (%emacs-modules build-system)
+  (let ((which (build-system-name build-system)))
+    `((guix build ,(symbol-append which '-build-system))
+      (guix build utils)
+      (srfi srfi-1)
+      (ice-9 ftw))))
+
 (define-public emacs
   (package
     (name "emacs")
@@ -129,11 +138,33 @@ (define-public emacs
     (arguments
      (list
       #:tests? #f                      ; no check target
+      #:modules (%emacs-modules build-system)
       #:configure-flags #~(list "--with-modules"
                                 "--with-cairo"
+                                "--with-native-compilation"
                                 "--disable-build-details")
+      #:make-flags #~(list "NATIVE_FULL_AOT=1")
       #:phases
       #~(modify-phases %standard-phases
+          (add-after 'set-paths 'set-libgccjit-path
+            (lambda* (#:key inputs #:allow-other-keys)
+              (define (first-subdirectory/absolute directory)
+                (let ((files (scandir
+                              directory
+                              (lambda (file)
+                                (and (not (member file '("." "..")))
+                                     (file-is-directory? (string-append
+                                                          directory "/"
+                                                          file)))))))
+                  (and (not (null? files))
+                       (string-append directory "/" (car files)))))
+              (let* ((libgccjit-libdir
+                      (first-subdirectory/absolute ;; version
+                       (first-subdirectory/absolute ;; host type
+                        (search-input-directory inputs "lib/gcc")))))
+                (setenv "LIBRARY_PATH"
+                        (string-append (getenv "LIBRARY_PATH")
+                                       ":" libgccjit-libdir)))))
           (add-after 'unpack 'enable-elogind
             (lambda _
               (substitute* "configure.ac"
@@ -164,6 +195,20 @@ (define-public emacs
                 (("\\(tramp-compat-process-running-p \"(.*)\"\\)" all process)
                  (format #f "(or ~a (tramp-compat-process-running-p ~s))"
                          all (string-append "." process "-real"))))))
+          (add-after 'unpack 'patch-compilation-driver
+            (lambda _
+              (substitute* "lisp/emacs-lisp/comp.el"
+                (("\\(defcustom native-comp-driver-options nil")
+                 (format
+                  #f "(defcustom native-comp-driver-options '(~@{~s~^ ~})"
+                  (string-append
+                   "-B" #$(this-package-input "binutils") "/bin/")
+                  (string-append
+                   "-B" #$(this-package-input "glibc") "/lib/")
+                  (string-append
+                   "-B" #$(this-package-input "libgccjit") "/lib/")
+                  (string-append
+                   "-B" #$(this-package-input "libgccjit") "/lib/gcc/"))))))
           (add-before 'configure 'fix-/bin/pwd
             (lambda _
               ;; Use `pwd', not `/bin/pwd'.
@@ -256,6 +301,14 @@ (define* (emacs-byte-compile-directory dir)
      (list gnutls
            ncurses
 
+           ;; To "unshadow" ld-wrapper in native builds
+           (make-ld-wrapper "ld-wrapper" #:binutils binutils)
+
+           ;; For native compilation
+           binutils
+           glibc
+           libgccjit
+
            ;; Required for "core" functionality, such as dired and compression.
            coreutils
            gzip
@@ -377,12 +430,16 @@ (define-public emacs-minimal
     (arguments
      (substitute-keyword-arguments (package-arguments emacs)
        ((#:configure-flags flags #~'())
-        #~(list "--with-gnutls=no" "--disable-build-details"))
+        #~(list "--with-gnutls=no" "--with-native-compilation"
+                "--disable-build-details"))
+       ((#:modules _) (%emacs-modules build-system))
        ((#:phases phases)
         #~(modify-phases #$phases
             (delete 'restore-emacs-pdmp)
             (delete 'strip-double-wrap)))))
-    (inputs (list ncurses coreutils gzip))
+    (inputs (list ncurses coreutils gzip
+                  (make-ld-wrapper "ld-wrapper" #:binutils binutils)
+                  binutils glibc libgccjit zlib))
     (native-inputs (list autoconf pkg-config))))
 
 (define-public emacs-xwidgets
@@ -395,6 +452,7 @@ (define-public emacs-xwidgets
      (substitute-keyword-arguments (package-arguments emacs)
        ((#:configure-flags flags #~'())
         #~(cons "--with-xwidgets" #$flags))
+       ((#:modules _) (%emacs-modules build-system))
        ((#:phases phases)
         #~(modify-phases #$phases
             (delete 'restore-emacs-pdmp)
@@ -419,6 +477,7 @@ (define-public emacs-no-x
      (substitute-keyword-arguments (package-arguments emacs)
        ((#:configure-flags flags #~'())
         #~(delete "--with-cairo" #$flags))
+       ((#:modules _) (%emacs-modules build-system))
        ((#:phases phases)
         #~(modify-phases #$phases
             (delete 'restore-emacs-pdmp)
@@ -437,6 +496,7 @@ (define-public emacs-no-x-toolkit
      (substitute-keyword-arguments (package-arguments emacs)
        ((#:configure-flags flags #~'())
         #~(cons "--with-x-toolkit=no" #$flags))
+       ((#:modules _) (%emacs-modules build-system))
        ((#:phases phases)
         #~(modify-phases #$phases
            (delete 'restore-emacs-pdmp)
-- 
2.37.0





^ permalink raw reply related	[flat|nested] 44+ messages in thread

* [bug#57086] [PATCH v3 4/7] gnu: emacs: Build with native compilation.
  2022-08-09 18:37 ` bug#55657: [PATCH 0/6] Add native compilation to Emacs Liliana Marie Prikler
                     ` (6 preceding siblings ...)
  2022-08-05 22:37   ` [bug#57086] [PATCH 4/6] gnu: emacs: Build with native compilation Liliana Marie Prikler
@ 2022-08-05 22:37   ` Liliana Marie Prikler
  2022-08-09 18:26   ` [bug#57086] [PATCH v3 5/7] guix: emacs-utils: Add emacs-compile-directory Liliana Marie Prikler
                     ` (6 subsequent siblings)
  14 siblings, 0 replies; 44+ messages in thread
From: Liliana Marie Prikler @ 2022-08-05 22:37 UTC (permalink / raw)
  To: 57086

* gnu/packages/emacs.scm (%emacs-modules): New variable.
(emacs)[arguments]<#:modules>: Use it here.
<#:configure-flags> Add “--with-native-compilation”.
<#:make-flags>: Add “NATIVE_FULL_AOT=1”.
<#:phases>: Add ‘set-libgccjit-path’ and ‘patch-compilation-driver’.
[inputs]: Add explicit ld-wrapper, binutils, glibc, and libgccjit.
[search-paths]: Add EMACSNATIVELOADPATH.
(emacs-minimal, emacs-xwidgets, emacs-no-x)
(emacs-no-x-toolkit): Adjust accordingly.
---
 gnu/packages/emacs.scm | 67 ++++++++++++++++++++++++++++++++++++++++--
 1 file changed, 65 insertions(+), 2 deletions(-)

diff --git a/gnu/packages/emacs.scm b/gnu/packages/emacs.scm
index ffd1eda08e..6c3bee03d5 100644
--- a/gnu/packages/emacs.scm
+++ b/gnu/packages/emacs.scm
@@ -45,6 +45,7 @@ (define-module (gnu packages emacs)
   #:use-module (guix gexp)
   #:use-module (guix download)
   #:use-module (guix git-download)
+  #:use-module (guix build-system)
   #:use-module (guix build-system gnu)
   #:use-module (guix build-system glib-or-gtk)
   #:use-module (gnu packages)
@@ -55,6 +56,7 @@ (define-module (gnu packages emacs)
   #:use-module (gnu packages fontutils)
   #:use-module (gnu packages freedesktop)
   #:use-module (gnu packages fribidi)
+  #:use-module (gnu packages gcc)
   #:use-module (gnu packages gd)
   #:use-module (gnu packages gettext)
   #:use-module (gnu packages ghostscript)
@@ -81,6 +83,13 @@ (define-module (gnu packages emacs)
   #:use-module (ice-9 match)
   #:use-module (srfi srfi-1))
 
+(define (%emacs-modules build-system)
+  (let ((which (build-system-name build-system)))
+    `((guix build ,(symbol-append which '-build-system))
+      (guix build utils)
+      (srfi srfi-1)
+      (ice-9 ftw))))
+
 (define-public emacs
   (package
     (name "emacs")
@@ -129,11 +138,33 @@ (define-public emacs
     (arguments
      (list
       #:tests? #f                      ; no check target
+      #:modules (%emacs-modules build-system)
       #:configure-flags #~(list "--with-modules"
                                 "--with-cairo"
+                                "--with-native-compilation"
                                 "--disable-build-details")
+      #:make-flags #~(list "NATIVE_FULL_AOT=1")
       #:phases
       #~(modify-phases %standard-phases
+          (add-after 'set-paths 'set-libgccjit-path
+            (lambda* (#:key inputs #:allow-other-keys)
+              (define (first-subdirectory/absolute directory)
+                (let ((files (scandir
+                              directory
+                              (lambda (file)
+                                (and (not (member file '("." "..")))
+                                     (file-is-directory? (string-append
+                                                          directory "/"
+                                                          file)))))))
+                  (and (not (null? files))
+                       (string-append directory "/" (car files)))))
+              (let* ((libgccjit-libdir
+                      (first-subdirectory/absolute ;; version
+                       (first-subdirectory/absolute ;; host type
+                        (search-input-directory inputs "lib/gcc")))))
+                (setenv "LIBRARY_PATH"
+                        (string-append (getenv "LIBRARY_PATH")
+                                       ":" libgccjit-libdir)))))
           (add-after 'unpack 'enable-elogind
             (lambda _
               (substitute* "configure.ac"
@@ -164,6 +195,20 @@ (define-public emacs
                 (("\\(tramp-compat-process-running-p \"(.*)\"\\)" all process)
                  (format #f "(or ~a (tramp-compat-process-running-p ~s))"
                          all (string-append "." process "-real"))))))
+          (add-after 'unpack 'patch-compilation-driver
+            (lambda _
+              (substitute* "lisp/emacs-lisp/comp.el"
+                (("\\(defcustom native-comp-driver-options nil")
+                 (format
+                  #f "(defcustom native-comp-driver-options '(~@{~s~^ ~})"
+                  (string-append
+                   "-B" #$(this-package-input "binutils") "/bin/")
+                  (string-append
+                   "-B" #$(this-package-input "glibc") "/lib/")
+                  (string-append
+                   "-B" #$(this-package-input "libgccjit") "/lib/")
+                  (string-append
+                   "-B" #$(this-package-input "libgccjit") "/lib/gcc/"))))))
           (add-before 'configure 'fix-/bin/pwd
             (lambda _
               ;; Use `pwd', not `/bin/pwd'.
@@ -256,6 +301,14 @@ (define* (emacs-byte-compile-directory dir)
      (list gnutls
            ncurses
 
+           ;; To "unshadow" ld-wrapper in native builds
+           (make-ld-wrapper "ld-wrapper" #:binutils binutils)
+
+           ;; For native compilation
+           binutils
+           glibc
+           libgccjit
+
            ;; Required for "core" functionality, such as dired and compression.
            coreutils
            gzip
@@ -307,6 +360,9 @@ (define* (emacs-byte-compile-directory dir)
      (list (search-path-specification
             (variable "EMACSLOADPATH")
             (files '("share/emacs/site-lisp")))
+           (search-path-specification
+            (variable "EMACSNATIVELOADPATH")
+            (files '("lib/emacs/native-site-lisp")))
            (search-path-specification
             (variable "INFOPATH")
             (files '("share/info")))))
@@ -377,12 +433,16 @@ (define-public emacs-minimal
     (arguments
      (substitute-keyword-arguments (package-arguments emacs)
        ((#:configure-flags flags #~'())
-        #~(list "--with-gnutls=no" "--disable-build-details"))
+        #~(list "--with-gnutls=no" "--with-native-compilation"
+                "--disable-build-details"))
+       ((#:modules _) (%emacs-modules build-system))
        ((#:phases phases)
         #~(modify-phases #$phases
             (delete 'restore-emacs-pdmp)
             (delete 'strip-double-wrap)))))
-    (inputs (list ncurses coreutils gzip))
+    (inputs (list ncurses coreutils gzip
+                  (make-ld-wrapper "ld-wrapper" #:binutils binutils)
+                  binutils glibc libgccjit zlib))
     (native-inputs (list autoconf pkg-config))))
 
 (define-public emacs-xwidgets
@@ -395,6 +455,7 @@ (define-public emacs-xwidgets
      (substitute-keyword-arguments (package-arguments emacs)
        ((#:configure-flags flags #~'())
         #~(cons "--with-xwidgets" #$flags))
+       ((#:modules _) (%emacs-modules build-system))
        ((#:phases phases)
         #~(modify-phases #$phases
             (delete 'restore-emacs-pdmp)
@@ -419,6 +480,7 @@ (define-public emacs-no-x
      (substitute-keyword-arguments (package-arguments emacs)
        ((#:configure-flags flags #~'())
         #~(delete "--with-cairo" #$flags))
+       ((#:modules _) (%emacs-modules build-system))
        ((#:phases phases)
         #~(modify-phases #$phases
             (delete 'restore-emacs-pdmp)
@@ -437,6 +499,7 @@ (define-public emacs-no-x-toolkit
      (substitute-keyword-arguments (package-arguments emacs)
        ((#:configure-flags flags #~'())
         #~(cons "--with-x-toolkit=no" #$flags))
+       ((#:modules _) (%emacs-modules build-system))
        ((#:phases phases)
         #~(modify-phases #$phases
            (delete 'restore-emacs-pdmp)
-- 
2.37.2





^ permalink raw reply related	[flat|nested] 44+ messages in thread

* bug#55657: libgccjit is unusable
  2022-08-05 21:31                     ` Liliana Marie Prikler
@ 2022-08-06  5:37                       ` John Kehayias via Bug reports for GNU Guix
  2022-08-06  5:53                         ` Liliana Marie Prikler
  0 siblings, 1 reply; 44+ messages in thread
From: John Kehayias via Bug reports for GNU Guix @ 2022-08-06  5:37 UTC (permalink / raw)
  To: Liliana Marie Prikler
  Cc: Andrew Whatson, Tobias Geerinckx-Rice, remco@remworks.net,
	55657@debbugs.gnu.org

Hello,

------- Original Message -------
On Friday, August 5th, 2022 at 5:31 PM, Liliana Marie Prikler wrote:

> The style changes are not the only thing at play here, though. In
> particular, I am trying to build Emacs 28.1, whereas Andrew builds
> other versions, though notably the newest one ought to include the
> smoke test. You could also try other combinations for libgccjit and
> gcc to see if those make a difference – last time I tried it did not.
>

I'm seeing the same version, 28.1.90, in yours and from Andrew's channel. And just checking that indeed it is 28.1.90 that I've been running locally from that channel, with libgccjit@11.3.0. I have not tried with v29.

> Attached the definitions as a file this time.
>

Thanks, will play around with it this weekend to see if I have anything useful to add.






^ permalink raw reply	[flat|nested] 44+ messages in thread

* bug#55657: libgccjit is unusable
  2022-08-06  5:37                       ` John Kehayias via Bug reports for GNU Guix
@ 2022-08-06  5:53                         ` Liliana Marie Prikler
  2022-08-07  3:19                           ` John Kehayias via Bug reports for GNU Guix
  0 siblings, 1 reply; 44+ messages in thread
From: Liliana Marie Prikler @ 2022-08-06  5:53 UTC (permalink / raw)
  To: John Kehayias
  Cc: Andrew Whatson, Tobias Geerinckx-Rice, remco@remworks.net,
	55657@debbugs.gnu.org

Am Samstag, dem 06.08.2022 um 05:37 +0000 schrieb John Kehayias:
> Hello,
> 
> ------- Original Message -------
> On Friday, August 5th, 2022 at 5:31 PM, Liliana Marie Prikler wrote:
> 
> > The style changes are not the only thing at play here, though. In
> > particular, I am trying to build Emacs 28.1, whereas Andrew builds
> > other versions, though notably the newest one ought to include the
> > smoke test. You could also try other combinations for libgccjit and
> > gcc to see if those make a difference – last time I tried it did
> > not.
> > 
> 
> I'm seeing the same version, 28.1.90, in yours and from Andrew's
> channel. And just checking that indeed it is 28.1.90 that I've been
> running locally from that channel, with libgccjit@11.3.0. I have not
> tried with v29.
Pardon that, it's an artifact from trying to fetch 28.1.90 via url-
fetch and failing.  Note that the hash is the one for 28.1.




^ permalink raw reply	[flat|nested] 44+ messages in thread

* bug#55657: libgccjit is unusable
  2022-08-06  5:53                         ` Liliana Marie Prikler
@ 2022-08-07  3:19                           ` John Kehayias via Bug reports for GNU Guix
  2022-08-07 13:59                             ` Liliana Marie Prikler
  0 siblings, 1 reply; 44+ messages in thread
From: John Kehayias via Bug reports for GNU Guix @ 2022-08-07  3:19 UTC (permalink / raw)
  To: Liliana Marie Prikler
  Cc: Andrew Whatson, Tobias Geerinckx-Rice, remco@remworks.net,
	55657@debbugs.gnu.org

Hi,

------- Original Message -------
On Saturday, August 6th, 2022 at 1:53 AM, Liliana Marie Prikler <liliana.prikler@gmail.com> wrote:

> Pardon that, it's an artifact from trying to fetch 28.1.90 via url-
> fetch and failing. Note that the hash is the one for 28.1.

On Andrew's channel I can change the version/commit/hash to 28.1 and it builds fine. Though this is using a git checkout at the 28.1 tag commit, but I don't think that matters here? (Emacs runs too, but only tried in guix shell and just to see it opens, didn't see if it compiles anything.)

And yet with your code I cannot. I tried using the phase from Andrew instead of your code, tried adding gcc to the native-inputs to match Andrew, used gcc-11 with libgccjit-11, ...still the same configure failure on the libgccjit test program: can't find libgccjit.so

Weird.

Adding just the libgccjit library path to LD_LIBRARY_PATH makes configure find libgccjit, but then fails to find libx11 in that same libgccjit test program. Instead, making LD_LIBRARY_PATH=LIBRARY_PATH fixes the configure and it finally fails on the runpath validation. Maybe cause of messing with LD_LIBRARY_PATH or could use the patch Andrew has? Anyway, wasn't looking into this.

I thought I had a similar problem with the test program you had started with, but in the end just the LIBRARY_PATH tweak was needed. I wish I could remember the combination of things I tried that also had it failing to find libgccjit. Or perhaps it was something libgccjit was linked to, but I hadn't explored?

So. I tried to see what was different between your and Andrew's code and I'm not seeing what it could be. There must be some subtle difference we're missing? Seems we have all the ingredients and a known working example.

John




^ permalink raw reply	[flat|nested] 44+ messages in thread

* bug#55657: libgccjit is unusable
  2022-08-07  3:19                           ` John Kehayias via Bug reports for GNU Guix
@ 2022-08-07 13:59                             ` Liliana Marie Prikler
  2022-08-07 15:09                               ` John Kehayias via Bug reports for GNU Guix
  0 siblings, 1 reply; 44+ messages in thread
From: Liliana Marie Prikler @ 2022-08-07 13:59 UTC (permalink / raw)
  To: John Kehayias
  Cc: Andrew Whatson, Tobias Geerinckx-Rice, remco@remworks.net,
	55657@debbugs.gnu.org

Am Sonntag, dem 07.08.2022 um 03:19 +0000 schrieb John Kehayias:
> So. I tried to see what was different between your and Andrew's code
> and I'm not seeing what it could be. There must be some subtle
> difference we're missing? Seems we have all the ingredients and a
> known working example.
It's a really stupid one.  Basically, the tests and really any
executable you try to build fails to execute without LD_LIBRARY_PATH
set.  Now obviously, that's an issue with ld and you know which package
has ld?  That's right, it's binutils!

In Andrew's recipe, he sneakily snarfed out binutils from inputs using
assoc-ref, but I'm using the new package style with (this-package-
input) to achieve the same thing, so I had to add binutils.  But this
now shadows ld-wrapper.  So we have to add ld-wrapper as well.  Now
this makes me question whether the driver options are actually sane or
whether we'd have to prepend ld-wrapper to those as well.

WDYT, Andrew?




^ permalink raw reply	[flat|nested] 44+ messages in thread

* bug#55657: libgccjit is unusable
  2022-08-07 13:59                             ` Liliana Marie Prikler
@ 2022-08-07 15:09                               ` John Kehayias via Bug reports for GNU Guix
  2022-08-07 15:41                                 ` Liliana Marie Prikler
  0 siblings, 1 reply; 44+ messages in thread
From: John Kehayias via Bug reports for GNU Guix @ 2022-08-07 15:09 UTC (permalink / raw)
  To: Liliana Marie Prikler
  Cc: Andrew Whatson, Tobias Geerinckx-Rice, remco@remworks.net,
	55657@debbugs.gnu.org

------- Original Message -------
On Sunday, August 7th, 2022 at 9:59 AM, Liliana Marie Prikler wrote:

> It's a really stupid one. Basically, the tests and really any
> executable you try to build fails to execute without LD_LIBRARY_PATH
> set. Now obviously, that's an issue with ld and you know which package
> has ld? That's right, it's binutils!
>

Ah! That LD_LIBRARY_PATH was needed was the clue.

> In Andrew's recipe, he sneakily snarfed out binutils from inputs using
> assoc-ref, but I'm using the new package style with (this-package-
> input) to achieve the same thing, so I had to add binutils. But this
> now shadows ld-wrapper. So we have to add ld-wrapper as well. Now
> this makes me question whether the driver options are actually sane or
> whether we'd have to prepend ld-wrapper to those as well.
>

Is the assoc-ref for binutils (implicit input?) equivalent to just using #$binutils directly? e.g. (string-append "-B" #$binutils "/bin/") with no added binutils to the inputs. Is that not a good idea? As a test, that does indeed work, everything configures, builds, and runs (only tested opening with no configuration).

> WDYT, Andrew?




^ permalink raw reply	[flat|nested] 44+ messages in thread

* bug#55657: libgccjit is unusable
  2022-08-07 15:09                               ` John Kehayias via Bug reports for GNU Guix
@ 2022-08-07 15:41                                 ` Liliana Marie Prikler
  2022-08-09 20:44                                   ` John Kehayias via Bug reports for GNU Guix
  0 siblings, 1 reply; 44+ messages in thread
From: Liliana Marie Prikler @ 2022-08-07 15:41 UTC (permalink / raw)
  To: John Kehayias
  Cc: Andrew Whatson, Tobias Geerinckx-Rice, remco@remworks.net,
	55657@debbugs.gnu.org

Am Sonntag, dem 07.08.2022 um 15:09 +0000 schrieb John Kehayias:
> Is the assoc-ref for binutils (implicit input?) equivalent to just
> using #$binutils directly? e.g. (string-append "-B" #$binutils
> "/bin/") with no added binutils to the inputs. Is that not a good
> idea? As a test, that does indeed work, everything configures,
> builds, and runs (only tested opening with no configuration).
Not quite, because this binutils is actually binutils-final from
commencement.scm, which it doesn't seem we can import the normal way. 
Also doing this would make it so that binutils isn't configurable,
which with an input you get.  The trick is just to also use make-ld-
wrapper from base.scm

Cheers




^ permalink raw reply	[flat|nested] 44+ messages in thread

* [bug#57086] [PATCH 5/6] guix: emacs-utils: Add emacs-compile-directory.
  2022-08-09 18:37 ` bug#55657: [PATCH 0/6] Add native compilation to Emacs Liliana Marie Prikler
                     ` (8 preceding siblings ...)
  2022-08-09 18:26   ` [bug#57086] [PATCH v3 5/7] guix: emacs-utils: Add emacs-compile-directory Liliana Marie Prikler
@ 2022-08-09 18:26   ` Liliana Marie Prikler
  2022-08-09 18:26     ` [bug#57086] [PATCH v2 " Liliana Marie Prikler
  2022-08-09 18:32   ` [bug#57086] [PATCH v3 6/7] build-system: emacs: Use native compilation Liliana Marie Prikler
                     ` (4 subsequent siblings)
  14 siblings, 1 reply; 44+ messages in thread
From: Liliana Marie Prikler @ 2022-08-09 18:26 UTC (permalink / raw)
  To: 57086

* guix/build/emacs-utils.scm (emacs-compile-directory): New variable.
---
 guix/build/emacs-utils.scm | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/guix/build/emacs-utils.scm b/guix/build/emacs-utils.scm
index 8ee547f2b3..17155a0b8b 100644
--- a/guix/build/emacs-utils.scm
+++ b/guix/build/emacs-utils.scm
@@ -38,6 +38,7 @@ (define-module (guix build emacs-utils)
 
             emacs-generate-autoloads
             emacs-byte-compile-directory
+            emacs-compile-directory
             emacs-header-parse
 
             as-display
@@ -115,6 +116,31 @@ (define* (emacs-byte-compile-directory dir)
                 (byte-recompile-directory (file-name-as-directory ,dir) 0 1))))
     (emacs-batch-eval expr)))
 
+(define* (emacs-compile-directory dir)
+  "Compile all files in DIR to native code.
+
+If native code is not supported, compile to bytecode instead."
+  (emacs-batch-eval
+    `(let ((byte-compile-debug t)       ; for proper exit status
+           (byte+native-compile (native-comp-available-p))
+           (files (directory-files-recursively ,dir "\\.el$")))
+       (mapc
+        (lambda (file)
+          (let (byte-to-native-output-file)
+            (if byte+native-compile
+                (native-compile file (concat (file-name-sans-extension file)
+                                             ".eln"))
+                (byte-compile-file file))
+            ;; Sadly, we can't use pcase because quasiquote works different in
+            ;; Emacs.  See `batch-byte+native-compile' in comp.el for the
+            ;; actual shape of byte-to-native-output-file.
+            (unless (null byte-to-native-output-file)
+              (rename-file (car byte-to-native-output-file)
+                           (cdr byte-to-native-output-file)
+                           t))))
+       files))
+    #:dynamic? #t))
+
 (define (emacs-header-parse section file)
   "Parse the header SECTION in FILE and return it as a string."
   (emacs-batch-script
-- 
2.37.0





^ permalink raw reply related	[flat|nested] 44+ messages in thread

* [bug#57086] [PATCH v2 5/6] guix: emacs-utils: Add emacs-compile-directory.
  2022-08-09 18:26   ` [bug#57086] [PATCH 5/6] " Liliana Marie Prikler
@ 2022-08-09 18:26     ` Liliana Marie Prikler
  0 siblings, 0 replies; 44+ messages in thread
From: Liliana Marie Prikler @ 2022-08-09 18:26 UTC (permalink / raw)
  To: 57086; +Cc: (

* guix/build/emacs-utils.scm (emacs-compile-directory): New variable.
---
 guix/build/emacs-utils.scm | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)

diff --git a/guix/build/emacs-utils.scm b/guix/build/emacs-utils.scm
index 8ee547f2b3..2eb8f30120 100644
--- a/guix/build/emacs-utils.scm
+++ b/guix/build/emacs-utils.scm
@@ -38,6 +38,7 @@ (define-module (guix build emacs-utils)
 
             emacs-generate-autoloads
             emacs-byte-compile-directory
+            emacs-compile-directory
             emacs-header-parse
 
             as-display
@@ -115,6 +116,33 @@ (define* (emacs-byte-compile-directory dir)
                 (byte-recompile-directory (file-name-as-directory ,dir) 0 1))))
     (emacs-batch-eval expr)))
 
+(define* (emacs-compile-directory dir)
+  "Compile all files in DIR to native code.
+
+If native code is not supported, compile to bytecode instead."
+  (emacs-batch-eval
+    `(let ((byte-compile-debug t)       ; for proper exit status
+           (byte+native-compile (native-comp-available-p))
+           (files (directory-files-recursively ,dir "\\.el$")))
+       (mapc
+        (lambda (file)
+          (let (byte-to-native-output-file
+                ;; For trampoline compilations
+                (native-compile-target-directory (file-name-directory file)))
+            (if byte+native-compile
+                (native-compile file (concat (file-name-sans-extension file)
+                                             ".eln"))
+                (byte-compile-file file))
+            ;; Sadly, we can't use pcase because quasiquote works different in
+            ;; Emacs.  See `batch-byte+native-compile' in comp.el for the
+            ;; actual shape of byte-to-native-output-file.
+            (unless (null byte-to-native-output-file)
+              (rename-file (car byte-to-native-output-file)
+                           (cdr byte-to-native-output-file)
+                           t))))
+       files))
+    #:dynamic? #t))
+
 (define (emacs-header-parse section file)
   "Parse the header SECTION in FILE and return it as a string."
   (emacs-batch-script
-- 
2.37.0





^ permalink raw reply related	[flat|nested] 44+ messages in thread

* [bug#57086] [PATCH v3 5/7] guix: emacs-utils: Add emacs-compile-directory.
  2022-08-09 18:37 ` bug#55657: [PATCH 0/6] Add native compilation to Emacs Liliana Marie Prikler
                     ` (7 preceding siblings ...)
  2022-08-05 22:37   ` [bug#57086] [PATCH v3 4/7] " Liliana Marie Prikler
@ 2022-08-09 18:26   ` Liliana Marie Prikler
  2022-08-09 18:26   ` [bug#57086] [PATCH 5/6] " Liliana Marie Prikler
                     ` (5 subsequent siblings)
  14 siblings, 0 replies; 44+ messages in thread
From: Liliana Marie Prikler @ 2022-08-09 18:26 UTC (permalink / raw)
  To: 57086

* guix/build/emacs-utils.scm (emacs-compile-directory): New variable.
---
 guix/build/emacs-utils.scm | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)

diff --git a/guix/build/emacs-utils.scm b/guix/build/emacs-utils.scm
index 8ee547f2b3..fdca05602e 100644
--- a/guix/build/emacs-utils.scm
+++ b/guix/build/emacs-utils.scm
@@ -38,6 +38,7 @@ (define-module (guix build emacs-utils)
 
             emacs-generate-autoloads
             emacs-byte-compile-directory
+            emacs-compile-directory
             emacs-header-parse
 
             as-display
@@ -115,6 +116,35 @@ (define* (emacs-byte-compile-directory dir)
                 (byte-recompile-directory (file-name-as-directory ,dir) 0 1))))
     (emacs-batch-eval expr)))
 
+(define* (emacs-compile-directory dir)
+  "Compile all files in DIR to native code.
+
+If native code is not supported, compile to bytecode instead."
+  (emacs-batch-eval
+    `(let ((byte-compile-debug t)       ; for proper exit status
+           (byte+native-compile (native-comp-available-p))
+           (files (directory-files-recursively ,dir "\\.el$")))
+       (mapc
+        (lambda (file)
+          (let (byte-to-native-output-file
+                ;; First entry is the eln-cache of the homeless shelter,
+                ;; second entry is the install directory.
+                (eln-dir (and (native-comp-available-p)
+                              (cadr native-comp-eln-load-path))))
+            (if byte+native-compile
+                (native-compile file
+                                (comp-el-to-eln-filename file eln-dir))
+                (byte-compile-file file))
+            ;; Sadly, we can't use pcase because quasiquote works different in
+            ;; Emacs.  See `batch-byte+native-compile' in comp.el for the
+            ;; actual shape of byte-to-native-output-file.
+            (unless (null byte-to-native-output-file)
+              (rename-file (car byte-to-native-output-file)
+                           (cdr byte-to-native-output-file)
+                           t))))
+       files))
+    #:dynamic? #t))
+
 (define (emacs-header-parse section file)
   "Parse the header SECTION in FILE and return it as a string."
   (emacs-batch-script
-- 
2.37.2





^ permalink raw reply related	[flat|nested] 44+ messages in thread

* [bug#57086] [PATCH 6/6] build-system: emacs: Use native compilation.
  2022-08-09 18:37 ` bug#55657: [PATCH 0/6] Add native compilation to Emacs Liliana Marie Prikler
                     ` (10 preceding siblings ...)
  2022-08-09 18:32   ` [bug#57086] [PATCH v3 6/7] build-system: emacs: Use native compilation Liliana Marie Prikler
@ 2022-08-09 18:32   ` Liliana Marie Prikler
  2022-08-09 21:19   ` [bug#57086] [PATCH 0/6] Add native compilation to Emacs ( via Guix-patches via
                     ` (2 subsequent siblings)
  14 siblings, 0 replies; 44+ messages in thread
From: Liliana Marie Prikler @ 2022-08-09 18:32 UTC (permalink / raw)
  To: 57086

* guix/build/emacs-build-system.scm (build): Use ‘emacs-compile-directory’
rather than ‘emacs-byte-compile-directory’.  Also delete already compiled
files in the working directory prior to compilation.
---
 guix/build/emacs-build-system.scm | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/guix/build/emacs-build-system.scm b/guix/build/emacs-build-system.scm
index 6a6918bfdd..9ecfceccf1 100644
--- a/guix/build/emacs-build-system.scm
+++ b/guix/build/emacs-build-system.scm
@@ -110,11 +110,14 @@ (define* (expand-load-path #:key (prepend-source? #t) #:allow-other-keys)
 
 (define* (build #:key outputs inputs #:allow-other-keys)
   "Compile .el files."
+  ;; Ensure that already compiled files in the working directory don't shadow
+  ;; the build.  Might happen, because check runs first.
+  (for-each delete-file (find-files "." "\\.el[cn]$"))
   (let* ((emacs (search-input-file inputs "/bin/emacs"))
          (out (assoc-ref outputs "out")))
     (setenv "SHELL" "sh")
     (parameterize ((%emacs emacs))
-      (emacs-byte-compile-directory (elpa-directory out)))))
+      (emacs-compile-directory (elpa-directory out)))))
 
 (define* (patch-el-files #:key outputs #:allow-other-keys)
   "Substitute the absolute \"/bin/\" directory with the right location in the
-- 
2.37.0





^ permalink raw reply related	[flat|nested] 44+ messages in thread

* [bug#57086] [PATCH v3 6/7] build-system: emacs: Use native compilation.
  2022-08-09 18:37 ` bug#55657: [PATCH 0/6] Add native compilation to Emacs Liliana Marie Prikler
                     ` (9 preceding siblings ...)
  2022-08-09 18:26   ` [bug#57086] [PATCH 5/6] " Liliana Marie Prikler
@ 2022-08-09 18:32   ` Liliana Marie Prikler
  2022-08-09 18:32   ` [bug#57086] [PATCH 6/6] " Liliana Marie Prikler
                     ` (3 subsequent siblings)
  14 siblings, 0 replies; 44+ messages in thread
From: Liliana Marie Prikler @ 2022-08-09 18:32 UTC (permalink / raw)
  To: 57086

* guix/build/emacs-build-system.scm (add-install-to-native-load-path):
New variable.
(build): Replace ‘emacs-byte-compile-directory’ with ‘emacs-compile-directory’.
Delete already compiled files in the working directory prior to compilation.
(%standard-phases): Add ‘add-install-to-native-load-path’ after
‘expand-load-path’.
---
 guix/build/emacs-build-system.scm | 20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)

diff --git a/guix/build/emacs-build-system.scm b/guix/build/emacs-build-system.scm
index 6a6918bfdd..3808b60445 100644
--- a/guix/build/emacs-build-system.scm
+++ b/guix/build/emacs-build-system.scm
@@ -108,13 +108,29 @@ (define* (expand-load-path #:key (prepend-source? #t) #:allow-other-keys)
         (format #t "expanded load paths for ~{~a~^, ~}\n"
                 (map basename diff))))))
 
+(define* (add-install-to-native-load-path #:key outputs #:allow-other-keys)
+  "Append the native-site-lisp of OUTPUT to EMACSNATIVELOADPATH."
+  (let ((native-load-path (or (false-if-exception
+                               (string-split (getenv "EMACSNATIVELOADPATH") #\:))
+                              '()))
+        (install-directory (string-append (assoc-ref outputs "out")
+                                          "/lib/emacs/native-site-lisp")))
+    (setenv "EMACSNATIVELOADPATH"
+            ;; Emacs pushes these directories in reverse order, so the
+            ;; last one will be the first.
+            (string-join `(,@native-load-path ,install-directory)
+                         ":"))))
+
 (define* (build #:key outputs inputs #:allow-other-keys)
   "Compile .el files."
+  ;; Ensure that already compiled files in the working directory don't shadow
+  ;; the build.  Might happen, because check runs first.
+  (for-each delete-file (find-files "." "\\.el[cn]$"))
   (let* ((emacs (search-input-file inputs "/bin/emacs"))
          (out (assoc-ref outputs "out")))
     (setenv "SHELL" "sh")
     (parameterize ((%emacs emacs))
-      (emacs-byte-compile-directory (elpa-directory out)))))
+      (emacs-compile-directory (elpa-directory out)))))
 
 (define* (patch-el-files #:key outputs #:allow-other-keys)
   "Substitute the absolute \"/bin/\" directory with the right location in the
@@ -343,6 +359,8 @@ (define %standard-phases
   (modify-phases gnu:%standard-phases
     (replace 'unpack unpack)
     (add-after 'unpack 'expand-load-path expand-load-path)
+    (add-after 'expand-load-path 'add-install-to-native-load-path
+      add-install-to-native-load-path)
     (delete 'bootstrap)
     (delete 'configure)
     (delete 'build)
-- 
2.37.2





^ permalink raw reply related	[flat|nested] 44+ messages in thread

* bug#55657: [PATCH 0/6] Add native compilation to Emacs
  2022-05-26 13:07 bug#55657: libgccjit is unusable Liliana Marie Prikler
                   ` (2 preceding siblings ...)
  2022-06-28  0:53 ` John Kehayias via Bug reports for GNU Guix
@ 2022-08-09 18:37 ` Liliana Marie Prikler
  2022-08-05  3:29   ` [bug#57086] [PATCH v3 1/7] gnu: Parameterize libgccjit Liliana Marie Prikler
                     ` (14 more replies)
  3 siblings, 15 replies; 44+ messages in thread
From: Liliana Marie Prikler @ 2022-08-09 18:37 UTC (permalink / raw)
  To: guix-patches

Hi Guix,

at long last the following patch set should enable native compilation
for both Emacs and emacs-build-system.  I tested emacs-dash and at the
very least native code is generated, though I haven't yet checked
whether it is also loaded.

As with any shiny new Emacs feature, please verify that the Emacs
portion of your manifests/home configurations build and report any
related errors *before* I push this and curse your configuration.

Cheers

Liliana Marie Prikler (6):
  gnu: Parameterize libgccjit.
  gnu: libgccjit: Build with bootstrapped gcc.
  gnu: libgccjit: Build multiple versions.
  gnu: emacs: Build with native compilation.
  guix: emacs-utils: Add emacs-compile-directory.
  build-system: emacs: Use native compilation.

 gnu/packages/emacs.scm            | 64 ++++++++++++++++++++++++++++++-
 gnu/packages/gcc.scm              | 53 +++++++++++++++++--------
 guix/build/emacs-build-system.scm |  5 ++-
 guix/build/emacs-utils.scm        | 26 +++++++++++++
 4 files changed, 128 insertions(+), 20 deletions(-)

-- 
2.37.0





^ permalink raw reply	[flat|nested] 44+ messages in thread

* bug#55657: libgccjit is unusable
  2022-08-07 15:41                                 ` Liliana Marie Prikler
@ 2022-08-09 20:44                                   ` John Kehayias via Bug reports for GNU Guix
  2022-08-09 23:53                                     ` Andrew Whatson
  0 siblings, 1 reply; 44+ messages in thread
From: John Kehayias via Bug reports for GNU Guix @ 2022-08-09 20:44 UTC (permalink / raw)
  To: Liliana Marie Prikler
  Cc: Andrew Whatson, Tobias Geerinckx-Rice, remco@remworks.net,
	55657@debbugs.gnu.org

Thanks for the new patchset Lily, very excited to have emacs with native compiliation in upstream Guix! (At the very least so I don't have to compile libgccjit and emacs)

For everyone following along at home, please see https://issues.guix.gnu.org/57086

As for the original issue here, I guess the LIBRARY_PATH and ld shadowing is the workaround. I don't know if that is something that can/should be incorporated into the libgccjit package definition or should just be handled by any package using it. Currently, that will just be emacs anyway and hopefully the discussion here is useful to anyone trying to use libgccjit.

Thanks again Lily and Andrew for your work here!




^ permalink raw reply	[flat|nested] 44+ messages in thread

* [bug#57086] [PATCH 0/6] Add native compilation to Emacs
  2022-08-09 18:37 ` bug#55657: [PATCH 0/6] Add native compilation to Emacs Liliana Marie Prikler
                     ` (11 preceding siblings ...)
  2022-08-09 18:32   ` [bug#57086] [PATCH 6/6] " Liliana Marie Prikler
@ 2022-08-09 21:19   ` ( via Guix-patches via
  2022-08-10  4:19     ` Liliana Marie Prikler
  2022-08-23 20:07     ` Liliana Marie Prikler
  2022-08-24 21:59   ` [bug#57086] [PATCH v3 7/7] gnu: emacs-yasnippet: Fix build Liliana Marie Prikler
  2022-08-25  7:08   ` [bug#57086] [PATCH v3 0/7] Add native compilation to Emacs Liliana Marie Prikler
  14 siblings, 2 replies; 44+ messages in thread
From: ( via Guix-patches via @ 2022-08-09 21:19 UTC (permalink / raw)
  To: Liliana Marie Prikler, 57086

Hi Liliana,

On Tue Aug 9, 2022 at 7:37 PM BST, Liliana Marie Prikler wrote:
> As with any shiny new Emacs feature, please verify that the Emacs
> portion of your manifests/home configurations build and report any
> related errors *before* I push this and curse your configuration.

Nice work! :D Unfortunately, Geiser fails to build with this patchset
applied:

```
starting phase `set-SOURCE-DATE-EPOCH'
phase `set-SOURCE-DATE-EPOCH' succeeded after 0.0 seconds
starting phase `set-paths'
environment variable `PATH' set to `/gnu/store/4pwp9rw1y1dyf1w7z0w7qq38z7f4bcic-emacs-minimal-28.1/bin:/gnu/store/22n2s0vfvqg9v0as9h7fpdn1i9dmryvi-texinfo-6.7/bin:/gnu/store/g2ajyl8xk9aarxrgjbng2hkj3qm2v0z2-tar-1.34/bin:/gnu/store/iixwcv3k49ks1rf34pjgfzmzyhhgwng3-gzip-1.10/bin:/gnu/store/s3hl12jxz9ybs7nsy7kq7ybzz7qnzmsg-bzip2-1.0.8/bin:/gnu/store/c8isj4jq6knv0icfgr43di6q3nvdzkx7-xz-5.2.5/bin:/gnu/store/4ic6244i3ca4b4rxc2wnrgllsidyishv-file-5.39/bin:/gnu/store/ahmmvw21p11ik80lg1f953y7fd8bqkjm-diffutils-3.8/bin:/gnu/store/z39hnrwds1dgcbpfgj8dnv2cngjb2xbl-patch-2.7.6/bin:/gnu/store/39rsx3nl4c31952jybbjb8d6idr5hx7r-findutils-4.8.0/bin:/gnu/store/690qz3fg334dpwn3pn6k59n4wc943p2b-gawk-5.1.0/bin:/gnu/store/wxgv6i8g0p24q5gcyzd0yr07s8kn9680-sed-4.8/bin:/gnu/store/xjwp2hsd9256icjjybfrmznppjicywf6-grep-3.6/bin:/gnu/store/d251rfgc9nm2clzffzhgiipdvfvzkvwi-coreutils-8.32/bin:/gnu/store/55cbpsi18mahg131nmiya6km5b4mscfa-make-4.3/bin:/gnu/store/4y5m9lb8k3qkb1y9m02sw9w9a6hacd16-bash-minimal-5.1.8/bin:/gnu/store/s2pg5k98fl2g2szg9dykxyd9zl3xihv9-ld-wrapper-0/bin:/gnu/store/rc781v4k0drhaqn90xfwwpspki5x0bvf-binutils-2.37/bin:/gnu/store/069aq2v993kpc41yabp5b6vm4wb9jkhg-gcc-10.3.0/bin:/gnu/store/5h2w4qi9hk1qzzgi1w83220ydslinr4s-glibc-2.33/bin:/gnu/store/5h2w4qi9hk1qzzgi1w83220ydslinr4s-glibc-2.33/sbin'
environment variable `EMACSLOADPATH' set to `/gnu/store/4pwp9rw1y1dyf1w7z0w7qq38z7f4bcic-emacs-minimal-28.1/share/emacs/site-lisp'
environment variable `INFOPATH' set to `/gnu/store/4pwp9rw1y1dyf1w7z0w7qq38z7f4bcic-emacs-minimal-28.1/share/info:/gnu/store/22n2s0vfvqg9v0as9h7fpdn1i9dmryvi-texinfo-6.7/share/info:/gnu/store/g2ajyl8xk9aarxrgjbng2hkj3qm2v0z2-tar-1.34/share/info:/gnu/store/iixwcv3k49ks1rf34pjgfzmzyhhgwng3-gzip-1.10/share/info:/gnu/store/ahmmvw21p11ik80lg1f953y7fd8bqkjm-diffutils-3.8/share/info:/gnu/store/39rsx3nl4c31952jybbjb8d6idr5hx7r-findutils-4.8.0/share/info:/gnu/store/690qz3fg334dpwn3pn6k59n4wc943p2b-gawk-5.1.0/share/info:/gnu/store/wxgv6i8g0p24q5gcyzd0yr07s8kn9680-sed-4.8/share/info:/gnu/store/xjwp2hsd9256icjjybfrmznppjicywf6-grep-3.6/share/info:/gnu/store/d251rfgc9nm2clzffzhgiipdvfvzkvwi-coreutils-8.32/share/info:/gnu/store/55cbpsi18mahg131nmiya6km5b4mscfa-make-4.3/share/info:/gnu/store/4y5m9lb8k3qkb1y9m02sw9w9a6hacd16-bash-minimal-5.1.8/share/info:/gnu/store/rc781v4k0drhaqn90xfwwpspki5x0bvf-binutils-2.37/share/info:/gnu/store/069aq2v993kpc41yabp5b6vm4wb9jkhg-gcc-10.3.0/share/info:/gnu/store/5h2w4qi9hk1qzzgi1w83220ydslinr4s-glibc-2.33/share/info'
environment variable `BASH_LOADABLES_PATH' unset
environment variable `C_INCLUDE_PATH' set to `/gnu/store/4pwp9rw1y1dyf1w7z0w7qq38z7f4bcic-emacs-minimal-28.1/include:/gnu/store/s3hl12jxz9ybs7nsy7kq7ybzz7qnzmsg-bzip2-1.0.8/include:/gnu/store/c8isj4jq6knv0icfgr43di6q3nvdzkx7-xz-5.2.5/include:/gnu/store/4ic6244i3ca4b4rxc2wnrgllsidyishv-file-5.39/include:/gnu/store/690qz3fg334dpwn3pn6k59n4wc943p2b-gawk-5.1.0/include:/gnu/store/55cbpsi18mahg131nmiya6km5b4mscfa-make-4.3/include:/gnu/store/rc781v4k0drhaqn90xfwwpspki5x0bvf-binutils-2.37/include:/gnu/store/069aq2v993kpc41yabp5b6vm4wb9jkhg-gcc-10.3.0/include:/gnu/store/5h2w4qi9hk1qzzgi1w83220ydslinr4s-glibc-2.33/include:/gnu/store/6mjww4iz4xdan74d5bbjfh7il8rngfkk-linux-libre-headers-5.10.35/include'
environment variable `CPLUS_INCLUDE_PATH' set to `/gnu/store/4pwp9rw1y1dyf1w7z0w7qq38z7f4bcic-emacs-minimal-28.1/include:/gnu/store/s3hl12jxz9ybs7nsy7kq7ybzz7qnzmsg-bzip2-1.0.8/include:/gnu/store/c8isj4jq6knv0icfgr43di6q3nvdzkx7-xz-5.2.5/include:/gnu/store/4ic6244i3ca4b4rxc2wnrgllsidyishv-file-5.39/include:/gnu/store/690qz3fg334dpwn3pn6k59n4wc943p2b-gawk-5.1.0/include:/gnu/store/55cbpsi18mahg131nmiya6km5b4mscfa-make-4.3/include:/gnu/store/rc781v4k0drhaqn90xfwwpspki5x0bvf-binutils-2.37/include:/gnu/store/069aq2v993kpc41yabp5b6vm4wb9jkhg-gcc-10.3.0/include/c++:/gnu/store/069aq2v993kpc41yabp5b6vm4wb9jkhg-gcc-10.3.0/include:/gnu/store/5h2w4qi9hk1qzzgi1w83220ydslinr4s-glibc-2.33/include:/gnu/store/6mjww4iz4xdan74d5bbjfh7il8rngfkk-linux-libre-headers-5.10.35/include'
environment variable `LIBRARY_PATH' set to `/gnu/store/4pwp9rw1y1dyf1w7z0w7qq38z7f4bcic-emacs-minimal-28.1/lib:/gnu/store/22n2s0vfvqg9v0as9h7fpdn1i9dmryvi-texinfo-6.7/lib:/gnu/store/s3hl12jxz9ybs7nsy7kq7ybzz7qnzmsg-bzip2-1.0.8/lib:/gnu/store/c8isj4jq6knv0icfgr43di6q3nvdzkx7-xz-5.2.5/lib:/gnu/store/4ic6244i3ca4b4rxc2wnrgllsidyishv-file-5.39/lib:/gnu/store/690qz3fg334dpwn3pn6k59n4wc943p2b-gawk-5.1.0/lib:/gnu/store/rc781v4k0drhaqn90xfwwpspki5x0bvf-binutils-2.37/lib:/gnu/store/5h2w4qi9hk1qzzgi1w83220ydslinr4s-glibc-2.33/lib:/gnu/store/4jdghmc65q7i7ib89zmvq66l0ghf7jc4-glibc-2.33-static/lib:/gnu/store/fnr1z6xsan0437r0yg48d0y8k32kqxby-glibc-utf8-locales-2.33/lib'
environment variable `GUIX_LOCPATH' set to `/gnu/store/fnr1z6xsan0437r0yg48d0y8k32kqxby-glibc-utf8-locales-2.33/lib/locale'
phase `set-paths' succeeded after 0.0 seconds
starting phase `install-locale'
using 'en_US.utf8' locale for category "LC_ALL"
phase `install-locale' succeeded after 0.0 seconds
starting phase `unpack'
`/gnu/store/37f6mcyinhdfs063kqd9shnv0xj1fwf8-emacs-geiser-0.23.2-checkout/readme.org' -> `./readme.org'
`/gnu/store/37f6mcyinhdfs063kqd9shnv0xj1fwf8-emacs-geiser-0.23.2-checkout/.gitignore' -> `./.gitignore'
`/gnu/store/37f6mcyinhdfs063kqd9shnv0xj1fwf8-emacs-geiser-0.23.2-checkout/.dir-locals.el' -> `./.dir-locals.el'
`/gnu/store/37f6mcyinhdfs063kqd9shnv0xj1fwf8-emacs-geiser-0.23.2-checkout/license' -> `./license'
`/gnu/store/37f6mcyinhdfs063kqd9shnv0xj1fwf8-emacs-geiser-0.23.2-checkout/news.org' -> `./news.org'
`/gnu/store/37f6mcyinhdfs063kqd9shnv0xj1fwf8-emacs-geiser-0.23.2-checkout/doc/site.conf' -> `./doc/site.conf'
`/gnu/store/37f6mcyinhdfs063kqd9shnv0xj1fwf8-emacs-geiser-0.23.2-checkout/doc/web.texi' -> `./doc/web.texi'
`/gnu/store/37f6mcyinhdfs063kqd9shnv0xj1fwf8-emacs-geiser-0.23.2-checkout/doc/parens.texi' -> `./doc/parens.texi'
`/gnu/store/37f6mcyinhdfs063kqd9shnv0xj1fwf8-emacs-geiser-0.23.2-checkout/doc/macros.texi' -> `./doc/macros.texi'
`/gnu/store/37f6mcyinhdfs063kqd9shnv0xj1fwf8-emacs-geiser-0.23.2-checkout/doc/geiser.texi' -> `./doc/geiser.texi'
`/gnu/store/37f6mcyinhdfs063kqd9shnv0xj1fwf8-emacs-geiser-0.23.2-checkout/doc/cheat.texi' -> `./doc/cheat.texi'
`/gnu/store/37f6mcyinhdfs063kqd9shnv0xj1fwf8-emacs-geiser-0.23.2-checkout/doc/geiser.css' -> `./doc/geiser.css'
`/gnu/store/37f6mcyinhdfs063kqd9shnv0xj1fwf8-emacs-geiser-0.23.2-checkout/doc/dir' -> `./doc/dir'
`/gnu/store/37f6mcyinhdfs063kqd9shnv0xj1fwf8-emacs-geiser-0.23.2-checkout/doc/top.texi' -> `./doc/top.texi'
`/gnu/store/37f6mcyinhdfs063kqd9shnv0xj1fwf8-emacs-geiser-0.23.2-checkout/doc/index.texi' -> `./doc/index.texi'
`/gnu/store/37f6mcyinhdfs063kqd9shnv0xj1fwf8-emacs-geiser-0.23.2-checkout/doc/repl.texi' -> `./doc/repl.texi'
`/gnu/store/37f6mcyinhdfs063kqd9shnv0xj1fwf8-emacs-geiser-0.23.2-checkout/doc/install.texi' -> `./doc/install.texi'
`/gnu/store/37f6mcyinhdfs063kqd9shnv0xj1fwf8-emacs-geiser-0.23.2-checkout/doc/intro.texi' -> `./doc/intro.texi'
`/gnu/store/37f6mcyinhdfs063kqd9shnv0xj1fwf8-emacs-geiser-0.23.2-checkout/doc/makefile' -> `./doc/makefile'
`/gnu/store/37f6mcyinhdfs063kqd9shnv0xj1fwf8-emacs-geiser-0.23.2-checkout/doc/thanks.texi' -> `./doc/thanks.texi'
`/gnu/store/37f6mcyinhdfs063kqd9shnv0xj1fwf8-emacs-geiser-0.23.2-checkout/doc/img/repl-mod.png' -> `./doc/img/repl-mod.png'
`/gnu/store/37f6mcyinhdfs063kqd9shnv0xj1fwf8-emacs-geiser-0.23.2-checkout/doc/img/repl-images.png' -> `./doc/img/repl-images.png'
`/gnu/store/37f6mcyinhdfs063kqd9shnv0xj1fwf8-emacs-geiser-0.23.2-checkout/doc/img/repl-menu.png' -> `./doc/img/repl-menu.png'
`/gnu/store/37f6mcyinhdfs063kqd9shnv0xj1fwf8-emacs-geiser-0.23.2-checkout/doc/img/geiser-mode.png' -> `./doc/img/geiser-mode.png'
`/gnu/store/37f6mcyinhdfs063kqd9shnv0xj1fwf8-emacs-geiser-0.23.2-checkout/doc/img/docstring.png' -> `./doc/img/docstring.png'
`/gnu/store/37f6mcyinhdfs063kqd9shnv0xj1fwf8-emacs-geiser-0.23.2-checkout/doc/img/repls.png' -> `./doc/img/repls.png'
`/gnu/store/37f6mcyinhdfs063kqd9shnv0xj1fwf8-emacs-geiser-0.23.2-checkout/doc/img/autodoc-multi.png' -> `./doc/img/autodoc-multi.png'
`/gnu/store/37f6mcyinhdfs063kqd9shnv0xj1fwf8-emacs-geiser-0.23.2-checkout/doc/img/autodoc-var.png' -> `./doc/img/autodoc-var.png'
`/gnu/store/37f6mcyinhdfs063kqd9shnv0xj1fwf8-emacs-geiser-0.23.2-checkout/doc/img/docstring-racket.png' -> `./doc/img/docstring-racket.png'
`/gnu/store/37f6mcyinhdfs063kqd9shnv0xj1fwf8-emacs-geiser-0.23.2-checkout/doc/img/autodoc-scm.png' -> `./doc/img/autodoc-scm.png'
`/gnu/store/37f6mcyinhdfs063kqd9shnv0xj1fwf8-emacs-geiser-0.23.2-checkout/doc/img/eval-error.png' -> `./doc/img/eval-error.png'
`/gnu/store/37f6mcyinhdfs063kqd9shnv0xj1fwf8-emacs-geiser-0.23.2-checkout/doc/img/repl-autodoc.png' -> `./doc/img/repl-autodoc.png'
`/gnu/store/37f6mcyinhdfs063kqd9shnv0xj1fwf8-emacs-geiser-0.23.2-checkout/doc/img/guile-eval-error.png' -> `./doc/img/guile-eval-error.png'
`/gnu/store/37f6mcyinhdfs063kqd9shnv0xj1fwf8-emacs-geiser-0.23.2-checkout/doc/img/autodoc-req.png' -> `./doc/img/autodoc-req.png'
`/gnu/store/37f6mcyinhdfs063kqd9shnv0xj1fwf8-emacs-geiser-0.23.2-checkout/doc/img/mod-completion.png' -> `./doc/img/mod-completion.png'
`/gnu/store/37f6mcyinhdfs063kqd9shnv0xj1fwf8-emacs-geiser-0.23.2-checkout/elisp/geiser-base.el' -> `./elisp/geiser-base.el'
`/gnu/store/37f6mcyinhdfs063kqd9shnv0xj1fwf8-emacs-geiser-0.23.2-checkout/elisp/geiser-popup.el' -> `./elisp/geiser-popup.el'
`/gnu/store/37f6mcyinhdfs063kqd9shnv0xj1fwf8-emacs-geiser-0.23.2-checkout/elisp/geiser-company.el' -> `./elisp/geiser-company.el'
`/gnu/store/37f6mcyinhdfs063kqd9shnv0xj1fwf8-emacs-geiser-0.23.2-checkout/elisp/geiser-autodoc.el' -> `./elisp/geiser-autodoc.el'
`/gnu/store/37f6mcyinhdfs063kqd9shnv0xj1fwf8-emacs-geiser-0.23.2-checkout/elisp/geiser-repl.el' -> `./elisp/geiser-repl.el'
`/gnu/store/37f6mcyinhdfs063kqd9shnv0xj1fwf8-emacs-geiser-0.23.2-checkout/elisp/geiser-custom.el' -> `./elisp/geiser-custom.el'
`/gnu/store/37f6mcyinhdfs063kqd9shnv0xj1fwf8-emacs-geiser-0.23.2-checkout/elisp/geiser-reload.el' -> `./elisp/geiser-reload.el'
`/gnu/store/37f6mcyinhdfs063kqd9shnv0xj1fwf8-emacs-geiser-0.23.2-checkout/elisp/geiser-menu.el' -> `./elisp/geiser-menu.el'
`/gnu/store/37f6mcyinhdfs063kqd9shnv0xj1fwf8-emacs-geiser-0.23.2-checkout/elisp/geiser-impl.el' -> `./elisp/geiser-impl.el'
`/gnu/store/37f6mcyinhdfs063kqd9shnv0xj1fwf8-emacs-geiser-0.23.2-checkout/elisp/geiser-edit.el' -> `./elisp/geiser-edit.el'
`/gnu/store/37f6mcyinhdfs063kqd9shnv0xj1fwf8-emacs-geiser-0.23.2-checkout/elisp/geiser-syntax.el' -> `./elisp/geiser-syntax.el'
`/gnu/store/37f6mcyinhdfs063kqd9shnv0xj1fwf8-emacs-geiser-0.23.2-checkout/elisp/geiser-table.el' -> `./elisp/geiser-table.el'
`/gnu/store/37f6mcyinhdfs063kqd9shnv0xj1fwf8-emacs-geiser-0.23.2-checkout/elisp/geiser.el' -> `./elisp/geiser.el'
`/gnu/store/37f6mcyinhdfs063kqd9shnv0xj1fwf8-emacs-geiser-0.23.2-checkout/elisp/geiser-connection.el' -> `./elisp/geiser-connection.el'
`/gnu/store/37f6mcyinhdfs063kqd9shnv0xj1fwf8-emacs-geiser-0.23.2-checkout/elisp/geiser-log.el' -> `./elisp/geiser-log.el'
`/gnu/store/37f6mcyinhdfs063kqd9shnv0xj1fwf8-emacs-geiser-0.23.2-checkout/elisp/geiser-mode.el' -> `./elisp/geiser-mode.el'
`/gnu/store/37f6mcyinhdfs063kqd9shnv0xj1fwf8-emacs-geiser-0.23.2-checkout/elisp/geiser-eval.el' -> `./elisp/geiser-eval.el'
`/gnu/store/37f6mcyinhdfs063kqd9shnv0xj1fwf8-emacs-geiser-0.23.2-checkout/elisp/geiser-debug.el' -> `./elisp/geiser-debug.el'
`/gnu/store/37f6mcyinhdfs063kqd9shnv0xj1fwf8-emacs-geiser-0.23.2-checkout/elisp/geiser-xref.el' -> `./elisp/geiser-xref.el'
`/gnu/store/37f6mcyinhdfs063kqd9shnv0xj1fwf8-emacs-geiser-0.23.2-checkout/elisp/geiser-doc.el' -> `./elisp/geiser-doc.el'
`/gnu/store/37f6mcyinhdfs063kqd9shnv0xj1fwf8-emacs-geiser-0.23.2-checkout/elisp/geiser-compile.el' -> `./elisp/geiser-compile.el'
`/gnu/store/37f6mcyinhdfs063kqd9shnv0xj1fwf8-emacs-geiser-0.23.2-checkout/elisp/geiser-image.el' -> `./elisp/geiser-image.el'
`/gnu/store/37f6mcyinhdfs063kqd9shnv0xj1fwf8-emacs-geiser-0.23.2-checkout/elisp/geiser-completion.el' -> `./elisp/geiser-completion.el'
phase `unpack' succeeded after 0.0 seconds
starting phase `move-source-files'
phase `move-source-files' succeeded after 0.0 seconds
starting phase `expand-load-path'
source directory "/tmp/guix-build-emacs-geiser-0.23.2.drv-0/source" prepended to the `EMACSLOADPATH' environment variable
phase `expand-load-path' succeeded after 0.0 seconds
starting phase `patch-usr-bin-file'
phase `patch-usr-bin-file' succeeded after 0.0 seconds
starting phase `patch-source-shebangs'
phase `patch-source-shebangs' succeeded after 0.0 seconds
starting phase `patch-generated-file-shebangs'
phase `patch-generated-file-shebangs' succeeded after 0.0 seconds
starting phase `check'
test suite not run
phase `check' succeeded after 0.0 seconds
starting phase `make-info'
phase `make-info' succeeded after 0.6 seconds
starting phase `install'
`/tmp/guix-build-emacs-geiser-0.23.2.drv-0/source/doc/geiser.info' -> `/gnu/store/i0gdgbcdgki015p4b9vdq6rc9mrflyqq-emacs-geiser-0.23.2/share/emacs/site-lisp/geiser-0.23.2/doc/geiser.info'
`/tmp/guix-build-emacs-geiser-0.23.2.drv-0/source/geiser-autodoc.el' -> `/gnu/store/i0gdgbcdgki015p4b9vdq6rc9mrflyqq-emacs-geiser-0.23.2/share/emacs/site-lisp/geiser-0.23.2/geiser-autodoc.el'
`/tmp/guix-build-emacs-geiser-0.23.2.drv-0/source/geiser-base.el' -> `/gnu/store/i0gdgbcdgki015p4b9vdq6rc9mrflyqq-emacs-geiser-0.23.2/share/emacs/site-lisp/geiser-0.23.2/geiser-base.el'
`/tmp/guix-build-emacs-geiser-0.23.2.drv-0/source/geiser-company.el' -> `/gnu/store/i0gdgbcdgki015p4b9vdq6rc9mrflyqq-emacs-geiser-0.23.2/share/emacs/site-lisp/geiser-0.23.2/geiser-company.el'
`/tmp/guix-build-emacs-geiser-0.23.2.drv-0/source/geiser-compile.el' -> `/gnu/store/i0gdgbcdgki015p4b9vdq6rc9mrflyqq-emacs-geiser-0.23.2/share/emacs/site-lisp/geiser-0.23.2/geiser-compile.el'
`/tmp/guix-build-emacs-geiser-0.23.2.drv-0/source/geiser-completion.el' -> `/gnu/store/i0gdgbcdgki015p4b9vdq6rc9mrflyqq-emacs-geiser-0.23.2/share/emacs/site-lisp/geiser-0.23.2/geiser-completion.el'
`/tmp/guix-build-emacs-geiser-0.23.2.drv-0/source/geiser-connection.el' -> `/gnu/store/i0gdgbcdgki015p4b9vdq6rc9mrflyqq-emacs-geiser-0.23.2/share/emacs/site-lisp/geiser-0.23.2/geiser-connection.el'
`/tmp/guix-build-emacs-geiser-0.23.2.drv-0/source/geiser-custom.el' -> `/gnu/store/i0gdgbcdgki015p4b9vdq6rc9mrflyqq-emacs-geiser-0.23.2/share/emacs/site-lisp/geiser-0.23.2/geiser-custom.el'
`/tmp/guix-build-emacs-geiser-0.23.2.drv-0/source/geiser-debug.el' -> `/gnu/store/i0gdgbcdgki015p4b9vdq6rc9mrflyqq-emacs-geiser-0.23.2/share/emacs/site-lisp/geiser-0.23.2/geiser-debug.el'
`/tmp/guix-build-emacs-geiser-0.23.2.drv-0/source/geiser-doc.el' -> `/gnu/store/i0gdgbcdgki015p4b9vdq6rc9mrflyqq-emacs-geiser-0.23.2/share/emacs/site-lisp/geiser-0.23.2/geiser-doc.el'
`/tmp/guix-build-emacs-geiser-0.23.2.drv-0/source/geiser-edit.el' -> `/gnu/store/i0gdgbcdgki015p4b9vdq6rc9mrflyqq-emacs-geiser-0.23.2/share/emacs/site-lisp/geiser-0.23.2/geiser-edit.el'
`/tmp/guix-build-emacs-geiser-0.23.2.drv-0/source/geiser-eval.el' -> `/gnu/store/i0gdgbcdgki015p4b9vdq6rc9mrflyqq-emacs-geiser-0.23.2/share/emacs/site-lisp/geiser-0.23.2/geiser-eval.el'
`/tmp/guix-build-emacs-geiser-0.23.2.drv-0/source/geiser-image.el' -> `/gnu/store/i0gdgbcdgki015p4b9vdq6rc9mrflyqq-emacs-geiser-0.23.2/share/emacs/site-lisp/geiser-0.23.2/geiser-image.el'
`/tmp/guix-build-emacs-geiser-0.23.2.drv-0/source/geiser-impl.el' -> `/gnu/store/i0gdgbcdgki015p4b9vdq6rc9mrflyqq-emacs-geiser-0.23.2/share/emacs/site-lisp/geiser-0.23.2/geiser-impl.el'
`/tmp/guix-build-emacs-geiser-0.23.2.drv-0/source/geiser-log.el' -> `/gnu/store/i0gdgbcdgki015p4b9vdq6rc9mrflyqq-emacs-geiser-0.23.2/share/emacs/site-lisp/geiser-0.23.2/geiser-log.el'
`/tmp/guix-build-emacs-geiser-0.23.2.drv-0/source/geiser-menu.el' -> `/gnu/store/i0gdgbcdgki015p4b9vdq6rc9mrflyqq-emacs-geiser-0.23.2/share/emacs/site-lisp/geiser-0.23.2/geiser-menu.el'
`/tmp/guix-build-emacs-geiser-0.23.2.drv-0/source/geiser-mode.el' -> `/gnu/store/i0gdgbcdgki015p4b9vdq6rc9mrflyqq-emacs-geiser-0.23.2/share/emacs/site-lisp/geiser-0.23.2/geiser-mode.el'
`/tmp/guix-build-emacs-geiser-0.23.2.drv-0/source/geiser-popup.el' -> `/gnu/store/i0gdgbcdgki015p4b9vdq6rc9mrflyqq-emacs-geiser-0.23.2/share/emacs/site-lisp/geiser-0.23.2/geiser-popup.el'
`/tmp/guix-build-emacs-geiser-0.23.2.drv-0/source/geiser-reload.el' -> `/gnu/store/i0gdgbcdgki015p4b9vdq6rc9mrflyqq-emacs-geiser-0.23.2/share/emacs/site-lisp/geiser-0.23.2/geiser-reload.el'
`/tmp/guix-build-emacs-geiser-0.23.2.drv-0/source/geiser-repl.el' -> `/gnu/store/i0gdgbcdgki015p4b9vdq6rc9mrflyqq-emacs-geiser-0.23.2/share/emacs/site-lisp/geiser-0.23.2/geiser-repl.el'
`/tmp/guix-build-emacs-geiser-0.23.2.drv-0/source/geiser-syntax.el' -> `/gnu/store/i0gdgbcdgki015p4b9vdq6rc9mrflyqq-emacs-geiser-0.23.2/share/emacs/site-lisp/geiser-0.23.2/geiser-syntax.el'
`/tmp/guix-build-emacs-geiser-0.23.2.drv-0/source/geiser-table.el' -> `/gnu/store/i0gdgbcdgki015p4b9vdq6rc9mrflyqq-emacs-geiser-0.23.2/share/emacs/site-lisp/geiser-0.23.2/geiser-table.el'
`/tmp/guix-build-emacs-geiser-0.23.2.drv-0/source/geiser-xref.el' -> `/gnu/store/i0gdgbcdgki015p4b9vdq6rc9mrflyqq-emacs-geiser-0.23.2/share/emacs/site-lisp/geiser-0.23.2/geiser-xref.el'
`/tmp/guix-build-emacs-geiser-0.23.2.drv-0/source/geiser.el' -> `/gnu/store/i0gdgbcdgki015p4b9vdq6rc9mrflyqq-emacs-geiser-0.23.2/share/emacs/site-lisp/geiser-0.23.2/geiser.el'
phase `install' succeeded after 0.0 seconds
starting phase `make-autoloads'
  INFO     Scraping files for geiser-autoloads.el... 
  INFO     Scraping files for geiser-autoloads.el...done
phase `make-autoloads' succeeded after 0.2 seconds
starting phase `enable-autoloads-compilation'
phase `enable-autoloads-compilation' succeeded after 0.0 seconds
starting phase `patch-el-files'
phase `patch-el-files' succeeded after 0.0 seconds
starting phase `ensure-package-description'
geiser-pkg.el file generated.
phase `ensure-package-description' succeeded after 0.3 seconds
starting phase `build'

In geiser-autodoc--show-signatures:
geiser-autodoc.el:69:12: Warning: ‘eldoc-message’ is an obsolete function (as
    of eldoc-1.1.0); use ‘eldoc-documentation-functions’ instead.
Debugger entered--Lisp error: (error "/gnu/store/i0gdgbcdgki015p4b9vdq6rc9mrflyqq-emacs-..." "Cannot find suitable directory for output in ‘nati...")
  signal(error ("/gnu/store/i0gdgbcdgki015p4b9vdq6rc9mrflyqq-emacs-..." "Cannot find suitable directory for output in ‘nati..."))
  comp--native-compile("/gnu/store/i0gdgbcdgki015p4b9vdq6rc9mrflyqq-emacs-..." nil "/gnu/store/i0gdgbcdgki015p4b9vdq6rc9mrflyqq-emacs-...")
  native-compile("/gnu/store/i0gdgbcdgki015p4b9vdq6rc9mrflyqq-emacs-..." "/gnu/store/i0gdgbcdgki015p4b9vdq6rc9mrflyqq-emacs-...")
  (if byte+native-compile (native-compile file (concat (file-name-sans-extension file) ".eln")) (byte-compile-file file))
  (let (byte-to-native-output-file) (if byte+native-compile (native-compile file (concat (file-name-sans-extension file) ".eln")) (byte-compile-file file)) (unless (null byte-to-native-output-file) (rename-file (car byte-to-native-output-file) (cdr byte-to-native-output-file) t)))
  (lambda (file) (let (byte-to-native-output-file) (if byte+native-compile (native-compile file (concat (file-name-sans-extension file) ".eln")) (byte-compile-file file)) (unless (null byte-to-native-output-file) (rename-file (car byte-to-native-output-file) (cdr byte-to-native-output-file) t))))("/gnu/store/i0gdgbcdgki015p4b9vdq6rc9mrflyqq-emacs-...")
  mapc((lambda (file) (let (byte-to-native-output-file) (if byte+native-compile (native-compile file (concat (file-name-sans-extension file) ".eln")) (byte-compile-file file)) (unless (null byte-to-native-output-file) (rename-file (car byte-to-native-output-file) (cdr byte-to-native-output-file) t)))) ("/gnu/store/i0gdgbcdgki015p4b9vdq6rc9mrflyqq-emacs-..." "/gnu/store/i0gdgbcdgki015p4b9vdq6rc9mrflyqq-emacs-..." "/gnu/store/i0gdgbcdgki015p4b9vdq6rc9mrflyqq-emacs-..." "/gnu/store/i0gdgbcdgki015p4b9vdq6rc9mrflyqq-emacs-..." "/gnu/store/i0gdgbcdgki015p4b9vdq6rc9mrflyqq-emacs-..." "/gnu/store/i0gdgbcdgki015p4b9vdq6rc9mrflyqq-emacs-..." "/gnu/store/i0gdgbcdgki015p4b9vdq6rc9mrflyqq-emacs-..." "/gnu/store/i0gdgbcdgki015p4b9vdq6rc9mrflyqq-emacs-..." "/gnu/store/i0gdgbcdgki015p4b9vdq6rc9mrflyqq-emacs-..." "/gnu/store/i0gdgbcdgki015p4b9vdq6rc9mrflyqq-emacs-..." "/gnu/store/i0gdgbcdgki015p4b9vdq6rc9mrflyqq-emacs-..." "/gnu/store/i0gdgbcdgki015p4b9vdq6rc9mrflyqq-emacs-..." "/gnu/store/i0gdgbcdgki015p4b9vdq6rc9mrflyqq-emacs-..." "/gnu/store/i0gdgbcdgki015p4b9vdq6rc9mrflyqq-emacs-..." "/gnu/store/i0gdgbcdgki015p4b9vdq6rc9mrflyqq-emacs-..." "/gnu/store/i0gdgbcdgki015p4b9vdq6rc9mrflyqq-emacs-..." "/gnu/store/i0gdgbcdgki015p4b9vdq6rc9mrflyqq-emacs-..." "/gnu/store/i0gdgbcdgki015p4b9vdq6rc9mrflyqq-emacs-..." "/gnu/store/i0gdgbcdgki015p4b9vdq6rc9mrflyqq-emacs-..." "/gnu/store/i0gdgbcdgki015p4b9vdq6rc9mrflyqq-emacs-..." "/gnu/store/i0gdgbcdgki015p4b9vdq6rc9mrflyqq-emacs-..." "/gnu/store/i0gdgbcdgki015p4b9vdq6rc9mrflyqq-emacs-..." "/gnu/store/i0gdgbcdgki015p4b9vdq6rc9mrflyqq-emacs-..." "/gnu/store/i0gdgbcdgki015p4b9vdq6rc9mrflyqq-emacs-..." "/gnu/store/i0gdgbcdgki015p4b9vdq6rc9mrflyqq-emacs-..."))
  (let ((byte-compile-debug t) (byte+native-compile (native-comp-available-p)) (files (directory-files-recursively "/gnu/store/i0gdgbcdgki015p4b9vdq6rc9mrflyqq-emacs-..." "\\.el$"))) (mapc (lambda (file) (let (byte-to-native-output-file) (if byte+native-compile (native-compile file (concat (file-name-sans-extension file) ".eln")) (byte-compile-file file)) (unless (null byte-to-native-output-file) (rename-file (car byte-to-native-output-file) (cdr byte-to-native-output-file) t)))) files))
  eval((let ((byte-compile-debug t) (byte+native-compile (native-comp-available-p)) (files (directory-files-recursively "/gnu/store/i0gdgbcdgki015p4b9vdq6rc9mrflyqq-emacs-..." "\\.el$"))) (mapc (lambda (file) (let (byte-to-native-output-file) (if byte+native-compile (native-compile file (concat ... ".eln")) (byte-compile-file file)) (unless (null byte-to-native-output-file) (rename-file (car byte-to-native-output-file) (cdr byte-to-native-output-file) t)))) files)) nil)
  command-line-1(("--eval=(eval '(let ((byte-compile-debug t) (byte+n..."))
  command-line()
  normal-top-level()

error: in phase 'build': uncaught exception:
%exception #<&invoke-error program: "/gnu/store/4pwp9rw1y1dyf1w7z0w7qq38z7f4bcic-emacs-minimal-28.1/bin/emacs" arguments: ("--quick" "--batch" "--eval=(eval '(let ((byte-compile-debug t) (byte+native-compile (native-comp-available-p)) (files (directory-files-recursively \"/gnu/store/i0gdgbcdgki015p4b9vdq6rc9mrflyqq-emacs-geiser-0.23.2/share/emacs/site-lisp/geiser-0.23.2\" \"\\\\.el$\"))) (mapc (lambda (file) (let (byte-to-native-output-file) (if byte+native-compile (native-compile file (concat (file-name-sans-extension file) \".eln\")) (byte-compile-file file)) (unless (null byte-to-native-output-file) (rename-file (car byte-to-native-output-file) (cdr byte-to-native-output-file) t)))) files)) nil)") exit-status: 255 term-signal: #f stop-signal: #f> 
phase `build' failed after 3.6 seconds
command "/gnu/store/4pwp9rw1y1dyf1w7z0w7qq38z7f4bcic-emacs-minimal-28.1/bin/emacs" "--quick" "--batch" "--eval=(eval '(let ((byte-compile-debug t) (byte+native-compile (native-comp-available-p)) (files (directory-files-recursively \"/gnu/store/i0gdgbcdgki015p4b9vdq6rc9mrflyqq-emacs-geiser-0.23.2/share/emacs/site-lisp/geiser-0.23.2\" \"\\\\.el$\"))) (mapc (lambda (file) (let (byte-to-native-output-file) (if byte+native-compile (native-compile file (concat (file-name-sans-extension file) \".eln\")) (byte-compile-file file)) (unless (null byte-to-native-output-file) (rename-file (car byte-to-native-output-file) (cdr byte-to-native-output-file) t)))) files)) nil)" failed with status 255
```

Unfortunately, the error message is truncated, so I have no idea
what's going on :(

    -- (




^ permalink raw reply	[flat|nested] 44+ messages in thread

* bug#55657: libgccjit is unusable
  2022-08-09 20:44                                   ` John Kehayias via Bug reports for GNU Guix
@ 2022-08-09 23:53                                     ` Andrew Whatson
  0 siblings, 0 replies; 44+ messages in thread
From: Andrew Whatson @ 2022-08-09 23:53 UTC (permalink / raw)
  To: John Kehayias
  Cc: Tobias Geerinckx-Rice, remco@remworks.net, Liliana Marie Prikler,
	55657@debbugs.gnu.org

John Kehayias wrote:
>
> As for the original issue here, I guess the LIBRARY_PATH and ld shadowing is the workaround. I don't know if that is something that can/should be incorporated into the libgccjit package definition or should just be handled by any package using it. Currently, that will just be emacs anyway and hopefully the discussion here is useful to anyone trying to use libgccjit.

This might be possible by adding LIBRARY_PATH to native-search-paths
in the libgccjit package definition?

> Thanks again Lily and Andrew for your work here!

Thanks John & Lily for persisting with getting this submitted, I'm
very grateful for your efforts.

Cheers,
Andrew




^ permalink raw reply	[flat|nested] 44+ messages in thread

* [bug#57086] [PATCH 0/6] Add native compilation to Emacs
  2022-08-09 21:19   ` [bug#57086] [PATCH 0/6] Add native compilation to Emacs ( via Guix-patches via
@ 2022-08-10  4:19     ` Liliana Marie Prikler
  2022-08-10  6:11       ` ( via Guix-patches via
  2022-08-23 20:07     ` Liliana Marie Prikler
  1 sibling, 1 reply; 44+ messages in thread
From: Liliana Marie Prikler @ 2022-08-10  4:19 UTC (permalink / raw)
  To: (, 57086

Am Dienstag, dem 09.08.2022 um 22:19 +0100 schrieb (:
> Hi Liliana,
> 
> On Tue Aug 9, 2022 at 7:37 PM BST, Liliana Marie Prikler wrote:
> > As with any shiny new Emacs feature, please verify that the Emacs
> > portion of your manifests/home configurations build and report any
> > related errors *before* I push this and curse your configuration.
> 
> Nice work! :D Unfortunately, Geiser fails to build with this patchset
> applied:
> 
> [...]
> Unfortunately, the error message is truncated, so I have no idea
> what's going on :(
It seems to want to write to the emacs package rather than its own
store path.  Does this thing compile recursively?

Cheers




^ permalink raw reply	[flat|nested] 44+ messages in thread

* [bug#57086] [PATCH 0/6] Add native compilation to Emacs
  2022-08-10  4:19     ` Liliana Marie Prikler
@ 2022-08-10  6:11       ` ( via Guix-patches via
  0 siblings, 0 replies; 44+ messages in thread
From: ( via Guix-patches via @ 2022-08-10  6:11 UTC (permalink / raw)
  To: Liliana Marie Prikler, 57086

On Wed Aug 10, 2022 at 5:19 AM BST, Liliana Marie Prikler wrote:
> It seems to want to write to the emacs package rather than its own
> store path.  Does this thing compile recursively?

I have no idea, sorry. But it would be very fitting for Lisp if it
did :P

    -- (




^ permalink raw reply	[flat|nested] 44+ messages in thread

* [bug#57086] [PATCH 0/6] Add native compilation to Emacs
  2022-08-09 21:19   ` [bug#57086] [PATCH 0/6] Add native compilation to Emacs ( via Guix-patches via
  2022-08-10  4:19     ` Liliana Marie Prikler
@ 2022-08-23 20:07     ` Liliana Marie Prikler
  1 sibling, 0 replies; 44+ messages in thread
From: Liliana Marie Prikler @ 2022-08-23 20:07 UTC (permalink / raw)
  To: (, 57086

Am Dienstag, dem 09.08.2022 um 22:19 +0100 schrieb (:
> Hi Liliana,
> 
> On Tue Aug 9, 2022 at 7:37 PM BST, Liliana Marie Prikler wrote:
> > As with any shiny new Emacs feature, please verify that the Emacs
> > portion of your manifests/home configurations build and report any
> > related errors *before* I push this and curse your configuration.
> 
> Nice work! :D Unfortunately, Geiser fails to build with this patchset
> applied:
So Geiser should compile with v2, but emacs-guix still fails to build.
emacs-org also fails.  Since these packages do seem somewhat popular, I
think we should try to fix it or even better fix the way emacs finds
its output directory.

Cheers




^ permalink raw reply	[flat|nested] 44+ messages in thread

* [bug#57086] [PATCH v3 7/7] gnu: emacs-yasnippet: Fix build.
  2022-08-09 18:37 ` bug#55657: [PATCH 0/6] Add native compilation to Emacs Liliana Marie Prikler
                     ` (12 preceding siblings ...)
  2022-08-09 21:19   ` [bug#57086] [PATCH 0/6] Add native compilation to Emacs ( via Guix-patches via
@ 2022-08-24 21:59   ` Liliana Marie Prikler
  2022-08-25  7:08   ` [bug#57086] [PATCH v3 0/7] Add native compilation to Emacs Liliana Marie Prikler
  14 siblings, 0 replies; 44+ messages in thread
From: Liliana Marie Prikler @ 2022-08-24 21:59 UTC (permalink / raw)
  To: 57086

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 3815 bytes --]

* gnu/packages/patches/emacs-yasnippet-fix-tests.patch: Handle arguments
in buffer-list.
---
 .../patches/emacs-yasnippet-fix-tests.patch   | 30 +++++++++++++++----
 1 file changed, 24 insertions(+), 6 deletions(-)

diff --git a/gnu/packages/patches/emacs-yasnippet-fix-tests.patch b/gnu/packages/patches/emacs-yasnippet-fix-tests.patch
index 475352d8db..c70cc75d92 100644
--- a/gnu/packages/patches/emacs-yasnippet-fix-tests.patch
+++ b/gnu/packages/patches/emacs-yasnippet-fix-tests.patch
@@ -9,12 +9,13 @@ Content-Transfer-Encoding: 8bit
 - Emacs 28 has a new mode ‘lisp-data-mode’ for Lisp data.
 - A test that was temporarily broken passes again.
 - The default for ‘org-adapt-indentation’ has changed.
+- buffer-list may be called with arguments when native-comp is enabled.
 ---
- yasnippet-tests.el | 41 ++++++++++++++++++++++++++---------------
- 1 file changed, 26 insertions(+), 15 deletions(-)
+ yasnippet-tests.el | 45 ++++++++++++++++++++++++++++-----------------
+ 1 file changed, 28 insertions(+), 17 deletions(-)
 
 diff --git a/yasnippet-tests.el b/yasnippet-tests.el
-index b8a7980f..9fadf00c 100644
+index f7ca2bb..7618ab7 100644
 --- a/yasnippet-tests.el
 +++ b/yasnippet-tests.el
 @@ -1,6 +1,6 @@
@@ -55,7 +56,21 @@ index b8a7980f..9fadf00c 100644
        ;; Some org-mode versions leave trailing whitespace, some don't.
        (delete-trailing-whitespace)
        (should (equal expected (buffer-string))))))
-@@ -1390,7 +1393,9 @@ hello ${1:$(when (stringp yas-text) (funcall func yas-text))} foo${1:$$(concat \
+@@ -1195,11 +1198,11 @@ hello ${1:$(when (stringp yas-text) (funcall func yas-text))} foo${1:$$(concat \
+   (let ((saved-sym (make-symbol "yas--buffer-list")))
+     `(let ((,saved-sym (symbol-function 'buffer-list)))
+        (cl-letf (((symbol-function 'buffer-list)
+-                  (lambda ()
++                  (lambda (&rest args)
+                     (cl-remove-if (lambda (buf)
+                                     (with-current-buffer buf
+                                       (eq major-mode 'lisp-interaction-mode)))
+-                                  (funcall ,saved-sym)))))
++                                  (funcall ,saved-sym args)))))
+          ,@body))))
+ 
+ 
+@@ -1356,7 +1359,9 @@ hello ${1:$(when (stringp yas-text) (funcall func yas-text))} foo${1:$$(concat \
                            ,@(if (fboundp 'prog-mode)
                                  '(prog-mode))
                            emacs-lisp-mode
@@ -66,7 +81,7 @@ index b8a7980f..9fadf00c 100644
                (observed (yas--modes-to-activate)))
           (should (equal major-mode (car observed)))
           (should (equal (sort expected #'string<) (sort observed #'string<))))))))
-@@ -1418,7 +1423,11 @@ hello ${1:$(when (stringp yas-text) (funcall func yas-text))} foo${1:$$(concat \
+@@ -1384,7 +1389,11 @@ hello ${1:$(when (stringp yas-text) (funcall func yas-text))} foo${1:$$(concat \
                                       '(prog-mode))
                                 emacs-lisp-mode
                                 and-also-this-one
@@ -79,7 +94,7 @@ index b8a7980f..9fadf00c 100644
                (observed (yas--modes-to-activate)))
           (should (equal expected-first
                          (cl-subseq observed 0 (length expected-first))))
-@@ -1691,9 +1700,11 @@ TODO: be meaner"
+@@ -1657,9 +1666,11 @@ TODO: be meaner"
    "Test expansion of snippets in org source blocks."
    ;; org 9+ no longer runs fontification for text-mode, so our hacks
    ;; don't work.  Note that old ert doesn't have skipping, so we have
@@ -93,3 +108,6 @@ index b8a7980f..9fadf00c 100644
                         :passed :failed)
    (let ((text-mode-hook #'yas-minor-mode))
      (do-yas-org-native-tab-in-source-block "text")))
+-- 
+2.37.2
+
-- 
2.37.2





^ permalink raw reply related	[flat|nested] 44+ messages in thread

* [bug#57086] [PATCH v3 0/7] Add native compilation to Emacs
  2022-08-09 18:37 ` bug#55657: [PATCH 0/6] Add native compilation to Emacs Liliana Marie Prikler
                     ` (13 preceding siblings ...)
  2022-08-24 21:59   ` [bug#57086] [PATCH v3 7/7] gnu: emacs-yasnippet: Fix build Liliana Marie Prikler
@ 2022-08-25  7:08   ` Liliana Marie Prikler
  14 siblings, 0 replies; 44+ messages in thread
From: Liliana Marie Prikler @ 2022-08-25  7:08 UTC (permalink / raw)
  To: 57086

Hi Guix,

After fixing some minor issues like emacs-guix, emacs-org and
emacs-yasnippet not building, this series is somewhat closer to
completion.  However, I've noticed that using emacs-minimal for
native compilation and regular emacs for running things is somewhat
suboptimal, as the two have different hashes.  There are some
remedies, such as using regular emacs as #:emacs when natively
compiling and emacs-minimal for cross-compiling – and also
removing native-compilation from the "minimal" packages – but
before I put those plans into actions I'd like to hear some
bug reports for this series.

My own emacs manifest builds now, so I consider this otherwise stable.

Cheers

Liliana Marie Prikler (7):
  gnu: Parameterize libgccjit.
  gnu: libgccjit: Build with bootstrapped gcc.
  gnu: libgccjit: Build multiple versions.
  gnu: emacs: Build with native compilation.
  guix: emacs-utils: Add emacs-compile-directory.
  build-system: emacs: Use native compilation.
  gnu: emacs-yasnippet: Fix build.

 gnu/packages/emacs.scm                        | 67 ++++++++++++++++++-
 gnu/packages/gcc.scm                          | 53 ++++++++++-----
 .../patches/emacs-yasnippet-fix-tests.patch   | 30 +++++++--
 guix/build/emacs-build-system.scm             | 20 +++++-
 guix/build/emacs-utils.scm                    | 30 +++++++++
 5 files changed, 174 insertions(+), 26 deletions(-)

-- 
2.37.2





^ permalink raw reply	[flat|nested] 44+ messages in thread

end of thread, other threads:[~2022-08-25  7:31 UTC | newest]

Thread overview: 44+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-26 13:07 bug#55657: libgccjit is unusable Liliana Marie Prikler
2022-06-04 14:07 ` Remco van 't Veer
2022-06-04 14:22 ` Tobias Geerinckx-Rice via Bug reports for GNU Guix
2022-06-04 14:25   ` Tobias Geerinckx-Rice via Bug reports for GNU Guix
2022-06-04 15:14     ` Liliana Marie Prikler
2022-06-28  0:53 ` John Kehayias via Bug reports for GNU Guix
2022-06-28  4:17   ` Liliana Marie Prikler
2022-06-28  5:16     ` John Kehayias via Bug reports for GNU Guix
2022-08-03 21:13       ` John Kehayias via Bug reports for GNU Guix
2022-08-04  4:26         ` Liliana Marie Prikler
2022-08-04  4:48           ` Andrew Whatson
2022-08-04 16:52             ` Liliana Marie Prikler
2022-08-05  0:59               ` Andrew Whatson
2022-08-05 18:44                 ` Liliana Marie Prikler
2022-08-05 20:01                   ` John Kehayias via Bug reports for GNU Guix
2022-08-05 21:31                     ` Liliana Marie Prikler
2022-08-06  5:37                       ` John Kehayias via Bug reports for GNU Guix
2022-08-06  5:53                         ` Liliana Marie Prikler
2022-08-07  3:19                           ` John Kehayias via Bug reports for GNU Guix
2022-08-07 13:59                             ` Liliana Marie Prikler
2022-08-07 15:09                               ` John Kehayias via Bug reports for GNU Guix
2022-08-07 15:41                                 ` Liliana Marie Prikler
2022-08-09 20:44                                   ` John Kehayias via Bug reports for GNU Guix
2022-08-09 23:53                                     ` Andrew Whatson
2022-08-09 18:37 ` bug#55657: [PATCH 0/6] Add native compilation to Emacs Liliana Marie Prikler
2022-08-05  3:29   ` [bug#57086] [PATCH v3 1/7] gnu: Parameterize libgccjit Liliana Marie Prikler
2022-08-05  3:29   ` [bug#57086] [PATCH 1/6] " Liliana Marie Prikler
2022-08-05 18:27   ` [bug#57086] [PATCH 2/6] gnu: libgccjit: Build with bootstrapped gcc Liliana Marie Prikler
2022-08-05 18:27   ` [bug#57086] [PATCH v3 2/7] " Liliana Marie Prikler
2022-08-05 18:30   ` [bug#57086] [PATCH v3 3/7] gnu: libgccjit: Build multiple versions Liliana Marie Prikler
2022-08-05 18:30   ` [bug#57086] [PATCH 3/6] " Liliana Marie Prikler
2022-08-05 22:37   ` [bug#57086] [PATCH 4/6] gnu: emacs: Build with native compilation Liliana Marie Prikler
2022-08-05 22:37   ` [bug#57086] [PATCH v3 4/7] " Liliana Marie Prikler
2022-08-09 18:26   ` [bug#57086] [PATCH v3 5/7] guix: emacs-utils: Add emacs-compile-directory Liliana Marie Prikler
2022-08-09 18:26   ` [bug#57086] [PATCH 5/6] " Liliana Marie Prikler
2022-08-09 18:26     ` [bug#57086] [PATCH v2 " Liliana Marie Prikler
2022-08-09 18:32   ` [bug#57086] [PATCH v3 6/7] build-system: emacs: Use native compilation Liliana Marie Prikler
2022-08-09 18:32   ` [bug#57086] [PATCH 6/6] " Liliana Marie Prikler
2022-08-09 21:19   ` [bug#57086] [PATCH 0/6] Add native compilation to Emacs ( via Guix-patches via
2022-08-10  4:19     ` Liliana Marie Prikler
2022-08-10  6:11       ` ( via Guix-patches via
2022-08-23 20:07     ` Liliana Marie Prikler
2022-08-24 21:59   ` [bug#57086] [PATCH v3 7/7] gnu: emacs-yasnippet: Fix build Liliana Marie Prikler
2022-08-25  7:08   ` [bug#57086] [PATCH v3 0/7] Add native compilation to Emacs Liliana Marie Prikler

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.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.