Subject: Re: bug#63523: 29.0.90; Failing to find -lgcc when running emacsclient

From: Kaushal Modi <[email-masked]>
Date: Wed, 24 May 2023 11:55:27 -0400

On Wed, May 24, 2023 at 11:50 AM Eli Zaretskii <[email-masked]> wrote:

> > From: Kaushal Modi <[email-masked]>
> > Date: Wed, 24 May 2023 11:39:20 -0400
> > Cc: [email-masked]
> >
> > This issue happened to me again, but now I know what causes it.
> >
> > - I was building Emacs from a terminal with gcc 9.3.0 loaded.
> > - I was launching emacsclient from a terminal with gcc 9.1.0 loaded.
>
> Sorry, I don't understand: what does it mean "terminal with gcc X.Y.Z
> loaded"? how is GCC "loaded" in those cases?
>

Sorry, I used the wrong term.. meant to say shell instead of terminal. At
work, we have a "module" system that allows loading different versions of
various applications on the fly. So if I have 2 terminals open, I can have
different versions of gcc in them.
There's a default gcc version that's older (9.1.0) and then the gcc version
I use to build emacs which is slightly newer (9.3.0).

>
> > Note to self: Ensure that the gcc versions used for building and running
> emacs are the exact same
> > (incl the minor versions).
>
> That's not a requirement.  What _is_ a requirement is that when you
> upgrade your GCC installation, you need to restart Emacs, if the
> running Emacs session was built with native compilation, so that Emacs
> starts using the version of GCC that you have installed for future
> compilations.  But the *.eln files that were built by libgccjit of one
> version should be fully usable after you upgrade to another version.
>

I did do a complete restart of emacs/emacsclient. I ensured using ps that
no emacsclient sessions were running in the background.

If I have gcc 9.1.0 paths (PATH, LD_LIBRARY_PATH, etc.) loaded in the
shell, I see this issue.
But once I switch to gcc 9.3.0 paths, the issue is fixed.

> > On the same note, is it possible for Emacs to give a more informative
> error that says that libgcc of
> > X.Y.Z version was not found?
>
> That error doesn't come from Emacs, it comes from the GCC compilation
> driver.  We just report it, as it was reported to us.
>

OK.