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

From: Eli Zaretskii <[email-masked]>
Date: Mon, 15 May 2023 21:32:12 +0300

> From: Kaushal Modi <[email-masked]>
> Date: Mon, 15 May 2023 13:46:43 -0400
> 
> This is a recent regression (probably in the last week or 2) in emacs built from the emacs-29 branch.
> 
> I have always been using emacsclient.
> 
> But the emacs built from 09d6070e56ea21a5e9720bc619c439c09e5b2680 is the first version where
> I see this error upon starting emacsclient&.

This error doesn't come from emacsclient, it comes from the async
native compilation.  Did you upgrade your system lately, in particular
GCC and/or Binutils?

>  ■  Warning (initialization): An error occurred while loading ‘/home/kmodi/.emacs.d/init.el’:
> 
> Native compiler error: (lambda (arg3 &optional arg4) (let ((f #'start-kbd-macro)) (funcall f arg3 arg4))),
> Compiling
> /home/kmodi/.emacs.d/eln-cache/29.0.90-f902ddd0/subr--trampoline-73746172742d6b62642d6d6163726f_start_kbd_macro_0.eln...
> 
> ld: cannot find crtbeginS.o: No such file or directory
> ld: cannot find -lgcc
> ld: cannot find -lgcc
> libgccjit.so: error: error invoking gcc driver
> Internal native compiler error: "failed to compile",
> "/home/kmodi/.emacs.d/eln-cache/29.0.90-f902ddd0/subr--trampoline-73746172742d6b62642d6d6163726f_start_kbd_macro_0.eln",
> "error invoking gcc driver"

See? it's ld, the linker, complaining that it cannot find a library
(libgcc) it needs for producing the .eln file.

You should verify your libgccjit installation is working correctly.
Which GCC version do you have?

FWIW, I have no problems building the current emacs-29 branch with
native-compilation.  I just tried.

> In GNU Emacs 29.0.90 (build 3, x86_64-pc-linux-gnu, GTK+ Version
>  3.22.30, cairo version 1.15.12) of 2023-05-12 built on
>  kmodi-lx01.engus1.analog.com
> Repository revision: 09d6070e56ea21a5e9720bc619c439c09e5b2680
> Repository branch: emacs-29

This is not the latest emacs-29 branch, btw (not that I expect a
slightly outdated revision of the branch to fail to compile).