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

From: leuven65 <[email-masked]>
Date: Wed, 3 Jul 2024 18:24:04 +0200

* The installed MINGW64 packages
#+begin_quote
base-devel 2022.12-2
mingw-w64-x86_64-aspell-en 2020.12.07-1
mingw-w64-x86_64-autotools 2023.09.28-2
mingw-w64-x86_64-binutils 2.42-2
mingw-w64-x86_64-crt-git 12.0.0.r81.g90abf784a-1
mingw-w64-x86_64-diffutils 3.6-3
mingw-w64-x86_64-emacs-pdf-tools-server 1.1.0-1
mingw-w64-x86_64-gcc 14.1.0-3
mingw-w64-x86_64-gnupg 2.4.5-1
mingw-w64-x86_64-headers-git 12.0.0.r81.g90abf784a-1
mingw-w64-x86_64-jansson 2.14-2
mingw-w64-x86_64-libgccjit 14.1.0-3
mingw-w64-x86_64-librsvg 2.58.0-1
mingw-w64-x86_64-libvterm 0.3.3-1
mingw-w64-x86_64-libxml2 2.12.8-1
mingw-w64-x86_64-make 4.4.1-2
mingw-w64-x86_64-mpg123 1.32.6-1
mingw-w64-x86_64-pkgconf 1~2.2.0-1
mingw-w64-x86_64-rust 1.79.0-1
mingw-w64-x86_64-tools-git 12.0.0.r81.g90abf784a-1
mingw-w64-x86_64-tree-sitter 0.22.6-1
mingw-w64-x86_64-winpthreads-git 12.0.0.r81.g90abf784a-1
mingw-w64-x86_64-xpm-nox 4.2.0-8
#+end_quote

* The used commit on master branch
65bd41d1cf6d8ea6b95b69d9c60b0111a1c33392

* The build command
#+begin_src sh
  ./autogen.sh

  ./configure \
        --config-cache \
        --without-dbus \
        --without-pop \
        --without-compress-install \
        --with-native-compilation=aot \
        --with-tree-sitter \

  make -j$(nproc)
#+end_src

* Error pops up during building
#+begin_quote
make[3]: Entering directory '/c/workdir/emacs-src/lisp'
  ELC+ELN  emacs-lisp/macroexp.elc
  ELC+ELN  emacs-lisp/cconv.elc
  ELC+ELN  emacs-lisp/byte-opt.elc
  ELC+ELN  emacs-lisp/bytecomp.elc
  ELC+ELN  emacs-lisp/comp.elc
  ELC+ELN  emacs-lisp/comp-cstr.elc
  ELC+ELN  emacs-lisp/comp-common.elc
  ELC+ELN  emacs-lisp/comp-run.elc
  ELC+ELN  emacs-lisp/loaddefs-gen.elc

Error: error ("Cannot find libgccjit library")
  signal(error ("Cannot find libgccjit library"))
  error("Cannot find libgccjit library")
  comp-ensure-native-compiler()
  batch-byte+native-compile()
  funcall(batch-byte+native-compile)
  (if (commandp tem) (command-execute tem) (funcall tem))
  (cond ((setq tem (assoc argi command-switch-alist)) (if argval (let
((command-line-args-left (cons argval command-line-args-left))) (funcall
(cdr tem) argi)) (funcall (cdr tem) argi))) ((equal argi "-no-splash")
(setq inhibit-startup-screen t)) ((member argi '("-f" "-funcall" "-e"))
(setq inhibit-startup-screen t) (setq tem (intern (or argval (car-safe
(prog1 command-line-args-left (setq command-line-args-left (cdr
command-line-args-left))))))) (if (commandp tem) (command-execute tem)
(funcall tem))) ((member argi '("-eval" "-execute")) (setq
inhibit-startup-screen t) (let* ((str-expr (or argval (car-safe (prog1
command-line-args-left (setq command-line-args-left (cdr
command-line-args-left)))))) (read-data (read-from-string str-expr)) (expr
(car read-data)) (end (cdr read-data))) (if (string-match-p "[ \11\n]*\\'"
str-expr end) nil (error "Trailing garbage following expression: %s"
(substring str-expr end))) (eval expr t))) ((member argi '("-L"
"-directory")) (let (append) (if (string-match-p (format "\\`%s"
path-separator) (setq tem (or argval (car-safe (prog1
command-line-args-left (setq command-line-args-left (cdr
command-line-args-left))))))) (progn (setq tem (substring tem 1)) (setq
append t))) (setq tem (expand-file-name (command-line-normalize-file-name
tem))) (cond (append (setq load-path (append load-path (list tem))) (if
splice (setq splice load-path))) (splice (setcdr splice (cons tem (cdr
splice))) (setq splice (cdr splice))) (t (progn (setq load-path (cons tem
load-path)) (setq splice load-path)))))) ((member argi '("-l" "-load"))
(let* ((file (command-line-normalize-file-name (or argval (car-safe (prog1
command-line-args-left (setq command-line-args-left (cdr
command-line-args-left))))))) (file-ex (file-truename (expand-file-name
file)))) (if (file-regular-p file-ex) (progn (setq file file-ex))) (load
file nil t))) ((member argi '("-scriptload" "-scripteval")) (let* ((file
(command-line-normalize-file-name (or argval (car-safe (prog1
command-line-args-left (setq command-line-args-left (cdr
command-line-args-left))))))) (file-ex (expand-file-name file)) (truename
(file-truename file-ex))) (if (file-exists-p truename) (progn (setq file-ex
truename))) (if (equal argi "-scripteval") (command-line--eval-script
file-ex) (command-line--load-script file-ex)))) ((equal argi "-insert")
(setq inhibit-startup-screen t) (setq tem (or argval (car-safe (prog1
command-line-args-left (setq command-line-args-left (cdr
command-line-args-left)))))) (or (stringp tem) (error "File name omitted
from `-insert' option")) (insert-file-contents
(command-line-normalize-file-name tem))) ((or (equal argi "-dump-file")
(equal argi "-seccomp")) (or argval (car-safe (prog1 command-line-args-left
(setq command-line-args-left (cdr command-line-args-left)))))) ((equal argi
"-kill") (kill-emacs t)) ((equal argi "-no-desktop") (message
"\"--no-desktop\" ignored because the Desktop package is not loaded"))
((string-match "^\\+[0-9]+\\'" argi) (setq line (string-to-number argi)))
((string-match "^\\+\\([0-9]+\\):\\([0-9]+\\)\\'" argi) (progn (setq line
(string-to-number (match-string 1 argi))) (setq column (string-to-number
(match-string 2 argi))))) ((setq tem (assoc orig-argi
command-line-x-option-alist)) (setq command-line-args-left (nthcdr (nth 1
tem) command-line-args-left))) ((setq tem (assoc orig-argi
command-line-ns-option-alist)) (setq command-line-args-left (nthcdr (nth 1
tem) command-line-args-left))) ((member argi '("-find-file" "-file"
"-visit")) (setq inhibit-startup-screen t) (setq tem (or argval (car-safe
(prog1 command-line-args-left (setq command-line-args-left (cdr
command-line-args-left)))))) (if (stringp tem) nil (error "File name
omitted from `%s' option" argi)) (funcall process-file-arg tem))
((string-match "\\`--?\\(no-\\)?\\(uni\
#+end_quote

On Wed, Jul 3, 2024 at 3:52 PM Andrea Corallo <[email-masked]> 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
>