all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Emacs uses "global" compiler instead of embedded
@ 2022-09-28 20:22 Bartosz Bubak
  2022-09-29  3:13 ` Stefan Monnier via Users list for the GNU Emacs text editor
  2022-09-29  5:51 ` Eli Zaretskii
  0 siblings, 2 replies; 9+ messages in thread
From: Bartosz Bubak @ 2022-09-28 20:22 UTC (permalink / raw)
  To: help-gnu-emacs

Hi,
I am just starting my adventure with emacs, and I have already encountered
a rather unusual problem. As a beginner, I chose the easier option and
installed everything from the package (emacs-28.2-installer.exe). After
starting the editor, it turned out that the logs contain a lot of warnings
(errors?) caused by using the wrong compiler. I mean, emacs uses the
"global" gcc (along with the libraries) which I have in the PATH
environment variable, instead of which it has in the embedded package (the
/bin subdirectory). Interestingly, I have libgccjit-0.dll in the global
directory, but it doesn't seem to work properly.

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

Is it possible to somehow configure emacs to only use embedded libraries?

So far, the only workaround I have found is uninstalling the entire MinGW
or removing it from the system PATH. After MinGW is removed, everything
works fine as emacs and all the add-ons I downloaded.

P.S. Emacs 28.2 on Windows 11, as "global" mingw-64
-- 
Best regards
Bart Bubak


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

* Re: Emacs uses "global" compiler instead of embedded
  2022-09-28 20:22 Emacs uses "global" compiler instead of embedded Bartosz Bubak
@ 2022-09-29  3:13 ` Stefan Monnier via Users list for the GNU Emacs text editor
  2022-09-29  6:21   ` Eli Zaretskii
  2022-09-29  5:51 ` Eli Zaretskii
  1 sibling, 1 reply; 9+ messages in thread
From: Stefan Monnier via Users list for the GNU Emacs text editor @ 2022-09-29  3:13 UTC (permalink / raw)
  To: help-gnu-emacs

> I am just starting my adventure with emacs, and I have already encountered
> a rather unusual problem. As a beginner, I chose the easier option and
> installed everything from the package (emacs-28.2-installer.exe). After
> starting the editor, it turned out that the logs contain a lot of warnings
> (errors?) caused by using the wrong compiler. I mean, emacs uses the
> "global" gcc (along with the libraries) which I have in the PATH
> environment variable, instead of which it has in the embedded package (the
> /bin subdirectory). Interestingly, I have libgccjit-0.dll in the global
> directory, but it doesn't seem to work properly.
>
> 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

Regardless of the workaround you will hopefully find here, I'd urge you
to `M-x report-emacs-bug` to try and make sure the problem gets fixed in
future releases.


        Stefan




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

* Re: Emacs uses "global" compiler instead of embedded
  2022-09-28 20:22 Emacs uses "global" compiler instead of embedded Bartosz Bubak
  2022-09-29  3:13 ` Stefan Monnier via Users list for the GNU Emacs text editor
@ 2022-09-29  5:51 ` Eli Zaretskii
  1 sibling, 0 replies; 9+ messages in thread
From: Eli Zaretskii @ 2022-09-29  5:51 UTC (permalink / raw)
  To: help-gnu-emacs

> From: Bartosz Bubak <bartosz.bubak@gmail.com>
> Date: Wed, 28 Sep 2022 22:22:19 +0200
> 
> I am just starting my adventure with emacs, and I have already encountered
> a rather unusual problem. As a beginner, I chose the easier option and
> installed everything from the package (emacs-28.2-installer.exe). After
> starting the editor, it turned out that the logs contain a lot of warnings
> (errors?) caused by using the wrong compiler. I mean, emacs uses the
> "global" gcc (along with the libraries) which I have in the PATH
> environment variable, instead of which it has in the embedded package (the
> /bin subdirectory). Interestingly, I have libgccjit-0.dll in the global
> directory, but it doesn't seem to work properly.
> 
> 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
> 
> Is it possible to somehow configure emacs to only use embedded libraries?

Didn't you ask the same question on Reddit?  I answered there that you
need to tweak your PATH so that the "right" GCC and Binutils are found
first when Emacs wants to native-compile some file.  Type

  M-: (executable-find "gcc") RET
  M-: (executable-find "as") RET

will tell you where Emacs find GCC and the Binutils it needs to
invoke.

> So far, the only workaround I have found is uninstalling the entire MinGW
> or removing it from the system PATH. After MinGW is removed, everything
> works fine as emacs and all the add-ons I downloaded.

Btw, why do you at all have 2 GCC installations on your system?  That
is highly unusual, and requires a lot of careful setup to work without
problems.  I'm guessing that only one of these installations includes
libgccjit DLL, is that right?



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

* Re: Emacs uses "global" compiler instead of embedded
  2022-09-29  3:13 ` Stefan Monnier via Users list for the GNU Emacs text editor
@ 2022-09-29  6:21   ` Eli Zaretskii
  2022-09-29 13:16     ` Stefan Monnier via Users list for the GNU Emacs text editor
  0 siblings, 1 reply; 9+ messages in thread
