all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: "Nicolas Bértolo" <nicolasbertolo@gmail.com>
Cc: emacs-devel@gnu.org, akrl@sdf.org
Subject: Re: [PATCH] [WIP] Port feature/native-comp to Windows.
Date: Mon, 11 May 2020 19:19:01 +0300	[thread overview]
Message-ID: <83eerqbg22.fsf@gnu.org> (raw)
In-Reply-To: <CAFnS-O=2jnBsej62DDjho4L9voAYgKB27v03cy=oS8FbSYiF+A@mail.gmail.com> (message from Nicolas Bértolo on Mon, 11 May 2020 12:20:36 -0300)

> From: Nicolas Bértolo <nicolasbertolo@gmail.com>
> Date: Mon, 11 May 2020 12:20:36 -0300
> Cc: Andrea Corallo <akrl@sdf.org>, emacs-devel@gnu.org
> 
> > I don't think it would be wise for us to distribute libgccjit, because
> > then we'd need to distribute the GCC sources, and the user will be
> > unable to reliably use the shipped libgccjit with their local GCC
> > installation (due to possible version mismatch).
> 
> IMHO that is really inconvenient from the point of view of a user that just
> wants to install Emacs and use all its features.

Not "all" of its features, just one.

And yes, this is an inconvenience, but it isn't specific to
MS-Windows.  AFAIK, Posix systems nowadays come without a compiler
preinstalled, and you need to install it if you want that.

This is a price to pay for compiling to native code using an external
compiler.  there's no way around this, I think.  People who cannot
afford installing a working compiler and Binutils will have to give up
compiling Lisp files to native code (the Lisp files that come with
Emacs can still be provided as *.eln, I would hope).

> Installing Mingw is not a simple process (at least in my experience). And adding
> it to PATH will also add many other unrelated utilities. This pollutes the PATH
> variable and may cause trouble. I haven't done in my machine because I fear it
> may interact with badly with the rest of the system.

I do have GCC and Binutils on PATH, and I have yet to see any problem.
But of course, someone else might feel uncomfortable with that.

> I can think of two ways:
> 
> - The whole system will have the mingw libraries available in the LoadLibrary()
> search path.

Why is that a problem?  The number of DLLs is quite small and their
names don't conflict with Windows system DLLs.

> - The mingw distribution comes with many utilities that the user may not want in
>   PATH.

I don't think I understand what utilities you have in mind.  Please
name them.

> I haven't explicitly installed any of these, but they are in the same
>   folder as `gcc`: ImageMagick, Python, sqlite, TCL.

I don't know why you have them or which package they came with, but
they are definitely not needed for running the compiler to produce
programs.

> Overall I don't think it is a good idea to make the user install a whole Mingw
> distribution when they only need 10 files.

I really don't see any way around this, sorry.

> I can think of a middle-ground solution. Let's have a `comp-gcc-path` variable
> that is prepended to PATH in `process-environment` when launching the
> compilation subprocess. This will variable should point to the path
> where `gcc` lives.
> In my system it would be "C:/msys64/mingw64/bin".
> 
> This would set up the environment libgccjit expects (no "-B" flag necessary),
> but it would not require adding that directory to PATH. It separates what is
> necessary for Emacs to work, from the environment the user setup to work.

This only solves the problem of having the stuff on PATH, it doesn't
solve the problem of installing it.  And it creates a new problem: the
DLLs will not be in a place where the system looks for them, so we
will need some extra code in the *.eln loader to find them.

> As an example: imagine the user prepends a "C:/myproject/custom-gcc/bin" to PATH
> and then starts Emacs because they need a customized GCC to work on a certain
> project. Let's say they need a custom libgccjit for that project too. Emacs
> would load that version because it is first in PATH, and then what may happen is
> unpredictable. It may have different function signatures and when Emacs calls
> them through dlsym() we would get a hard-to-find crash.

This can happen even without this.  Users who have more than one
compiler installation need to be very careful and need to know what
they are doing.

> > Right, I think at least on MS-Windows we need to do that.  On Posix
> > platforms, Emacs will be able to start if there's no libgccjit (and
> > will crash if it attempts to call any of its functions), so it might
> > be a good idea to use dlopen/dlsym there as well.  But on Windows it
> > is IMO critical.
> 
> I will do this.

Thanks.



  reply	other threads:[~2020-05-11 16:19 UTC|newest]

