vedang / pdf-tools

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

(pdf-tools-install) fails on macOS Sonoma 14.2.1 with poppler installed using homebrew #269

Closed mikaelspringer closed 7 months ago

mikaelspringer commented 7 months ago

Describe the bug After package update in Emacs, (pdf-tools-install) fails with error message "No package 'glib-2.0' found". Poppler 24.04.0 is installed using homebrew. glib 2.80.0 is installed using homebrew (as a dependency).

Steps to Reproduce the behaviour Steps to reproduce the behaviour:

  1. Update Emacs packages.
  2. Restart Emacs.
  3. Answer "y" on the question: "Need to (re)build the epdfinfo program, do it now ? (y or n)".
  4. Error: "error in process sentinel: Building the PDF Tools server failed"

What is the expected behaviour? The rebuild of epdfinfo should execute without errors.

Desktop Please complete the following information:

Your pdf-tools install Please complete the following information:

(use-package pdf-tools :ensure t :if (eq system-type 'darwin) :config (pdf-tools-install))

vedang commented 7 months ago

The problem is that something seems to have changed in the way brew installs glib, due to which pkg-config does not find the glib headers.

To fix this, I have updated the autobuild script to manually modify the PKG_CONFIG_PATH. This should fix the problem.

I will test the change and close this issue via the commit once I push it. You will need to update your version of pdf-tools and then restart Emacs to trigger the re-build again. (It might take a few hours for Melpa to pick up the latest version of the pdf-tools)

I will create a linked issue to investigate a better long-term solution to this problem.

mikaelspringer commented 7 months ago

I updated the Emacs pdf-tools package and restarted. When prompted to rebuild epdfinfo I answered 'y', the compilation succeeded and now everything is working again. Thanks!

Binjian commented 6 months ago

The build seems to have failed again on my mbp m3/Sonoma 14.4.1/Emacs 30.0.5. It complained not to find poppler. I double checked, the commit was there, pinned by doom emacs.

After I append another pkg_config path like this

export PKG_CONFIG_PATH="${PKG_CONFIG_PATH}:...:$(brew --prefix poppler)/lib/pkgconfig/"

The compiling succeeded. But the epdfinfo will quit, restart and keep crashing when a pdf file is opened and the buffer just show the gibberish unicode. I think epdfinfo is just having the wrong library.

Somehow I came across this old issue on homebrew. I'm not sure if it's relevant. https://github.com/Homebrew/homebrew-core/issues/67950

gusgustavsohn commented 6 months ago

@mikaelspringer I'm facing a rather similar issue but reinstalling doesn't seem to do the trick, unlike what happened in your case. I'm curious: when you say that your reinstallation succeeded, did it show any warnings? My installs do succeed but I receive 2 warnings and I'm trying to determine if that could be the cause of pdf-tools not working for me. Thanks in advance for all your help.

scbagby commented 6 months ago

In MacOS 14.4.1, with pdf-tools (20240429.407) installed and loaded via

(use-package pdf-tools :ensure t :init (pdf-tools-install))

I'm also seeing two warnings

epdfinfo.c:354:19: warning: 'tempnam' is deprecated: This function is provided for compatibility reasons only. Due to security concerns inherent in the design of tempnam(3), it is highly recommended that you use mkstemp(3) instead. [-Wdeprecated-declarations] filename = tempnam(NULL, "epdfinfo");

epdfinfo.c:1576:5: warning: 'poppler_page_get_selection_region' is deprecated: Use poppler_page_get_selected_region instead [-Wdeprecated-declarations] poppler_page_get_selection_region (page, 1.0, selection_style, region); ^

when epdfinfo re-builds on launching Emacs and then a crash ("The epdfinfo server quit, restart it ?"). I've had no luck with uninstalling and reinstalling pdf-tools via MELPA.

Ethanlinyf commented 3 months ago

Still has the error, see below for your reference @vedang

./configure -q --bindir=/Users/ethanlin/.emacs.d/elpa/pdf-tools-20240429.407/ && make clean && make -s configure: error: Package requirements (glib-2.0) were not met:

Package 'libpcre2-8', required by 'glib-2.0', not found

Consider adjusting the PKG_CONFIG_PATH environment variable if you installed software in a non-standard prefix.

Alternatively, you may set the environment variables glib_CFLAGS and glib_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details.

- Build failed. ;o(

Note: maybe try the '-d' option.

Comint exited abnormally with code 1 at Sun Aug 11 18:04:42