Subject: bug#71916: 31.0.50; build failure on MINGW64

From: Eli Zaretskii <[email-masked]>
Date: Wed, 03 Jul 2024 22:15:54 +0300

> From: Andy Moreton <[email-masked]>
> Date: Wed, 03 Jul 2024 19:02:06 +0100
> 
> On Wed 03 Jul 2024, Andrea Corallo wrote:
> 
> > leuven65 <[email-masked]> writes:
> >
> >> I found the latest version of both master and emacs-30 branch (from Monday) failed to be built on MINGW64 / windows10.
> >> It failed when starting native compilation, error pops up "Cannot find libgccjit library" (from
> >> comp-ensure-native-compiler), maybe the called function "load_gccjit_if_necessary / init_gccjit_functions" return error.
> >>
> >> But if to revert the change introduced by branch "savannah/scratch/windows-98" (merged on 2024/06/30), the build becomes
> >> OK.
> >>
> >>  git revert 38179f85f8f7236d5de8d9a4333b6a1d4ded63f0
> >>
> >> So that maybe the issue is caused by the 3 commits in this branch.
> >
> > Hello leuven65,
> >
> > could you share the exact error you observe?
> >
> > Ccing Po Lo
> >
> > Thanks
> >
> >   Andrea
> 
> I've seen the same issue on emacs-30 and master branches. It seems to be
> that emacs cannot find the libgccjit DLL after dumping.
> 
> Running emacs under gdb, and using a breakpoint on `redraw-display':
> 
> (gdb) r -Q
> Starting program: C:\emacs\git\emacs\emacs-30\build\mingw64-x86_64-O2-native\src\emacs.exe -Q
> [New Thread 11584.0x27b4]
> [New Thread 11584.0x1f54]
> [New Thread 11584.0x1ec8]
> [New Thread 11584.0x2ad0]
> [New Thread 11584.0x1a60]
> 
> Thread 1 hit Breakpoint 2, Fredraw_display () at C:/emacs/git/emacs/emacs-30/src/dispnew.c:3222
> 
> (gdb) pp Vlibrary_cache
> ((gccjit) (gccjit . t))
> 
> It seems odd that there are two entries here.

Thanks, I think I fixed this now on the emacs-30 branch.

> There is code at the end of syms_of_emacs in emacs.c that changes
> Vdynamic_library_alist as a workaround for something similar, so have
> other changes made that ineffective ?

No, the problem was that Vlibrary_cache was not re-initialized after
loading the pdumper file.