unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Corwin Brust <corwin@bru.st>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 58318@debbugs.gnu.org, Bartosz Bubak <bartosz.bubak@gmail.com>
Subject: bug#58318: 28.2; Emacs installed from package won't work with MinGW
Date: Thu, 6 Oct 2022 08:09:16 -0500	[thread overview]
Message-ID: <CAJf-WoRbE4BknoYRv-0fxmF8N7DQzZuEV869bXNRjc374anp3w@mail.gmail.com> (raw)
In-Reply-To: <835ygxsdyu.fsf@gnu.org>

On Thu, Oct 6, 2022 at 12:44 AM Eli Zaretskii <eliz@gnu.org> wrote:
>
> > From: Bartosz Bubak <bartosz.bubak@gmail.com>
> > Date: Wed, 5 Oct 2022 18:01:00 +0200
> >
> > When installing Emacs using the installer (emacs-28.2-installer.exe),
> > by default it adds the compiler and libraries (gcc and libgccjit)
> > to the ./bin directory without prompting the user for his opinion.

I'm confused.  With one exception, I do not think that we provide GCC
with Emacs binaries for windows.

We *do* provide libgcc_s_seh-1.dll but we do not provide, e.g.
gcc.exe, as.exe, etc.

> >
> > The problem appears when another compiler is already installed in the
> > system, eg. from MinGW. Emacs then tries to use the libraries from PATH
> > instead of those installed in its subdirectories:
> >
> > Warning (comp): c: /tools/emacs/share/emacs/28.2/lisp/org/org-entities.el:
> > Error: Internal native compiler error failed to compile
> > Warning (comp): C: \\ ProgramData \\ chocolatey \\ lib \\ mingw \\ tools \\
> > install \\ mingw64 \\ bin \\ libgccjit-0.dll: error: error invoking gcc
> > driver

It does make sense to me that having two different versions of GCC
both findable on the Windows path could be problematic (although I
don't see how the Emacs installer could be responsible for installing
any of them).


> >
> > When I tried to find a solution to the problem, I found something like
> > this:
> >
> > M-: (executable-find "gcc") RET
> > "c:/ProgramData/chocolatey/bin/gcc.exe
> > M-: (executable-find "as") RET
> > "c:/ProgramData/chocolatey/bin/as.exe"
> > etc, etc
> >
> > But  should be:
> > C:\Program Files\Emacs\emacs-28.2\bin\gcc.exe
> > C:\Program Files\Emacs\emacs-28.2\bin\as.exe

That's very odd -- looking at the "install" folder created when I
built and packaged the emacs-28 binaries I can't find either of those
files:

  corwi@Avalon MINGW64 /d/emacs-build/install/emacs-28.2
  $ (cd /d/emacs-build/install/emacs-28.2; ls -Rl | grep 'as.exe')

  corwi@Avalon MINGW64 /d/emacs-build/install/emacs-28.2
  $ (cd /d/emacs-build/install/emacs-28.2; ls -Rl | grep 'gcc')
  -rwxr-xr-x 1 corwi corwi   84147 Feb 20  2022 libgcc_s_seh-1.dll
  -rw-r--r-- 1 corwi corwi  10282 Sep  6 16:31 gcc.el
  -rw-r--r-- 1 corwi corwi   4680 Sep  6 18:05 gcc.elc

> >
> > The only solution I have found so far is to uninstall the "global"
> > MinGW, then emacs uses the embedded libraries and everything is fine.
> >
> > In GNU Emacs 28.2 (build 2, x86_64-w64-mingw32)
> >  of 2022-09-13 built on AVALON
> > Windowing system distributor 'Microsoft Corp.', version 10.0.22000
> > System Description: Microsoft Windows 10 Pro (v10.0.2009.22000.978)
> >
> > Configured using:
> >  'configure --with-modules --without-dbus --with-native-compilation
> >  --without-compress-install CFLAGS=-O2'
> >
> > Configured features:
> > ACL GIF GMP GNUTLS HARFBUZZ JPEG JSON LCMS2 LIBXML2 MODULES NATIVE_COMP
> > NOTIFY W32NOTIFY PDUMPER PNG RSVG SOUND THREADS TIFF TOOLKIT_SCROLL_BARS
> > XPM ZLIB
> >
> > (NATIVE_COMP present but libgccjit not available)

It looks from this that Emacs doesn't find (a complete) GCC kit for
use with GCC, so your Emacs should be loading ELN files shipped with
the release but not trying to compile any new ones, I think?

Unfortunately, that just makes the "Error: Internal native compiler
error failed to compile" even more of a mystery:

Eli,
If, per the configuration reported when generating this bug report,
Emacs can see libgccjit is not available, then should Emacs still be
trying to native compile org-entitles in this case?

> >
> > Important settings:
> >   value of $LANG: PLK
> >   locale-coding-system: cp1250
>
> Corwin, are you reading this?