From: Eli Zaretskii @ 2022-09-29  6:21 UTC (permalink / raw)
  To: help-gnu-emacs

> Date: Wed, 28 Sep 2022 23:13:23 -0400
> From:  Stefan Monnier via Users list for the GNU Emacs text editor <help-gnu-emacs@gnu.org>
> 
> > I am just starting my adventure with emacs, and I have already encountered
> > a rather unusual problem. As a beginner, I chose the easier option and
> > installed everything from the package (emacs-28.2-installer.exe). After
> > starting the editor, it turned out that the logs contain a lot of warnings
> > (errors?) caused by using the wrong compiler. I mean, emacs uses the
> > "global" gcc (along with the libraries) which I have in the PATH
> > environment variable, instead of which it has in the embedded package (the
> > /bin subdirectory). Interestingly, I have libgccjit-0.dll in the global
> > directory, but it doesn't seem to work properly.
> >
> > 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
> 
> Regardless of the workaround you will hopefully find here, I'd urge you
> to `M-x report-emacs-bug` to try and make sure the problem gets fixed in
> future releases.

How can we possibly solve a problem caused by mis-configuration of the
user's system?



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

* Re: Emacs uses "global" compiler instead of embedded
  2022-09-29  6:21   ` Eli Zaretskii
@ 2022-09-29 13:16     ` Stefan Monnier via Users list for the GNU Emacs text editor
  2022-09-29 16:12       ` Bartosz Bubak
  0 siblings, 1 reply; 9+ messages in thread
From: Stefan Monnier via Users list for the GNU Emacs text editor @ 2022-09-29 13:16 UTC (permalink / raw)
  To: help-gnu-emacs

>> Regardless of the workaround you will hopefully find here, I'd urge you
>> to `M-x report-emacs-bug` to try and make sure the problem gets fixed in
>> future releases.
>
> How can we possibly solve a problem caused by mis-configuration of the
> user's system?

I don't know: the description he gave suggests that the Emacs package he
installed included a GCC ("embedded"), in which case that package should
make sure that Emacs uses this bundled GCC rather than any other GCC
that may be found on the system.

But maybe I simply misunderstood what he meant by:

    I mean, Emacs uses the "global" gcc (along with the libraries) which
    I have in the PATH environment variable, instead of which it has in
    the embedded package (the /bin subdirectory)."


-- Stefan




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

* Re: Emacs uses "global" compiler instead of embedded
  2022-09-29 13:16     ` Stefan Monnier via Users list for the GNU Emacs text editor
@ 2022-09-29 16:12       ` Bartosz Bubak
  2022-09-29 16:34         ` Eli Zaretskii
  0 siblings, 1 reply; 9+ messages in thread
From: Bartosz Bubak @ 2022-09-29 16:12 UTC (permalink / raw)
  Cc: help-gnu-emacs

Hi,
> I don't know: the description he gave suggests that the Emacs package he
> installed included a GCC ("embedded"), in which case that package should
> make sure that Emacs uses this bundled GCC rather than any other GCC
> that may be found on the system.

> But maybe I simply misunderstood what he meant by:

Yes, you understood me well.

> M-: (executable-find "gcc") RET
"c:/ProgramData/chocolatey/bin/gcc.exe
> M-: (executable-find "as") RET
"c:/ProgramData/chocolatey/bin/as.exe"

This is problem, it should be:
C:\Program Files\Emacs\emacs-28.2\bin\gcc.exe
C:\Program Files\Emacs\emacs-28.2\bin\as.exe

On the other hand, I don't want all the rest of the tools in the system to
use this installation, so changing global PATH is pointless.

That's what I'm explaining from the beginning, I have only one MinGW
instance, in chocolatey.
The second is installed and configured automatically by the emacs installer
and that is what emacs should use.
Not my "main" in the system.
In my opinion, the problem is that emacs does not consider local folders
when it looks for the compiler.
Should look in:
1) Local directories,
if not found
2) Global system configuration
And it does the opposite, only when gcc is missing in global configuration
it uses local.

