Subject: build error from native-comp: void function ("emacs-lisp/package.el" package-desc-p)
From: Vitaly Ankh <[email-masked]>
To: [email-masked]
Date: Wed, 24 May 2023 16:37:25 +0800
List-Id: <debbugs-submit.debbugs.gnu.org>

Hi emacs,

  With the latest emacs lisp native compiler change
(https://git.savannah.gnu.org/cgit/emacs.git/commit/?id=92ccb6ba83076a40f3bfc7906913346a5b3a7a92
and subsequent commits), there is a build error:

```
Error: void-function ("emacs-lisp/package.el" package-desc-p)
  mapbacktrace(#f(compiled-function (evald func args flags) #<bytecode
-0x1dc4ecf4b251797b>))
  debug-early-backtrace()
  debug-early(error (void-function "emacs-lisp/package.el" package-desc-p))
  signal(void-function ("emacs-lisp/package.el" package-desc-p))
  comp--native-compile("emacs-lisp/package.el")
  batch-native-compile()
  batch-byte+native-compile()
  command-line-1(("--eval" "(setq load-prefer-newer t
byte-compile-warnings 'all)" "--eval" "(setq
org--inhibit-version-check t)" "-l" "comp" "-f"
"batch-byte+native-compile" "emacs-lisp/package.el"))
  command-line()
  normal-top-level()
Symbol’s function definition is void: "emacs-lisp/package.el", package-desc-p
```

I built Emacs master branch with the latest commit
(https://git.savannah.gnu.org/cgit/emacs.git/commit/?id=9ad997cd68981fe6c6933b6977fdae23e84e6a75),
enabled native-comp, on Linux.

Repository branch: master
System Description: Arch Linux

Configured using:
 'configure --prefix=/usr --sysconfdir=/etc --libexecdir=/usr/lib
 --localstatedir=/var --mandir=/usr/share/man --with-gameuser=:games
 --with-modules --without-libotf --without-m17n-flt --without-gconf
 --without-gsettings --enable-link-time-optimization
 --with-native-compilation --with-pgtk --without-xaw3d --with-sound=alsa
 --with-xwidgets --without-compress-install
 '--program-transform-name=s/\([ec]tags\)/\1.emacs/'
 'CFLAGS=-march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fuse-ld=gold'
 CPPFLAGS=-D_FORTIFY_SOURCE=2
 LDFLAGS=-Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now'

VitalyR