Yes, I am now.  Thank you.

>
> I admit I don't have a clear idea of why the problem happens.  Is the
> libgccjit and/or GCC and/or Binutils distributed by chocolatey somehow
> incompatible with the ones you include in the installer?  Because if
> they are compatible, just removing the GCC/Binutils stuff bundled with
> the Emacs installer should have solved the issue (and then providing
> an option in the installer not to install the bundled GCC would be a
> way towards solving this).  And yet the OP seems to say (AFAIU) that
> this didn't help, and only uninstalling the chocolatey GCC/Binutils
> did.  We cannot possibly ask users to uninstall their existing
> development environment when installing Emacs.

I'm not aware of any incompatibilities but I'm not a chocolatey user.
I'll need to do some experimentation.

I'd be happy to add/adjust installer options.  Would we (probably most
simply?) add an option where we can "uncheck" installing all of the
deps?  If not, what else would the new option suppress installing
(beside libgcc_s_seh-1.dll)?

>
> I think someone should try installing the chocolatey distribution and
> see whether the binaries from the GNU FTP site can work with its
> libgccjit.  Because I'm not sure I understand what happens in this
> case, even though I asked several times.  If indeed there's
> incompatibility, I'd be interested to know why (I have no idea how
> chocolatey builds its GCC).  If that is not solvable, we should
> probably say that people with chocolatey installation should not
> install Emacs binaries with native-compilation enabled.

I'll get the machine I'm using to test release binaries going on this
today after work and report back with any success I have
reproducing/researching. Others' findings would be most welcome if
anyone else is experimenting with this too.





  reply	other threads:[~2022-10-06 13:09 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-05 16:01 bug#58318: 28.2; Emacs installed from package won't work with MinGW Bartosz Bubak
2022-10-06  5:44 ` Eli Zaretskii
2022-10-06 13:09   ` Corwin Brust [this message]
2022-10-06 13:30     ` Lars Ingebrigtsen
2022-10-06 14:43       ` Eli Zaretskii
2022-10-07 11:42         ` Lars Ingebrigtsen
2022-10-07 11:59           ` Eli Zaretskii
2022-10-07 12:04             ` Lars Ingebrigtsen
2022-10-07 12:12               ` Eli Zaretskii
2022-10-07 12:28                 ` Lars Ingebrigtsen
2022-10-07 12:35                 ` Andrea Corallo
2022-10-07 12:43                   ` Lars Ingebrigtsen
2022-10-07 12:54                   ` Eli Zaretskii
2022-10-07 13:02                     ` Lars Ingebrigtsen
2022-10-07 13:44                       ` Eli Zaretskii
2022-10-07 13:47                         ` Lars Ingebrigtsen
2022-10-07 13:04                     ` Andrea Corallo
2022-10-07 13:48                       ` Eli Zaretskii
2022-10-07 13:54                         ` Andrea Corallo
2022-10-07 14:03                           ` Eli Zaretskii
2022-10-07 14:35                             ` Andrea Corallo
2022-10-07 15:27                               ` Eli Zaretskii
2022-10-07 15:34                                 ` Corwin Brust
2022-10-07 15:43                                   ` Eli Zaretskii
2022-10-07 15:47                                     ` Corwin Brust
2022-10-07 19:11                                       ` Eli Zaretskii
2022-10-07 17:15                                     ` Andrea Corallo
2022-10-07 19:15                                       ` Eli Zaretskii
2022-10-07 15:49                                 ` Andrea Corallo
2022-10-07 15:52                               ` Corwin Brust
2022-10-07 19:14                                 ` Eli Zaretskii
2022-10-08 12:56                                   ` Lars Ingebrigtsen
2022-10-08 13:03                                     ` Eli Zaretskii
2022-10-08 13:10                                       ` Lars Ingebrigtsen
2022-10-08 14:28                                         ` Eli Zaretskii
2022-10-08 13:28                                   ` Andrea Corallo
2022-10-11 19:23                                     ` Andrea Corallo
2022-10-11 19:29                                       ` Eli Zaretskii
2022-10-11 20:45                                         ` Andrea Corallo
2022-10-12  5:21                                           ` Eli Zaretskii
2022-10-12  8:14                                             ` Andrea Corallo
2022-10-12 12:50                                               ` Eli Zaretskii
2022-10-12 14:55                                                 ` Andrea Corallo
2022-10-12 15:35                                                   ` Eli Zaretskii
2022-10-13 13:26                                                     ` Andrea Corallo
2022-10-06 14:41     ` Eli Zaretskii

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=CAJf-WoRbE4BknoYRv-0fxmF8N7DQzZuEV869bXNRjc374anp3w@mail.gmail.com \
    --to=corwin@bru.st \
    --cc=58318@debbugs.gnu.org \
    --cc=bartosz.bubak@gmail.com \
    --cc=eliz@gnu.org \
    /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 public inbox

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