P.S. By mistake I sent the previous response only to Eli instead to group :(


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

* Re: Emacs uses "global" compiler instead of embedded
  2022-09-29 16:12       ` Bartosz Bubak
@ 2022-09-29 16:34         ` Eli Zaretskii
  2022-09-30  8:02           ` Bartosz Bubak
  0 siblings, 1 reply; 9+ messages in thread
From: Eli Zaretskii @ 2022-09-29 16:34 UTC (permalink / raw)
  To: help-gnu-emacs

> From: Bartosz Bubak <bartosz.bubak@gmail.com>
> Date: Thu, 29 Sep 2022 18:12:53 +0200
> Cc: help-gnu-emacs@gnu.org
> 
> > M-: (executable-find "gcc") RET
> "c:/ProgramData/chocolatey/bin/gcc.exe
> > M-: (executable-find "as") RET
> "c:/ProgramData/chocolatey/bin/as.exe"
> 
> This is problem, it should be:
> C:\Program Files\Emacs\emacs-28.2\bin\gcc.exe
> C:\Program Files\Emacs\emacs-28.2\bin\as.exe
> 
> On the other hand, I don't want all the rest of the tools in the system to
> use this installation, so changing global PATH is pointless.
> 
> That's what I'm explaining from the beginning, I have only one MinGW
> instance, in chocolatey.
> The second is installed and configured automatically by the emacs installer
> and that is what emacs should use.
> Not my "main" in the system.

Didn't you say that if you remove the GCC installation in
C:\Program Files\Emacs\emacs-28.2\, everything starts working?

> In my opinion, the problem is that emacs does not consider local folders
> when it looks for the compiler.

It doesn't, and it shouldn't.

> Should look in:
> 1) Local directories,
> if not found
> 2) Global system configuration
> And it does the opposite, only when gcc is missing in global configuration
> it uses local.

AFAIU, it isn't Emacs that looks for GCC, it's libgccjit DLL.  So
maybe just removing libgccjit DLL that came with Emacs will solve your
problem.



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

* Re: Emacs uses "global" compiler instead of embedded
  2022-09-29 16:34         ` Eli Zaretskii
@ 2022-09-30  8:02           ` Bartosz Bubak
  2022-09-30 10:26             ` Eli Zaretskii
  0 siblings, 1 reply; 9+ messages in thread
From: Bartosz Bubak @ 2022-09-30  8:02 UTC (permalink / raw)
  Cc: help-gnu-emacs

>> That's what I'm explaining from the beginning, I have only one MinGW
>> instance, in chocolatey.
>> The second is installed and configured automatically by the emacs
installer
>> and that is what emacs should use.
>> Not my "main" in the system.

> Didn't you say that if you remove the GCC installation in
> C:\Program Files\Emacs\emacs-28.2\, everything starts working?

No, I removed my MinGW installation, then everything works fine.

> AFAIU, it isn't Emacs that looks for GCC, it's libgccjit DLL.  So
>maybe just removing libgccjit DLL that came with Emacs will solve your
> problem.

I tried it, just for the test. It didn't change anything.

As you mentioned on Reddit, the installer doesn't ask for anything and
doesn't let you NOT install local gcc.
So any installation from a package with a different compiler on your system
will end up with problems.
However, I will report an bug.

-- 
Best regards
Bartosz Bubak


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

* Re: Emacs uses "global" compiler instead of embedded
  2022-09-30  8:02           ` Bartosz Bubak
@ 2022-09-30 10:26             ` Eli Zaretskii
  0 siblings, 0 replies; 9+ messages in thread
From: Eli Zaretskii @ 2022-09-30 10:26 UTC (permalink / raw)
  To: help-gnu-emacs

> From: Bartosz Bubak <bartosz.bubak@gmail.com>
> Date: Fri, 30 Sep 2022 10:02:39 +0200
> Cc: help-gnu-emacs@gnu.org
> 
> >> That's what I'm explaining from the beginning, I have only one MinGW
> >> instance, in chocolatey.
> >> The second is installed and configured automatically by the emacs
> installer
> >> and that is what emacs should use.
> >> Not my "main" in the system.
> 
> > Didn't you say that if you remove the GCC installation in
> > C:\Program Files\Emacs\emacs-28.2\, everything starts working?
> 
> No, I removed my MinGW installation, then everything works fine.

What is "your MinGW installation" in this context?  Is it what came
with Emacs, or is it what was installed from chocolatey?  They are
both "MinGW" (AFAIU), so what you say is ambiguous.

> > AFAIU, it isn't Emacs that looks for GCC, it's libgccjit DLL.  So
> >maybe just removing libgccjit DLL that came with Emacs will solve your
> > problem.
> 
> I tried it, just for the test. It didn't change anything.

What exactly did you try, and how did it "not change anything"?

Does Emacs succeed in loading libgccjit you have from chocolatey, when
you remove the DLL that came with Emacs?  If not, does the chocolatey
libgccjit DLL live in some directory on PATH?

> As you mentioned on Reddit, the installer doesn't ask for anything and
> doesn't let you NOT install local gcc.

But if removing the local GCC (which is what? the one that came with
Emacs?) doesn't leave you with Emacs that can natively-compile,
there's a larger problem here, one that I don't yet understand.

What version of GCC did you install from chocolatey?  What does
"gcc --version" there say?



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

end of thread, other threads:[~2022-09-30 10:26 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-28 20:22 Emacs uses "global" compiler instead of embedded Bartosz Bubak
2022-09-29  3:13 ` Stefan Monnier via Users list for the GNU Emacs text editor
2022-09-29  6:21   ` Eli Zaretskii
2022-09-29 13:16     ` Stefan Monnier via Users list for the GNU Emacs text editor
2022-09-29 16:12       ` Bartosz Bubak
2022-09-29 16:34         ` Eli Zaretskii
2022-09-30  8:02           ` Bartosz Bubak
2022-09-30 10:26             ` Eli Zaretskii
2022-09-29  5:51 ` Eli Zaretskii

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.