reddit / emacs
Emacs uses global compiler instead of embedded
parasit · 2022-09-27 22:09
Hi,
After installing Emacs from package, my logs are full of warnings such as:
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
I noticed that the problem is that emacs uses "global" gcc (installed by chocolatey) instead of the local gcc embedded in the installation directory. I don't have and don't need all emacs dependencies in my mingw main directories. Is it possible to somehow set the configuration so that it works only on "own" embedded compiler?
So far, I have been able to work around the problem by removing mingw from the system env path, I write mainly in python and golang, but if I need it again, the problem will come back.
Soupeeee · 2022-09-27 22:43
Since it seems to be reading the wrong dll, I would see if you can set `LD_LIBRARY_PATH` to point to the correct dll. No idea if that env var is used in Windows is though.
7890yuiop · 2022-09-28 02:50
Shouldn't you raise an issue with "chocolatey" about this?
parasit · 2022-09-28 07:46
It doesn’t matter how it’s installed. The problem is that emacs doesn't use gcc (and libraries) from its own directories.
7890yuiop · 2022-09-28 08:07
Why do you think that has nothing to do with how it's installed? If it *needs* to use certain paths, that sounds like a build+installation issue to me.
Edit: Oh, but I thought it was Emacs which was installed by "chocolatey", and on re-reading I see that's not the case.
So how *did* you install Emacs? What was it that put a copy of gcc in its installation dir?
parasit · 2022-09-28 09:13
I got installer from GNU ftp (emacs-28.2-installer.exe). It contains everything needed embedded in subdirectories, gcc, libraries etc.
It works fine until in my system PATH not appear another compiler with another LD\_LIBRARY\_PATH.
7890yuiop · 2022-09-28 09:32
Make a bug report, then. `M-x report-emacs-bug`
eli-zaretskii · 2022-09-28 14:04
You need to tweak your `PATH` so that the "gcc" you want Emacs to use is found before the other one.
eli-zaretskii · 2022-09-28 14:04
`LD_LIBRARY_PATH` has no role and no effect on MS-Windows.
parasit · 2022-09-28 15:07
I've already thought about it. Unfortunately, there are two problems, first, emacs gcc is not on the path. Second, I don't want all other applications to use embedded compiler ...
Soupeeee · 2022-09-28 16:50
You should be able to set the path per process though. See https://stackoverflow.com/questions/3036325/can-i-set-an-environment-variable-for-an-application-using-a-shortcut-in-windows
parasit · 2022-09-28 19:14
Good idea, maybe it will works.
But this is still just a workaround :(
I somehow can't believe that for so many years no one has had another compiler on the system and has not encountered this problem ...
7890yuiop · 2022-09-28 22:22
In all the many years since [April this year](https://ftp.gnu.org/pub/gnu/emacs/windows/emacs-28/) ?
(The native compilation feature was released in 28.1. No prior release version of Emacs ever had need of a C compiler at run-time.)
[deleted] · 2022-09-29 02:58
[deleted]
7890yuiop · 2022-09-29 02:59
> there are two problems, first, emacs gcc is not on the path.
If the installation documentation suggests that this would be
otherwise, then raise a bug report.
If the docs say you have to set this manually, then I guess it's
working as designed.
If the docs don't mention it at all and it's required, then
raise a documentation bug report.
> Second, I don't want all other applications to use embedded compiler ...
Untested, but you could try this in your init file:
(push "/path/to/emacs/gcc/directory" exec-path)
eli-zaretskii · 2022-09-29 08:12
Then you shouldn't install the "embedded" compiler.
parasit · 2022-09-29 09:44
Hmmmmm I have been using Emacs for a week, but I know that it is already several dozen years old. I also had no idea that this is a relatively new functionality :)
parasit · 2022-09-29 09:45
It was in original installer…
eli-zaretskii · 2022-09-29 13:33
If the installer doesn't allow you to choose not to install `libgccjit` and its accompanying compiler and Binutils, please report that as a bug, because it means people with GCC already installed cannot safely use the installer.