Thread overview: 71+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-08 19:55 [PATCH] [WIP] Port feature/native-comp to Windows Nicolas Bertolo
2020-05-08 22:00 ` Andrea Corallo
2020-05-08 22:11   ` Nicolas Bértolo
2020-05-08 22:22     ` Andrea Corallo
2020-05-08 22:23       ` Nicolas Bértolo
2020-05-08 22:27         ` Andrea Corallo
2020-05-08 23:18           ` Stefan Monnier
2020-05-09  6:07 ` Eli Zaretskii
2020-05-09 15:28   ` Nicolas Bértolo
2020-05-09 15:48     ` Eli Zaretskii
2020-05-09 17:09       ` Andrea Corallo
2020-05-10 16:36       ` Nicolas Bértolo
2020-05-10 17:08         ` Eli Zaretskii
2020-05-10 17:50           ` Nicolas Bértolo
2020-05-10 18:22             ` Eli Zaretskii
2020-05-10 19:02               ` Nicolas Bértolo
2020-05-10 19:16                 ` Eli Zaretskii
2020-05-10 19:41                   ` Nicolas Bértolo
2020-05-10 19:50                     ` Andrea Corallo
2020-05-10 19:55                       ` Nicolas Bértolo
2020-05-10 20:01                         ` Andrea Corallo
2020-05-11 14:19                         ` Eli Zaretskii
2020-05-11 14:17                     ` Eli Zaretskii
2020-05-11 15:20                       ` Nicolas Bértolo
2020-05-11 16:19                         ` Eli Zaretskii [this message]
2020-05-11 16:43                           ` Andrea Corallo
2020-05-11 16:44                           ` Nicolas Bértolo
2020-05-11 17:05                             ` Eli Zaretskii
2020-05-11 18:19                           ` Fabrice Popineau
2020-05-11 18:37                             ` Andrea Corallo
2020-05-11 18:48                             ` Eli Zaretskii
2020-05-11 19:27                               ` Stefan Monnier
2020-05-11 19:42                               ` Fabrice Popineau
2020-05-12  2:46                       ` Nicolas Bértolo
2020-05-12 16:56                         ` Eli Zaretskii
2020-05-12 17:25                           ` Nicolas Bértolo
2020-05-12 18:21                             ` Andrea Corallo
2020-05-12 20:33                               ` Andrea Corallo
2020-05-13 14:09                                 ` Nicolas Bértolo
2020-05-13 14:31                                   ` Andrea Corallo
2020-05-13 15:00                                     ` Nicolas Bértolo
2020-05-13 15:17                                       ` Andrea Corallo
2020-05-13 15:48                                   ` Eli Zaretskii
2020-05-13  3:59                         ` Richard Stallman
2020-05-13 14:02                           ` Nicolas Bértolo
2020-05-13 15:23                             ` Eli Zaretskii
2020-05-13 14:52                           ` Eli Zaretskii
2020-05-10 19:47                   ` Andrea Corallo
2020-05-10 19:39                 ` Andrea Corallo
2020-05-10 17:13         ` Andrea Corallo
2020-05-10 17:15           ` Eli Zaretskii
2020-05-10 18:14             ` Andrea Corallo
2020-05-10 18:30               ` Eli Zaretskii
2020-05-10 18:54                 ` Andrea Corallo
2020-05-10 19:02                   ` Eli Zaretskii
2020-05-10 19:07                     ` Nicolas Bértolo
2020-05-10 19:14                     ` Andrea Corallo
2020-05-10 19:24                     ` Andrea Corallo
2020-05-10 19:30                       ` Eli Zaretskii
2020-05-10 18:05           ` Nicolas Bértolo
2020-05-10 18:23             ` Andrea Corallo
2020-05-10 17:20       ` Andrea Corallo
2020-05-09 13:42 ` Andrea Corallo
2020-05-09 15:40   ` Nicolas Bértolo
2020-05-09 15:55     ` Eli Zaretskii
2020-05-09 16:07       ` Nicolas Bértolo
2020-05-09 16:15         ` Eli Zaretskii
2020-05-09 16:27     ` Andrea Corallo
2020-05-09 16:33       ` Eli Zaretskii
2020-05-09 16:46         ` Andrea Corallo
2020-05-09 16:52     ` Andrea Corallo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

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

  git send-email \
    --in-reply-to=83eerqbg22.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=akrl@sdf.org \
    --cc=emacs-devel@gnu.org \
    --cc=nicolasbertolo@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

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