unofficial mirror of help-guix@gnu.org 
 help / color / mirror / Atom feed
* emacs-guix invalid byte opcode: op=183 ptr=25
@ 2019-02-28 10:28 Yoshinori Arai
  2019-02-28 10:37 ` Pierre Neidhardt
  0 siblings, 1 reply; 7+ messages in thread
From: Yoshinori Arai @ 2019-02-28 10:28 UTC (permalink / raw)
  To: help-guix


Hello,

I have installed binary guix and emacs-guix by using guix to Debian 9
again. I have found the issue as subject on emacs25.1 from debian package.

I think this is cause of emacs packages of guix compiled by emacs26.1
because there is no error after install emacs26.1 by using guix.

If guix will be installed from git on foreign distro, this error will
not happen. Because guix package is compiled by existing emacs.

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

* Re: emacs-guix invalid byte opcode: op=183 ptr=25
  2019-02-28 10:28 emacs-guix invalid byte opcode: op=183 ptr=25 Yoshinori Arai
@ 2019-02-28 10:37 ` Pierre Neidhardt
  2019-02-28 12:26   ` zimoun
  0 siblings, 1 reply; 7+ messages in thread
From: Pierre Neidhardt @ 2019-02-28 10:37 UTC (permalink / raw)
  To: Yoshinori Arai; +Cc: help-guix

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

Hi,

indeed, byte-compiled Emacs files (.elc) are not compatible across different
versions of Emacs.

Unless you've got a very good reason for it, I suggest removing all
emacs25-related packages and sticking to Emacs 26.

Otherwise, you can configure your Emacs init file to change the load-path
depending on the version.  Let me know if you need help with that.

Cheers!

-- 
Pierre Neidhardt
https://ambrevar.xyz/

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]

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

* Re: emacs-guix invalid byte opcode: op=183 ptr=25
  2019-02-28 10:37 ` Pierre Neidhardt
@ 2019-02-28 12:26   ` zimoun
  2019-02-28 13:28     ` Pierre Neidhardt
                       ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: zimoun @ 2019-02-28 12:26 UTC (permalink / raw)
  To: Pierre Neidhardt; +Cc: help-guix

Hi,

I am confused and I have a really naive question. :-)

When `guix package -i emacs-stuff', well the `emacs-stuff` is built or
if it is available on a substitute then the package is pulled from
there.
So,
     a- does it pull the ".el" files and then byte-compile them locally?
Or b- does it pull the ".elc" byte-compiled on the substitute?

And in case of a-, which Emacs does it use? The first one in $PATH
(don't think so!) or the one which is the companion of
emacs-build-system?

Therefore, if one runs Emacs version 24 (the one coming with `apt-get
install emacs` on Debian 9) and `guix package -i emacs-stuff`, then it
leads to incompatibilities. Right?
It is "expected" and cannot be fixed otherwise we break the
reproducibilty, I guess. Right?


@Yoshinori Arai:
<<If guix will be installed from git on foreign distro, this error will
not happen. Because guix package is compiled by existing emacs.>>

Hum? I do not think so.

My "advice" about Emacs and its packages on foreign distro is:
 - install Emacs from Guix (guix package -i emacs) because the version
is more up to date (than Debian for example)
 - adapt the PATH or add `source ~/.guix-profile/etc/profile` to
enable the correct Emacs (from Guix)
 - choose only one way to install emacs packages: from ELPA/MELPA *or*
from Guix *and* it is not recommanded to mix the both.

Last about the package emacs-guix, there is still corner cases on
foreign distro; see [1] and [2].

[1] https://github.com/alezost/guix.el/issues/29
[2] https://github.com/alezost/guix.el#important-note-for-non-guixsd-users


Hope that helps.

All the best
--
simon

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

* Re: emacs-guix invalid byte opcode: op=183 ptr=25
  2019-02-28 12:26   ` zimoun
