unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
* [bug#44775] [PATCH] WIP: Add gccemacs
@ 2020-11-21  9:15 John Soo
  2020-11-23 22:22 ` zimoun
  2023-05-29 12:06 ` bug#44775: " Jelle Licht
  0 siblings, 2 replies; 10+ messages in thread
From: John Soo @ 2020-11-21  9:15 UTC (permalink / raw)
  To: 44775

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

Hi Guix,

I was curious how fast this gccemacs branch might be, so I got it to
compile.

It feels fast but there are bugs and the closure is huge. Also these
patches do not use any of the parameterization machinery.

I just thought I would share my work.

Thanks,

John


[-- Attachment #2: 0001-gnu-Add-emacs-next-no-x.patch --]
[-- Type: text/x-patch, Size: 1780 bytes --]

From 642c087de1592aeea0e65d04589423a05a96d68e Mon Sep 17 00:00:00 2001
From: John Soo <jsoo1@asu.edu>
Date: Sat, 21 Nov 2020 00:56:30 -0800
Subject: [PATCH 1/3] gnu: Add emacs-next-no-x.

* gnu/packages/emacs.scm (emacs-next-no-x): New variable.
---
 gnu/packages/emacs.scm | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/gnu/packages/emacs.scm b/gnu/packages/emacs.scm
index 4f5a67093c..2d9f2e7ec1 100644
--- a/gnu/packages/emacs.scm
+++ b/gnu/packages/emacs.scm
@@ -22,6 +22,7 @@
 ;;; Copyright © 2019 Amin Bandali <bandali@gnu.org>
 ;;; Copyright © 2020 Jack Hill <jackhill@jackhill.us>
 ;;; Copyright © 2020 Morgan Smith <Morgan.J.Smith@outlook.com>
+;;; Copyright © 2020 John Soo <jsoo1@asu.edu>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -376,6 +377,27 @@ editor (console only)")
            (delete 'restore-emacs-pdmp)
            (delete 'strip-double-wrap)))))))
 
+(define-public emacs-next-no-x
+  (package
+    (inherit emacs-next)
+    (name "emacs-next-no-x")
+    (synopsis (package-synopsis emacs-no-x))
+    (build-system gnu-build-system)
+    (arguments
+     (substitute-keyword-arguments (package-arguments emacs-next)
+       ((#:configure-flags flags)
+        `(append '("--with-x-toolkit=no"
+                   "--with-xpm=no"
+                   "--with-jpeg=no"
+                   "--with-gif=no"
+                   "--with-tiff=no")
+                 ,flags))
+       ((#:phases phases)
+        `(modify-phases ,phases
+           (delete 'restore-emacs-pdmp)
+           (delete 'strip-double-wrap)))))
+    (inputs (package-inputs emacs-no-x))))
+
 (define-public emacs-no-x-toolkit
   (package/inherit emacs
     (name "emacs-no-x-toolkit")
-- 
2.29.1


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #3: 0002-gnu-Add-gccemacs.patch --]
[-- Type: text/x-patch, Size: 5778 bytes --]

From 3d1948d2512a5fc09ed36de752fb36178517cab2 Mon Sep 17 00:00:00 2001
From: John Soo <jsoo1@asu.edu>
Date: Sat, 21 Nov 2020 00:57:27 -0800
Subject: [PATCH 2/3] gnu: Add gccemacs.

* gnu/packages/emacs.scm (gccemacs): New variable.

Add supporting definitions for gccemacs-{version,commit,source} for other
gccemacsen.
---
 gnu/packages/emacs.scm                        | 89 +++++++++++++++++++
 gnu/packages/patches/gccemacs-exec-path.patch | 18 ++++
 2 files changed, 107 insertions(+)
 create mode 100644 gnu/packages/patches/gccemacs-exec-path.patch

diff --git a/gnu/packages/emacs.scm b/gnu/packages/emacs.scm
index 2d9f2e7ec1..6312fde3ad 100644
--- a/gnu/packages/emacs.scm
+++ b/gnu/packages/emacs.scm
@@ -53,6 +53,7 @@
   #:use-module (gnu packages compression)
   #:use-module (gnu packages fontutils)
   #:use-module (gnu packages fribidi)
+  #:use-module (gnu packages gcc)
   #:use-module (gnu packages gd)
   #:use-module (gnu packages gettext)
   #:use-module (gnu packages glib)
@@ -398,6 +399,94 @@ editor (console only)")
            (delete 'strip-double-wrap)))))
     (inputs (package-inputs emacs-no-x))))
 
+;; feature/native-comp
+(define-public gccemacs-commit
+  "6781cd670d1487bbf0364d80de68ca9733342769")
+
+(define-public gccemacs-version
+  (git-version "28.0.50" "0" gccemacs-commit))
+
+(define-public gccemacs-source
+  (origin
+   (method git-fetch)
+   (uri (git-reference
+         (url "git://git.sv.gnu.org/emacs.git")
+         (commit gccemacs-commit)))
+   (sha256
+    (base32
+     "13pmrak5jvk5qp4i5iccn0fqa6by8ig8l0n3qqirm67dxrqiz2ya"))
+   (patches (search-patches "gccemacs-exec-path.patch"
+                            "emacs-fix-scheme-indent-function.patch"
+                            "emacs-ignore-empty-xim-styles.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-sh.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\"")
+         " ")))
+      #t))))
+
+(define add-libgccjit-gcc-lib-to-library-path
+  '(lambda* (#:key inputs #:allow-other-keys)
+     (let* ((libgccjit (assoc-ref inputs "libgccjit"))
+            (gcc-dirs (find-files
+                       libgccjit "^gcc$" #:directories? #t))
+            (gcc-dirs-paths (string-join gcc-dirs ":"))
+            (prepend-to-env (lambda (val var)
+                              (setenv
+                               var (string-append
+                                    val
+                                    (or (getenv var) ""))))))
+       (prepend-to-env gcc-dirs-paths "LIBRARY_PATH")
+       (prepend-to-env gcc-dirs-paths "LD_LIBRARY_PATH")
+       (prepend-to-env gcc-dirs-paths "PATH")
+       #t)))
+
+(define-public gccemacs
+  (package
+   (inherit emacs-next)
+   (name "gccemacs")
+   (version gccemacs-version)
+   (source gccemacs-source)
+   (synopsis "The extensible, customizeable, self-documenting text
+editor (from the native compilation branch)")
+   (inputs
+    `(("libgccjit" ,(canonical-package libgccjit))
+      ,@(package-inputs emacs-next)))
+   (arguments
+    (substitute-keyword-arguments (package-arguments emacs-next)
+     ((#:phases p)
+      `(modify-phases ,p
+         (add-after 'bootstrap 'add-libgccjit-gcc-lib-to-library-path
+           ,add-libgccjit-gcc-lib-to-library-path)))
+     ((#:configure-flags flags ''())
+      `(cons "--with-nativecomp" ,flags))))))
+
 (define-public emacs-no-x-toolkit
   (package/inherit emacs
     (name "emacs-no-x-toolkit")
diff --git a/gnu/packages/patches/gccemacs-exec-path.patch b/gnu/packages/patches/gccemacs-exec-path.patch
new file mode 100644
index 0000000000..3c75f9465e
--- /dev/null
+++ b/gnu/packages/patches/gccemacs-exec-path.patch
@@ -0,0 +1,18 @@
+Do not capture the build-time value of $PATH in the 'emacs' executable
+since this can noticeably increase the size of the closure of Emacs
+with things like GCC being referenced.
+
+diff --git a/lisp/loadup.el.old b/lisp/loadup.el
+index 158a4bf..f853a48 100644
+--- a/lisp/loadup.el
++++ b/lisp/loadup.el
+@@ -509,7 +509,8 @@ lost after dumping")))
+                         ((equal dump-mode "dump") "emacs")
+                         ((equal dump-mode "bootstrap") "emacs")
+                         ((equal dump-mode "pbootstrap") "bootstrap-emacs.pdmp")
+-                        (t (error "unrecognized dump mode %s" dump-mode)))))
++                        (t (error "unrecognized dump mode %s" dump-mode))))
++          (exec-path nil))
+       (when (and (featurep 'nativecomp)
+                  (equal dump-mode "pdump"))
+         ;; Don't enable this before bootstrap is completed the as the
-- 
2.29.1


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #4: 0003-gnu-Add-gcceamcs-no-x.patch --]
[-- Type: text/x-patch, Size: 1521 bytes --]

From f23ebabab5e57b22b45fea3a26f9a1814331f39a Mon Sep 17 00:00:00 2001
From: John Soo <jsoo1@asu.edu>
Date: Sat, 21 Nov 2020 00:59:14 -0800
Subject: [PATCH 3/3] gnu: Add gcceamcs-no-x.

* gnu/packages/emacs.scm (gccemacs-no-x): New variable.
---
 gnu/packages/emacs.scm | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/gnu/packages/emacs.scm b/gnu/packages/emacs.scm
index 6312fde3ad..721a13f429 100644
--- a/gnu/packages/emacs.scm
+++ b/gnu/packages/emacs.scm
@@ -487,6 +487,26 @@ editor (from the native compilation branch)")
      ((#:configure-flags flags ''())
       `(cons "--with-nativecomp" ,flags))))))
 
+(define-public gccemacs-no-x
+  (package/inherit emacs-next-no-x
+   (name "gccemacs-no-x")
+   (version gccemacs-version)
+   (source gccemacs-source)
+   (synopsis "The extensible, customizable, self-documenting text
+editor (console only, from the native compilation branch)")
+   (build-system gnu-build-system)
+   (inputs
+    `(("libgccjit" ,(canonical-package libgccjit))
+      ,@(package-inputs emacs-next-no-x)))
+   (arguments
+    (substitute-keyword-arguments (package-arguments emacs-next-no-x)
+      ((#:phases p)
+       `(modify-phases ,p
+          (add-after 'bootstrap 'add-libgccjit-gcc-lib-to-library-path
+            ,add-libgccjit-gcc-lib-to-library-path)))
+      ((#:configure-flags flags ''())
+       `(cons "--with-nativecomp" ,flags))))))
+
 (define-public emacs-no-x-toolkit
   (package/inherit emacs
     (name "emacs-no-x-toolkit")
-- 
2.29.1


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

* [bug#44775] [PATCH] WIP: Add gccemacs
  2020-11-21  9:15 [bug#44775] [PATCH] WIP: Add gccemacs John Soo
@ 2020-11-23 22:22 ` zimoun
  2020-11-24 15:06   ` John Soo
  2020-11-24 15:28   ` John Soo
  2023-05-29 12:06 ` bug#44775: " Jelle Licht
  1 sibling, 2 replies; 10+ messages in thread
From: zimoun @ 2020-11-23 22:22 UTC (permalink / raw)
  To: John Soo, 44775

Hi John,

On Sat, 21 Nov 2020 at 01:15, John Soo <jsoo1@asu.edu> wrote:

> I was curious how fast this gccemacs branch might be, so I got it to
> compile.

Thanks!  This motivates me to resume what had been discussed here [1]:
be able to somehow run:

--8<---------------cut here---------------start------------->8---
 guix build emacs-magit emacs-foo emacs-bar --with-input=emacs=gccemacs
--8<---------------cut here---------------end--------------->8---

At least, have a package transformation that allow to rebuild all the
Emacs packages with the ’gccemacs’ VM instead of the current Emacs 27 one.


> It feels fast but there are bugs and the closure is huge. Also these
> patches do not use any of the parameterization machinery.

What do you mean by “parameterization machinery”?  The new
’with-parameter’ introduced here [2] or the package transformation that
replaces all the dependencies (explicit and implicit).


1: <https://yhetil.org/guix-bugs/868scwtt34.fsf@gmail.com/>
2: <https://yhetil.org/guix-devel/87eeku8trb.fsf@gnu.org>


All the best,
simon




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

* [bug#44775] [PATCH] WIP: Add gccemacs
  2020-11-23 22:22 ` zimoun
@ 2020-11-24 15:06   ` John Soo
  2020-12-18  2:50     ` zimoun
  2020-11-24 15:28   ` John Soo
  1 sibling, 1 reply; 10+ messages in thread
From: John Soo @ 2020-11-24 15:06 UTC (permalink / raw)
  To: zimoun; +Cc: 44775

Hi zimoun,

zimoun <zimon.toutoune@gmail.com> writes:

> Thanks!  This motivates me to resume what had been discussed here [1]:
> be able to somehow run:
>
>  guix build emacs-magit emacs-foo emacs-bar --with-input=emacs=gccemacs
>
> At least, have a package transformation that allow to rebuild all the
> Emacs packages with the ’gccemacs’ VM instead of the current Emacs 27 one.
>
>
>> It feels fast but there are bugs and the closure is huge. Also these
>> patches do not use any of the parameterization machinery.
>
> What do you mean by “parameterization machinery”?  The new
> ’with-parameter’ introduced here [2] or the package transformation that
> replaces all the dependencies (explicit and implicit).
>
>
> 1: <https://yhetil.org/guix-bugs/868scwtt34.fsf@gmail.com/>
> 2: <https://yhetil.org/guix-devel/87eeku8trb.fsf@gnu.org>

I am referring to https://yhetil.org/guix-devel/87eeku8trb.fsf@gnu.org

--with-parameter=gccemacs or similar seem to be required since the
native-comp branch requires a different source, configure flags, and
probably native-search-paths at least.

There appears to be a separate compiled artifact directory under
$out/lib/emacs/$version/native-lisp/$version-triple which has the
compiled native libraries (.eln files). That directory seems to not be
in the search path.  That appears to be causing the first error
I see. I am not sure which env variable would be tweaked to pick those
paths up.

Hope that helps!

John




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

* [bug#44775] [PATCH] WIP: Add gccemacs
  2020-11-23 22:22 ` zimoun
  2020-11-24 15:06   ` John Soo
@ 2020-11-24 15:28   ` John Soo
  2020-11-29  2:14     ` Morgan Smith
  1 sibling, 1 reply; 10+ messages in thread
From: John Soo @ 2020-11-24 15:28 UTC (permalink / raw)
  To: zimoun; +Cc: 44775

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

Hi Guix and zimoun,

I fixed a bug in the build process here.  Still no big progress on the
other bugs.

- John


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-gnu-Add-gccemacs.patch --]
[-- Type: text/x-patch, Size: 6374 bytes --]

From 03ab270db130b9991fcbfa87b9d1fcc009fba059 Mon Sep 17 00:00:00 2001
From: John Soo <jsoo1@asu.edu>
Date: Fri, 20 Nov 2020 22:06:52 -0800
Subject: [PATCH] gnu: Add gccemacs.

---
 gnu/packages/emacs.scm                        | 109 ++++++++++++++++++
 gnu/packages/patches/gccemacs-exec-path.patch |  18 +++
 2 files changed, 127 insertions(+)
 create mode 100644 gnu/packages/patches/gccemacs-exec-path.patch

diff --git a/gnu/packages/emacs.scm b/gnu/packages/emacs.scm
index 7a5dd9010c..98a9aae69b 100644
--- a/gnu/packages/emacs.scm
+++ b/gnu/packages/emacs.scm
@@ -53,6 +53,7 @@
   #:use-module (gnu packages compression)
   #:use-module (gnu packages fontutils)
   #:use-module (gnu packages fribidi)
+  #:use-module (gnu packages gcc)
   #:use-module (gnu packages gd)
   #:use-module (gnu packages gettext)
   #:use-module (gnu packages glib)
@@ -426,6 +427,114 @@ editor (console only)")
            (delete 'strip-double-wrap)))))
     (inputs (package-inputs emacs-no-x))))
 
+;; feature/native-comp
+(define-public gccemacs-commit
+  "6781cd670d1487bbf0364d80de68ca9733342769")
+
+(define-public gccemacs-version
+  (git-version "28.0.50" "0" gccemacs-commit))
+
+(define-public gccemacs-source
+  (origin
+   (method git-fetch)
+   (uri (git-reference
+         (url "git://git.sv.gnu.org/emacs.git")
+         (commit gccemacs-commit)))
+   (sha256
+    (base32
+     "13pmrak5jvk5qp4i5iccn0fqa6by8ig8l0n3qqirm67dxrqiz2ya"))
+   (patches (search-patches "gccemacs-exec-path.patch"
+                            "emacs-fix-scheme-indent-function.patch"
+                            "emacs-ignore-empty-xim-styles.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-sh.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\"")
+         " ")))
+      #t))))
+
+(define add-libgccjit-gcc-lib-to-library-path
+  '(lambda* (#:key inputs #:allow-other-keys)
+     (define (prepend-to-env val var)
+       (let ((current (getenv var)))
+         (setenv
+          var (if (and current (not (string-null? current)))
+                  (string-append val ":" current)
+                  val))))
+     (let* ((libgccjit (assoc-ref inputs "libgccjit"))
+            (gcc-dirs (find-files
+                       libgccjit "^gcc$" #:directories? #t))
+            (gcc-dirs-paths (string-join gcc-dirs ":")))
+       (prepend-to-env gcc-dirs-paths "LIBRARY_PATH")
+       (prepend-to-env gcc-dirs-paths "LD_LIBRARY_PATH")
+       (prepend-to-env gcc-dirs-paths "PATH")
+       #t)))
+
+(define-public gccemacs
+  (package
+   (inherit emacs-next)
+   (name "gccemacs")
+   (version gccemacs-version)
+   (source gccemacs-source)
+   (synopsis "The extensible, customizeable, self-documenting text
+editor (from the native compilation branch)")
+   (inputs
+    `(("libgccjit" ,(canonical-package libgccjit))
+      ,@(package-inputs emacs-next)))
+   (arguments
+    (substitute-keyword-arguments (package-arguments emacs-next)
+     ((#:phases p)
+      `(modify-phases ,p
+         (add-after 'bootstrap 'add-libgccjit-gcc-lib-to-library-path
+           ,add-libgccjit-gcc-lib-to-library-path)))
+     ((#:configure-flags flags ''())
+      `(cons "--with-nativecomp" ,flags))))))
+
+(define-public gccemacs-no-x
+  (package/inherit emacs-next-no-x
+   (name "gccemacs-no-x")
+   (version gccemacs-version)
+   (source gccemacs-source)
+   (synopsis "The extensible, customizable, self-documenting text
+editor (console only, from the native compilation branch)")
+   (build-system gnu-build-system)
+   (inputs
+    `(("libgccjit" ,(canonical-package libgccjit))
+      ,@(package-inputs emacs-next-no-x)))
+   (arguments
+    (substitute-keyword-arguments (package-arguments emacs-next-no-x)
+      ((#:phases p)
+       `(modify-phases ,p
+          (add-after 'bootstrap 'add-libgccjit-gcc-lib-to-library-path
+            ,add-libgccjit-gcc-lib-to-library-path)))
+      ((#:configure-flags flags ''())
+       `(cons "--with-nativecomp" ,flags))))))
 
 (define-public emacs-no-x-toolkit
   (package/inherit emacs
diff --git a/gnu/packages/patches/gccemacs-exec-path.patch b/gnu/packages/patches/gccemacs-exec-path.patch
new file mode 100644
index 0000000000..3c75f9465e
--- /dev/null
+++ b/gnu/packages/patches/gccemacs-exec-path.patch
@@ -0,0 +1,18 @@
+Do not capture the build-time value of $PATH in the 'emacs' executable
+since this can noticeably increase the size of the closure of Emacs
+with things like GCC being referenced.
+
+diff --git a/lisp/loadup.el.old b/lisp/loadup.el
+index 158a4bf..f853a48 100644
+--- a/lisp/loadup.el
++++ b/lisp/loadup.el
+@@ -509,7 +509,8 @@ lost after dumping")))
+                         ((equal dump-mode "dump") "emacs")
+                         ((equal dump-mode "bootstrap") "emacs")
+                         ((equal dump-mode "pbootstrap") "bootstrap-emacs.pdmp")
+-                        (t (error "unrecognized dump mode %s" dump-mode)))))
++                        (t (error "unrecognized dump mode %s" dump-mode))))
++          (exec-path nil))
+       (when (and (featurep 'nativecomp)
+                  (equal dump-mode "pdump"))
+         ;; Don't enable this before bootstrap is completed the as the
-- 
2.29.2


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

* [bug#44775] [PATCH] WIP: Add gccemacs
  2020-11-24 15:28   ` John Soo
@ 2020-11-29  2:14     ` Morgan Smith
  2020-12-11 20:40       ` John Soo
  0 siblings, 1 reply; 10+ messages in thread
From: Morgan Smith @ 2020-11-29  2:14 UTC (permalink / raw)
  To: John Soo; +Cc: 44775, zimoun

Have you seen this gccemacs package? I haven't looked into it myself but
it might help you.

https://github.com/flatwhatson/guix-channel




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

* [bug#44775] [PATCH] WIP: Add gccemacs
  2020-11-29  2:14     ` Morgan Smith
@ 2020-12-11 20:40       ` John Soo
  2020-12-17 17:26         ` Morgan Smith
  0 siblings, 1 reply; 10+ messages in thread
From: John Soo @ 2020-12-11 20:40 UTC (permalink / raw)
  To: Morgan Smith; +Cc: 44775

Hi Morgan,

Thank you! I will take a look. If I end up using some of their code,
should I consult them about it and see if they want a copyright line?
How is that supposed to work?

Thank you again,

John




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

* [bug#44775] [PATCH] WIP: Add gccemacs
  2020-12-11 20:40       ` John Soo
@ 2020-12-17 17:26         ` Morgan Smith
  2020-12-18  0:25           ` Andrew Whatson
  0 siblings, 1 reply; 10+ messages in thread
From: Morgan Smith @ 2020-12-17 17:26 UTC (permalink / raw)
  To: John Soo, whatson; +Cc: 44775

Hi John,

(And hi Andrew. We're discussing including your code into the main Guix
repository. You can view the full conversation here:
https://issues.guix.gnu.org/44775)

The code I linked to is already licensed under GPLv3+ meaning that you
are free to integrate their code into the Guix code-base (Going to put
here that I'm not a lawyer and that this is not legal advice and might
not even be correct). You should indeed put a little copyright line for
Andrew in the code. The exact copyright line you should use seems to be
this (pulled from their git repo):

;;; Copyright © 2020 Andrew Whatson <whatson@gmail.com>

You can do all this without contacting the author, but hopefully Andrew
responds to us with lots of love.

Thanks,

Morgan

On 12/11/20 3:40 PM, John Soo wrote:
> Hi Morgan,
> 
> Thank you! I will take a look. If I end up using some of their code,
> should I consult them about it and see if they want a copyright line?
> How is that supposed to work?
> 
> Thank you again,
> 
> John
> 




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

* [bug#44775] [PATCH] WIP: Add gccemacs
  2020-12-17 17:26         ` Morgan Smith
@ 2020-12-18  0:25           ` Andrew Whatson
  0 siblings, 0 replies; 10+ messages in thread
From: Andrew Whatson @ 2020-12-18  0:25 UTC (permalink / raw)
  To: Morgan Smith; +Cc: 44775, John Soo, Andrea Corallo

Hi everyone,

Yes, I'm very happy for my work to be included in Guix in whatever
form.  I've detailed my work below, and also CC'd Andrea who is
responsible for developing this feature in case he has anything to
add.

1. Enable the `--with-native-comp` configure flag.  Self explanatory!

2. Set the `NATIVE_FULL_AOT=1` make flag, maybe.  This tells the build
process to native-compile *all* of the Elisp that ships with Emacs.
Otherwise only the minimal set of Elisp packages included in the pdump
will be native-compiled, with the rest to be compiled on-demand at
runtime.  This has a significant impact on compilation time, so makes
more sense if the package will be built once and installed many times,
and less sense if everyone is building the package themselves.

3. Extend `LIBRARY_PATH` so libgccjit works at compile time.  This is
necessary for a functioning libgccjit and to pass the "smoke test" in
the configure script.  I think this should probably be exported by the
libgccjit package as a search path instead of requiring all dependents
to handle it manually.

4. Patch the `comp-native-driver-options` in `comp.el`.  This is
necessary to have libgccjit functioning at runtime.  Originally I was
setting LIBRARY_PATH in the emacs wrapper to achieve this, but that
had the undesirable effect of leaking to any process launched from
Emacs.  Setting the necessary paths via the driver options is a much
more targeted solution.

5. Remove the shell-script wrappers from eln files.  The
`glib-or-gtk-build-system` aggressively wraps anything which smells
like an executable, preventing the native-compiled Elisp from being
loaded as shared libraries at runtime.  This is based on the
`restore-emacs-pdmp` phase in the base Emacs package which works
around the same problem.

6. Use a newer `libgccjit` based on `gcc-10`.  This is not strictly
necessary, but if I recall correctly libgccjit-9 suffers from a bug
related to the inlining of constant strings which was fixed in
libgccjit-10, and this has some impact on the performance of
native-compiled Elisp.  The `libgccjit` package in Guix is only
defined for gcc-9, so I created a package factory to define libgccjit
packages based on an arbitrary gcc, and use gcc-10 and libgccjit-10 as
dependencies for the emacs-native-comp package.  I haven't tried to
build using gcc-9 and libgccjit-10, so I'm not sure if there's some
interdependency.  I think it would be best to upstream libgccjit-10
alongside an emacs-native-comp package.

I hope this all makes sense, happy to answer any questions.

Cheers,
Andrew

On Fri, 18 Dec 2020 at 03:26, Morgan Smith <Morgan.J.Smith@outlook.com> wrote:
>
> Hi John,
>
> (And hi Andrew. We're discussing including your code into the main Guix
> repository. You can view the full conversation here:
> https://issues.guix.gnu.org/44775)
>
> The code I linked to is already licensed under GPLv3+ meaning that you
> are free to integrate their code into the Guix code-base (Going to put
> here that I'm not a lawyer and that this is not legal advice and might
> not even be correct). You should indeed put a little copyright line for
> Andrew in the code. The exact copyright line you should use seems to be
> this (pulled from their git repo):
>
> ;;; Copyright © 2020 Andrew Whatson <whatson@gmail.com>
>
> You can do all this without contacting the author, but hopefully Andrew
> responds to us with lots of love.
>
> Thanks,
>
> Morgan
>
> On 12/11/20 3:40 PM, John Soo wrote:
> > Hi Morgan,
> >
> > Thank you! I will take a look. If I end up using some of their code,
> > should I consult them about it and see if they want a copyright line?
> > How is that supposed to work?
> >
> > Thank you again,
> >
> > John
> >




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

* [bug#44775] [PATCH] WIP: Add gccemacs
  2020-11-24 15:06   ` John Soo
@ 2020-12-18  2:50     ` zimoun
  0 siblings, 0 replies; 10+ messages in thread
From: zimoun @ 2020-12-18  2:50 UTC (permalink / raw)
  To: John Soo; +Cc: 44775

Hi John,

On Tue, 24 Nov 2020 at 07:06, John Soo <jsoo1@asu.edu> wrote:

>> Thanks!  This motivates me to resume what had been discussed here [1]:
>> be able to somehow run:
>>
>>  guix build emacs-magit emacs-foo emacs-bar --with-input=emacs=gccemacs
>>
>> At least, have a package transformation that allow to rebuild all the
>> Emacs packages with the ’gccemacs’ VM instead of the current Emacs 27 one.
>>
>>> It feels fast but there are bugs and the closure is huge. Also these
>>> patches do not use any of the parameterization machinery.
>>
>> What do you mean by “parameterization machinery”?  The new
>> ’with-parameter’ introduced here [2] or the package transformation that
>> replaces all the dependencies (explicit and implicit).

> I am referring to https://yhetil.org/guix-devel/87eeku8trb.fsf@gnu.org
>
> --with-parameter=gccemacs or similar seem to be required since the
> native-comp branch requires a different source, configure flags, and
> probably native-search-paths at least.

I am not convinced that the “parameterization machinery” could help here
(aside it is far to be ready :-)) because in this case, “gccemacs” is
not a «parameter» but an «argument» of the Emacs build system.

Maybe I miss something.


> There appears to be a separate compiled artifact directory under
> $out/lib/emacs/$version/native-lisp/$version-triple which has the
> compiled native libraries (.eln files). That directory seems to not be
> in the search path.  That appears to be causing the first error
> I see. I am not sure which env variable would be tweaked to pick those
> paths up.

Thanks for the explanations.

All the best,
simon




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

* bug#44775: [PATCH] WIP: Add gccemacs
  2020-11-21  9:15 [bug#44775] [PATCH] WIP: Add gccemacs John Soo
  2020-11-23 22:22 ` zimoun
@ 2023-05-29 12:06 ` Jelle Licht
  1 sibling, 0 replies; 10+ messages in thread
From: Jelle Licht @ 2023-05-29 12:06 UTC (permalink / raw)
  To: John Soo; +Cc: 44775-done


Most versions of Emacs available on the guix master branch make use of
this work to make everything blazing fast, so thanks. Closing.




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

end of thread, other threads:[~2023-05-29 12:07 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-11-21  9:15 [bug#44775] [PATCH] WIP: Add gccemacs John Soo
2020-11-23 22:22 ` zimoun
2020-11-24 15:06   ` John Soo
2020-12-18  2:50     ` zimoun
2020-11-24 15:28   ` John Soo
2020-11-29  2:14     ` Morgan Smith
2020-12-11 20:40       ` John Soo
2020-12-17 17:26         ` Morgan Smith
2020-12-18  0:25           ` Andrew Whatson
2023-05-29 12:06 ` bug#44775: " Jelle Licht

Code repositories for project(s) associated with this public inbox

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

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