vedang / pdf-tools

Emacs support library for PDF files.
https://pdftools.wiki
GNU General Public License v3.0
625 stars 89 forks source link

Error locating build-directory in pdf-tools-install #90

Closed basil-conto closed 2 years ago

basil-conto commented 2 years ago

M-x pdf-tools-install fails with wrong-type-argument in vanilla installations of pdf-tools from NonGNU ELPA in all Emacs versions 24 through 29.

Error backtrace

Backtrace ``` Debugger entered--Lisp error: (wrong-type-argument (and (not null) file-directory) nil build-directory) signal(wrong-type-argument ((and (not null) file-directory) nil build-directory)) (or (and (not (null build-directory)) (file-directory-p build-directory)) (signal 'wrong-type-argument (list '(and (not null) file-directory) build-directory 'build-directory))) (progn (or (and (not (null build-directory)) (file-directory-p build-directory)) (signal 'wrong-type-argument (list '(and (not null) file-directory) build-directory 'build-directory))) nil) pdf-tools-build-server("/tmp/tmp.CzGJkzLTjM/.emacs.d/elpa/pdf-tools-1.0/" nil nil (closure ((target-directory . "/tmp/tmp.CzGJkzLTjM/.emacs.d/elpa/pdf-tools-1.0/") (force-dependencies-p) (no-error-p) (skip-dependencies-p) (no-query-p) t) (executable) (let ((msg (format "Building the PDF Tools server %s" (if executable "succeeded" "failed")))) (if (not executable) (funcall (if no-error-p #'message #'error) "%s" msg) (message "%s" msg) (setq pdf-info-epdfinfo-program executable) (let ((pdf-info-restart-process-p t)) (pdf-tools-install-noverify)))))) (if (or no-query-p (y-or-n-p "Need to (re)build the epdfinfo program, do it now ...")) (pdf-tools-build-server target-directory skip-dependencies-p force-dependencies-p #'(lambda (executable) (let ((msg (format "Building the PDF Tools server %s" ...))) (if (not executable) (funcall (if no-error-p ... ...) "%s" msg) (message "%s" msg) (setq pdf-info-epdfinfo-program executable) (let (...) (pdf-tools-install-noverify)))))) (message "PDF Tools not activated")) (let ((target-directory (or (and (stringp pdf-info-epdfinfo-program) (file-name-directory pdf-info-epdfinfo-program)) pdf-tools-directory))) (if (or no-query-p (y-or-n-p "Need to (re)build the epdfinfo program, do it now ...")) (pdf-tools-build-server target-directory skip-dependencies-p force-dependencies-p #'(lambda (executable) (let ((msg ...)) (if (not executable) (funcall ... "%s" msg) (message "%s" msg) (setq pdf-info-epdfinfo-program executable) (let ... ...))))) (message "PDF Tools not activated"))) (if (or (pdf-info-running-p) (condition-case nil (progn (pdf-info-check-epdfinfo) t) (error nil))) (pdf-tools-install-noverify) (let ((target-directory (or (and (stringp pdf-info-epdfinfo-program) (file-name-directory pdf-info-epdfinfo-program)) pdf-tools-directory))) (if (or no-query-p (y-or-n-p "Need to (re)build the epdfinfo program, do it now ...")) (pdf-tools-build-server target-directory skip-dependencies-p force-dependencies-p #'(lambda (executable) (let (...) (if ... ... ... ... ...)))) (message "PDF Tools not activated")))) pdf-tools-install() funcall-interactively(pdf-tools-install) call-interactively(pdf-tools-install record nil) command-execute(pdf-tools-install record) execute-extended-command(nil "pdf-tools-install" "pdf-tools-in") funcall-interactively(execute-extended-command nil "pdf-tools-install" "pdf-tools-in") call-interactively(execute-extended-command nil nil) command-execute(execute-extended-command) ```

Recipe

Recipe for Emacs versions 28 and 29:

  1. $ cd "$(mktemp -d)"
    $ export HOME="$PWD" XDG_CONFIG_HOME="$PWD/.config"
    $ emacs -Q -f toggle-debug-on-error
  2. M-x package-install RET pdf-tools RET
  3. M-x pdf-tools-install RET y

The recipe for Emacs versions 26 and 27 is the same, except they don't OOTB know about NonGNU ELPA, so they need to be told before package-install:

