docker-emacs icon indicating copy to clipboard operation
docker-emacs copied to clipboard

Any plans to include native compilation

Open maurelio1234 opened this issue 3 years ago • 16 comments

It was merged to dev-master this weekend.

maurelio1234 avatar Apr 28 '21 07:04 maurelio1234

master should be up to date. master-alpine is not as it is currently broken.

Reopen if you experience something different.

Silex avatar May 05 '21 15:05 Silex

Hi,

normally to get native compilation on the master of emacs you need to configure it --with-native-compilation.

I hacked something that works for me here but maybe I'm completely wrong and it is already supported.

Just pulled silex/emacs:master-dev and when I eval (native-comp-available-p)I get t on a container running an image built from my fork, and I get nil when running the image I just pulled from your docker hub.

maurelio1234 avatar May 06 '21 05:05 maurelio1234

Oh, I totally missunderstood what you meant.

In theory, yes I'm not opposed to that, in practice given my goal is to implement my images using @purcell nix packages I guess we'd bring him here.

@purcell: what's your take on adding build flags like --with-modules or --with-native-compilation?

Silex avatar May 08 '21 21:05 Silex

I'll probably enable native compilation on my HEAD builds in due course. I think modules are enabled by default?

purcell avatar May 09 '21 00:05 purcell

I'm a little bit curious about what the perceived benefits would be of enabling native compilation by default in an emacs used for CI testing. From my perspective it complicates the build somewhat, would not yield much speed difference overall when testing across serveral emacsen, and if the behaviour of tested code is different between native/non-native compiled code, then that's an Emacs bug, not a bug in the tested code.

purcell avatar May 10 '21 03:05 purcell

I'm a little bit curious about what the perceived benefits would be of enabling native compilation by default in an emacs used for CI testing.

Probably not much. I use the docker image to run the emacs I use to work and it only became usable in terms of speed after caching the pre-compiled files (eln-cache) folder between runs.

if the behaviour of tested code is different between native/non-native compiled code, then that's an Emacs bug, not a bug in the tested code.

isn't that expected when testing against the master-dev instead of a stable release?

maurelio1234 avatar May 10 '21 07:05 maurelio1234

I use the docker image to run the emacs I use to work and it only became usable in terms of speed after caching the pre-compiled files (eln-cache) folder between runs.

Ah, I can see why that would be useful. You might also want window system support then, no?

isn't that expected when testing against the master-dev instead of a stable release?

Oh, I mean if you've got two dev snapshot builds of Emacs - with and without nativecomp - then if they differ in behaviour with any given third-party code, it's an Emacs bug.

purcell avatar May 10 '21 07:05 purcell

Ah, I can see why that would be useful. You might also want window system support then, no?

Do you mean something like X11? it works already.

maurelio1234 avatar May 10 '21 08:05 maurelio1234

@maurelio1234: do you use X support in my images? how bad would it be if it wasn't present anymore?

Silex avatar May 31 '21 08:05 Silex

Hi @Silex I wouldn't be able to use them, just like most emacs docker images out there.

But I can keep using my fork anyway, I know my use case (emacs on a docker image for humans :smile: ) is not very common.

maurelio1234 avatar Jun 01 '21 06:06 maurelio1234

@maurelio1234: thanks for the feedback.

At the beginning of docker I wanted to dockerize my whole dev environment, that's how this project started. But then realistically it's too much work so I gave up and actually never use my images except for testing.

So I don't really need X anymore, and purcell does not support it at the moment. The simple thing to do is to simply drop X support for now and then reintroduce it once https://github.com/purcell/nix-emacs-ci/issues/19 moves forward.

Silex avatar Jun 04 '21 12:06 Silex

FWIW I use the X support, and I use the Docker images for personal use primarily and sometimes for testing. So the native compilation would be nice for all my Emacs usage, but losing X would hurt.

tzz avatar Jun 07 '21 11:06 tzz

@tzz: I managed to keep X support, but it's probably a bit more limited than before please report (e.g no GTK).

Silex avatar Jun 07 '21 19:06 Silex

@maurelio1234: I should be able to start experimenting with adding --with-native-compilation. It's only available on master right?

Silex avatar Jun 23 '21 12:06 Silex

Yes, AFAIK it's only on master right now (no releases, no widely used working branches)

maurelio1234 avatar Jun 23 '21 12:06 maurelio1234

@maurelio1234:

checking for gcc_jit_context_acquire in -lgccjit... yes
checking for libgccjit.h... yes
configure: error: Installed libgccjit has failed passing the smoke test.
You can verify it yourself compiling:
<https://gcc.gnu.org/onlinedocs/jit/intro/tutorial01.html>.
Please report the issue to your distribution if libgccjit was installed through
that.
Here instructions on how to compile and install libgccjit from source:
<https://gcc.gnu.org/wiki/JIT>.

When trying to build master. I don't have time to debug this. If you want to have a go, try to build this:

FROM silex/nix
RUN nix-env -iA emacs-snapshot -f https://github.com/silex/nix-emacs-ci/archive/native-compilation.tar.gz

Silex avatar Jun 23 '21 20:06 Silex

Closing due to inactivity, if you want to see it happening check with nix-emacs-ci.

Silex avatar May 25 '23 11:05 Silex