@ 2019-02-28 13:28     ` Pierre Neidhardt
  2019-02-28 14:47     ` emacs byte-compiled packages incompatibilities (was Re: emacs-guix invalid byte opcode: op=183 ptr=25) Giovanni Biscuolo
  2019-02-28 19:03     ` emacs-guix invalid byte opcode: op=183 ptr=25 Ricardo Wurmus
  2 siblings, 0 replies; 7+ messages in thread
From: Pierre Neidhardt @ 2019-02-28 13:28 UTC (permalink / raw)
  To: zimoun; +Cc: help-guix

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

Zimoun, you are correct, Guix Emacs packages will only work with the Emacs that
is used in the build system, which corresponds to the `emacs` package.

With Guix, Emacs packages don't have Emacs as an input, so it's perfectly possible to
install Emacs packages along the wrong version of Emacs.  I think this is a problem.

The problem is not specific to Emacs though,  anything that is byte-compiled has
the same shortcoming.  Some build systems have a variable for the compiler, so
it's easy to change it and recompile all packages for a new compiler.  The
emacs-build-system does not do that though, see emacs-build-system.scm:

--8<---------------cut here---------------start------------->8---
(define* (build #:key outputs inputs #:allow-other-keys)
  "Compile .el files."
  (let* ((emacs (string-append (assoc-ref inputs "emacs") "/bin/emacs"))
         (out (assoc-ref outputs "out"))
         (elpa-name-ver (store-directory->elpa-name-version out))
         (el-dir (string-append out %install-suffix "/" elpa-name-ver)))
    (setenv "SHELL" "sh")
    (parameterize ((%emacs emacs))
      (emacs-byte-compile-directory el-dir))))
--8<---------------cut here---------------end--------------->8---

Thoughts?

-- 
Pierre Neidhardt
https://ambrevar.xyz/

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]

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

* emacs byte-compiled packages incompatibilities (was Re: emacs-guix invalid byte opcode: op=183 ptr=25)
  2019-02-28 12:26   ` zimoun
  2019-02-28 13:28     ` Pierre Neidhardt
@ 2019-02-28 14:47     ` Giovanni Biscuolo
  2019-02-28 15:11       ` Pierre Neidhardt
  2019-02-28 19:03     ` emacs-guix invalid byte opcode: op=183 ptr=25 Ricardo Wurmus
  2 siblings, 1 reply; 7+ messages in thread
From: Giovanni Biscuolo @ 2019-02-28 14:47 UTC (permalink / raw)
  To: zimoun; +Cc: help-guix

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

Hi ziomun,

I'm planning to migrate from my "foreign distro managed" emacs (Debian)
to a "guix managed one" (on Debian), so I'm very interested in this
thread and related hints and solutions

since I wanted a declarative approach to package management, I'm using
"use-package" [1] to install and configure emacs packages; simple
example for my magit installation:

--8<---------------cut here---------------start------------->8---
(use-package magit
   :ensure t
   :pin "MELPA_Stable"
   :bind ("C-x g" . magit-status))
--8<---------------cut here---------------end--------------->8---

(MEPLA_Stable repository is defined in my init.el)

in a near future I'd like to let guix manage _all_ my emacs packages, so
I'm planning to remove all the ":ensure t" declarations (and pin): this
way my "guix installed emacs" will never try to install a package via
MELPA_Stable when loading my init.el (am I wrong?)

there could be a better option: use a conditional [2] so that ":ensure"
and ":pin" are evaluated _only_ when "not in guix"; this way I could
continue using my "stable emacs environment" without worklow
interruptions (in this case I should also find a way to completely
ignore ~/.emacs.d/elpa installed packages: how?) until I manage to
complete my "guix emacs environment"

I'd even be able to use my dotfolder on all my other machines, even
those still not "emacs-migrated" to guix: this is a plud I'd really
appreciate

John Wiegley gives us an example [3] of conditional loading that will
stop :ensure (AFAIU the whole use-package) evaluation from happening on
Mac systems:

--8<---------------cut here---------------start------------->8---
(when (memq window-system '(mac ns))
  (use-package exec-path-from-shell
    :ensure t
    :config
    (exec-path-from-shell-initialize)))
--8<---------------cut here---------------end--------------->8---

I've still not experimented moving the conditional _only_ around
:ensure, like this

--8<---------------cut here---------------start------------->8---
(use-package exec-path-from-shell
  (when (memq window-system '(mac ns))
    :ensure t
    :pin "MELPA_Stable")
  :config
  (exec-path-from-shell-initialize))
--8<---------------cut here---------------end--------------->8---

so don't know if the conditional can be *just* for :ensure (and :pin)

anyway, first and foremost: is there a way to check if I'm running a
"guix emacs" or the foreign distro one?
(memq packaging-system '(gnu guix)) ? :-)

any hint wellcome since this could potentially save me a lot of downtime
with emacs (I almost digitally live in emacs and a little bit of
browser)

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

[...]

> Therefore, if one runs Emacs version 24 (the one coming with `apt-get
> install emacs` on Debian 9) and `guix package -i emacs-stuff`, then it
> leads to incompatibilities. Right?

AFAIU incompatibilies will arise only if you try to load the "Debian
emacs" compiled packages in the guix installed emacs; vice versa does
not apply since guix emacs packages are well isolated in the /gnu/store
and "debian emacs" doen even know they exists (unless you explicitly add
a load path in your init.el)

as I sayd above, I still don't know how to skip loading packages from
~/.emacs.d/elpa when in "guix emacs"

[...]

> My "advice" about Emacs and its packages on foreign distro is:
>  - install Emacs from Guix (guix package -i emacs) because the version
> is more up to date (than Debian for example)
>  - adapt the PATH or add `source ~/.guix-profile/etc/profile` to
> enable the correct Emacs (from Guix)
>  - choose only one way to install emacs packages: from ELPA/MELPA *or*
> from Guix *and* it is not recommanded to mix the both.

when using the "native" one, emacs could be started using a different
user-emacs-directory: this way emacs installed packages (from
ELPA/MELPA or manually) will be available only in that environment

but this solution is not good for me, since I should maintain two
different config trees: one for each emacs... no no no :-O

comments wellcome!

[...]

Thanks
Giovanni


[1] https://jwiegley.github.io/use-package/

[2] https://jwiegley.github.io/use-package/keywords/#if-when-unless

[3] https://github.com/jwiegley/use-package#conditional-loading

-- 
Giovanni Biscuolo

Xelera IT Infrastructures

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

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

* Re: emacs byte-compiled packages incompatibilities (was Re: emacs-guix invalid byte opcode: op=183 ptr=25)
  2019-02-28 14:47     ` emacs byte-compiled packages incompatibilities (was Re: emacs-guix invalid byte opcode: op=183 ptr=25) Giovanni Biscuolo
@ 2019-02-28 15:11       ` Pierre Neidhardt
  0 siblings, 0 replies; 7+ messages in thread
From: Pierre Neidhardt @ 2019-02-28 15:11 UTC (permalink / raw)
  To: Giovanni Biscuolo; +Cc: help-guix

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


> as I sayd above, I still don't know how to skip loading packages from
> ~/.emacs.d/elpa when in "guix emacs"

To test if Emacs is from Guix, you can

--8<---------------cut here---------------start------------->8---
  (if (require 'guix-emacs nil 'noerror)
	    ; Code for Guix Emacs
		; Code for non-Guix Emacs
		)
--8<---------------cut here---------------end--------------->8---

In particular, you can set `package-user-dir' and call (package-initialize) for
non-Guix Emacs.

> when using the "native" one, emacs could be started using a different
> user-emacs-directory: this way emacs installed packages (from
> ELPA/MELPA or manually) will be available only in that environment
> 
> but this solution is not good for me, since I should maintain two
> different config trees: one for each emacs... no no no :-O

Indeed, just set different `package-user-dir' and keep the same config :)

-- 
Pierre Neidhardt
https://ambrevar.xyz/

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]

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

* Re: emacs-guix invalid byte opcode: op=183 ptr=25
  2019-02-28 12:26   ` zimoun
  2019-02-28 13:28     ` Pierre Neidhardt
  2019-02-28 14:47     ` emacs byte-compiled packages incompatibilities (was Re: emacs-guix invalid byte opcode: op=183 ptr=25) Giovanni Biscuolo
@ 2019-02-28 19:03     ` Ricardo Wurmus
  2 siblings, 0 replies; 7+ messages in thread
From: Ricardo Wurmus @ 2019-02-28 19:03 UTC (permalink / raw)
  To: zimoun; +Cc: help-guix


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

> I am confused and I have a really naive question. :-)
>
> When `guix package -i emacs-stuff', well the `emacs-stuff` is built or
> if it is available on a substitute then the package is pulled from
> there.
> So,
>      a- does it pull the ".el" files and then byte-compile them locally?
> Or b- does it pull the ".elc" byte-compiled on the substitute?

The files are byte-compiled as part of the build process, so the elc
files are part of the substitute.

-- 
Ricardo

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

end of thread, other threads:[~2019-02-28 19:04 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-02-28 10:28 emacs-guix invalid byte opcode: op=183 ptr=25 Yoshinori Arai
2019-02-28 10:37 ` Pierre Neidhardt
2019-02-28 12:26   ` zimoun
2019-02-28 13:28     ` Pierre Neidhardt
2019-02-28 14:47     ` emacs byte-compiled packages incompatibilities (was Re: emacs-guix invalid byte opcode: op=183 ptr=25) Giovanni Biscuolo
2019-02-28 15:11       ` Pierre Neidhardt
2019-02-28 19:03     ` emacs-guix invalid byte opcode: op=183 ptr=25 Ricardo Wurmus

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).