(setq package-archives
      '(("gnu" . "https://elpa.gnu.org/packages/")
        ("nongnu" . "https://elpa.nongnu.org/nongnu/")))

The recipe for Emacs versions 24 and 25 further needs to use HTTP instead of HTTPS and ignore package signatures in order for package-install to succeed:

(setq package-archives
      '(("gnu" . "http://elpa.gnu.org/packages/")
        ("nongnu" . "http://elpa.nongnu.org/nongnu/"))
      package-check-signature nil)

Emacs versions

Emacs 29 configuration ``` In GNU Emacs 29.0.50 (build 1, x86_64-pc-linux-gnu, X toolkit, cairo version 1.16.0, Xaw3d scroll bars) of 2022-04-14 built on tia Repository revision: eab0105696f6cd306842e3ede1830fbf1c7057ec Repository branch: master Windowing system distributor 'The X.Org Foundation', version 11.0.12101003 System Description: Debian GNU/Linux bookworm/sid Configured using: 'configure 'CC=ccache gcc' 'CFLAGS=-Og -ggdb3' --config-cache --prefix /home/blc/.local --enable-checking=structs --with-x-toolkit=lucid --with-file-notification=yes --with-xinput2 --with-x' Configured features: ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ JPEG JSON LCMS2 LIBOTF LIBSELINUX LIBSYSTEMD LIBXML2 M17N_FLT MODULES NOTIFY INOTIFY PDUMPER PNG RSVG SECCOMP SOUND SQLITE3 THREADS TIFF TOOLKIT_SCROLL_BARS WEBP X11 XAW3D XDBE XIM XINPUT2 XPM LUCID ZLIB Important settings: value of $LANG: en_IE.UTF-8 value of $XMODIFIERS: @im=ibus locale-coding-system: utf-8-unix Major mode: Debugger Minor modes in effect: tooltip-mode: t global-eldoc-mode: t show-paren-mode: t electric-indent-mode: t mouse-wheel-mode: t tool-bar-mode: t menu-bar-mode: t file-name-shadow-mode: t global-font-lock-mode: t font-lock-mode: t blink-cursor-mode: t buffer-read-only: t line-number-mode: t indent-tabs-mode: t transient-mark-mode: t auto-composition-mode: t auto-encryption-mode: t auto-compression-mode: t Load-path shadows: None found. Features: (shadow sort mail-extr emacsbug help-fns cl-print pdf-loader ert ewoc debug backtrace pdf-links ibuf-ext ibuffer ibuffer-loaddefs pdf-tools pdf-isearch let-alist tablist org ob ob-tangle ob-ref ob-lob ob-table ob-exp org-macro org-footnote org-src ob-comint org-pcomplete pcomplete org-list org-faces org-entities noutline outline org-version ob-emacs-lisp ob-core ob-eval org-table oc-basic bibtex iso8601 ol rx org-keys oc org-compat org-macs org-loaddefs cal-menu calendar cal-loaddefs facemenu pdf-misc imenu pdf-view bookmark jka-compr pdf-cache pdf-info tq pdf-util cl-extra help-mode format-spec image-mode exif advice warnings tablist-filter semantic/wisent/comp semantic/wisent semantic/wisent/wisent semantic/util-modes semantic/util semantic semantic/tag semantic/lex semantic/fw mode-local find-func cedet pcase compile comint ansi-color ring easy-mmode autoload radix-tree lisp-mnt tar-mode arc-mode archive-mode cus-edit pp wid-edit mm-archive message sendmail yank-media dired dired-loaddefs rfc822 mml mml-sec epa derived gnus-util text-property-search time-date mailabbrev gmm-utils mailheader mm-decode mm-bodies mm-encode mail-utils gnutls network-stream url-http mail-parse rfc2231 rfc2047 rfc2045 mm-util ietf-drums mail-prsvr url-gw nsm rmc puny url-cache url-auth epg rfc6068 epg-config finder-inf package browse-url url url-proxy url-privacy url-expand url-methods url-history url-cookie url-domsuf url-util mailcap url-handlers url-parse auth-source cl-seq eieio eieio-core cl-macs eieio-loaddefs password-cache json map url-vars seq gv subr-x byte-opt bytecomp byte-compile cconv cl-loaddefs cl-lib cus-start cus-load iso-transl tooltip eldoc paren electric uniquify ediff-hook vc-hooks lisp-float-type elisp-mode mwheel term/x-win x-win term/common-win x-dnd tool-bar dnd fontset image regexp-opt fringe tabulated-list replace newcomment text-mode lisp-mode prog-mode register page tab-bar menu-bar rfn-eshadow isearch easymenu timer select scroll-bar mouse jit-lock font-lock syntax font-core term/tty-colors frame minibuffer nadvice simple cl-generic cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech european ethiopic indian cyrillic chinese composite emoji-zwj charscript charprop case-table epa-hook jka-cmpr-hook help abbrev obarray oclosure cl-preloaded button loaddefs faces cus-face macroexp files window text-properties overlay sha1 md5 base64 format env code-pages mule custom widget keymap hashtable-print-readable backquote threads dbusbind inotify lcms2 dynamic-setting system-font-setting font-render-setting cairo x-toolkit xinput2 x multi-tty make-network-process emacs) ```
Emacs 28 configuration ``` In GNU Emacs 28.1 (build 1, x86_64-pc-linux-gnu, X toolkit, cairo version 1.16.0, Xaw3d scroll bars) of 2022-04-13 built on tia Windowing system distributor 'The X.Org Foundation', version 11.0.12101003 System Description: Debian GNU/Linux bookworm/sid Configured using: 'configure CC=gcc-12 'CFLAGS=-O0 -ggdb3' --prefix=/home/blc/.local --program-suffix=-28 --enable-checking=yes,glyphs --enable-check-lisp-object-type --with-x-toolkit=lucid --with-file-notification=yes --with-x' Configured features: ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ JPEG JSON LCMS2 LIBOTF LIBSELINUX LIBSYSTEMD LIBXML2 M17N_FLT MODULES NOTIFY INOTIFY PDUMPER PNG RSVG SECCOMP SOUND THREADS TIFF TOOLKIT_SCROLL_BARS X11 XAW3D XDBE XIM XPM LUCID ZLIB ```
Emacs 27 configuration ``` In GNU Emacs 27.2 (build 1, x86_64-pc-linux-gnu, X toolkit, cairo version 1.16.0, Xaw3d scroll bars) of 2021-12-13 built on tia Windowing system distributor 'The X.Org Foundation', version 11.0.12101003 System Description: Debian GNU/Linux bookworm/sid Recent messages: Checking /tmp/tmp.vgYyT9N9Do/.emacs.d/elpa/pdf-tools-1.0/server/test... Checking /tmp/tmp.vgYyT9N9Do/.emacs.d/elpa/pdf-tools-1.0/server/test/docker... Checking /tmp/tmp.vgYyT9N9Do/.emacs.d/elpa/pdf-tools-1.0/server/test/docker/lib... Checking /tmp/tmp.vgYyT9N9Do/.emacs.d/elpa/pdf-tools-1.0/server/test/docker/templates... Done (Total of 23 files compiled, 1 failed, 2 skipped in 2 directories) You can run the command ‘package-install’ with M-x pa-ins RET Done (Total of 23 files compiled, 1 failed, 2 skipped in 2 directories) Need to (re)build the epdfinfo program, do it now ? (y or n) y Entering debugger... Mark set Configured using: 'configure 'CFLAGS=-O2 -march=native' --prefix=/home/blc/.local --program-suffix=-27 --with-file-notification=yes --with-x-toolkit=lucid --with-x --with-cairo' ```
Emacs 26 configuration ``` In GNU Emacs 26.3 (build 1, x86_64-pc-linux-gnu, X toolkit, Xaw3d scroll bars) of 2021-12-13 built on tia Windowing system distributor 'The X.Org Foundation', version 11.0.12101003 System Description: Debian GNU/Linux bookworm/sid ```
Emacs 25 configuration ``` In GNU Emacs 25.3.1 (x86_64-pc-linux-gnu, X toolkit, Xaw3d scroll bars) of 2021-12-13 built on tia Windowing system distributor 'The X.Org Foundation', version 11.0.12101003 System Description: Debian GNU/Linux bookworm/sid ```
Emacs 24 configuration ``` In GNU Emacs 24.5.1 (x86_64-unknown-linux-gnu, X toolkit, Xaw3d scroll bars) of 2021-12-13 on tia Windowing system distributor `The X.Org Foundation', version 11.0.12101003 System Description: Debian GNU/Linux bookworm/sid ```
vedang commented 2 years ago

Thanks for the excellent report. I've merged the associated PR in.