vedang / pdf-tools

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

`pdf-tools-install` failed #250

Closed zealotrush closed 3 months ago

zealotrush commented 6 months ago

Describe the bug pdf-tools-install failed due to package poppler not found.

Steps to Reproduce the behaviour Steps to reproduce the behaviour:

  1. Start Emacs: emacs -Q.
  2. Clone pdf-tools: git clone git@github.com:vedang/pdf-tools.git /tmp/pdf-tools.
  3. Load pdf-tools: (add-to-list 'load-path "/tmp/pdf-tools/lisp"), (require 'pdf-tools).
  4. Install epdfinfo: M-x pdf-tools-install and press y.

What is the expected behaviour? epdfinfo should be installed successfully.

Desktop Please complete the following information:

Your pdf-tools install Please complete the following information:

Installed via github with the latest version. No customization.

Additional context

The *compilation* buffer content:

Expand ``` -*- mode: compilation; default-directory: "/tmp/pdf-tools/server/" -*- Comint started at Wed Jan 3 08:26:10 /tmp/pdf-tools/server/autobuild -i /tmp/pdf-tools/lisp/ --------------------------- Installing packages --------------------------- brew install pkg-config poppler autoconf automake Warning: pkg-config 0.29.2_3 is already installed and up-to-date. To reinstall 0.29.2_3, run: brew reinstall pkg-config Warning: poppler 23.12.0 is already installed and up-to-date. To reinstall 23.12.0, run: brew reinstall poppler Warning: autoconf 2.72 is already installed and up-to-date. To reinstall 2.72, run: brew reinstall autoconf Warning: automake 1.16.5 is already installed and up-to-date. To reinstall 1.16.5, run: brew reinstall automake --------------------------- Configuring and compiling --------------------------- ./configure -q --bindir=/tmp/pdf-tools/lisp/ && make clean && make -s configure: error: Package requirements (poppler) were not met: No package 'poppler' 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 poppler_CFLAGS and poppler_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 Wed Jan 3 08:26:12, duration 1.97 s ```

I've also tried export PKG_CONFIG_PATH=/opt/homebrew/Cellar/poppler/23.12.0/lib/pkgconfig manually. In this case, epdfinfo can be compiled successfully. But when I open any PDF file with pdf-tools, it says "The epdfinfo server quit, restart it? (y or n)". With y, it repeats this error message indefinitely. With n, nothing happens, and the PDF file is still displayed as scrambled.

cilinder commented 6 months ago

I was having the same issue on Ubuntu 22.04. What worked for me was running the command from the terminal directly instead of from emacs:

~/.emacs.d/elpa/pdf-tools-20230611.239/build/server/autobuild -i ~/.emacs.d/elpa/pdf-tools-20230611.239/

The exact location of the package depends on where you installed it and where emacs is installed. I got the location from the error message.

zealotrush commented 6 months ago

@cilinder Thank you for the information. I have tried the similar method as following.

~/.config/emacs/elpaca/builds/pdf-tools/server/autobuild -i ~/.config/emacs/elpaca/builds/pdf-tools/

However, it still produces the same error as shown in my post above. Adding export PKG_CONFIG_PATH=xxx doesn't work either, for the same reason mentioned above.

paskn commented 6 months ago

Can confirm. epdfinfo fails to render a pdf.

❯ pkg-config --libs poppler
-L/opt/homebrew/Cellar/poppler/24.01.0/lib -lpoppler
❯ ../pdf-tools/build/server/autobuild
....
2 warnings generated.
ld: warning: ignoring duplicate libraries: '-lglib-2.0', '-lintl'

===========================
   Build succeeded. :O)    
===========================
zealotrush commented 6 months ago

@paskn I upgraded poppler to version 24.01.0, just like yours. Plus, I made some tweaks as below to successfully compile it.

export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
export DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:/usr/local/lib/

Now, pdf-tools-install succeeded. However, when I open a random PDF file, it still only shows garbled symbols, somewhat like following:

%PDF-1.5
%\314\325\301\324\305\330\320\304\306
...
paskn commented 6 months ago

@zealotrush It is not working for me either. That is what I was trying to say above but failed :)

brosasaki commented 5 months ago

@zealotrush 's method works for me and delivers unscrambled PDFs on macOS 12.6.8 after running brew upgrade. I c/ped the export commands into the shell, then ran the autobuild script just as pdf-tools-install attempts to. This still needs a fix, though

vedang commented 3 months ago

I've fixed a similar problem via https://github.com/vedang/pdf-tools/issues/269 . Please update to the latest version of pdf-tools from Melpa (check a few hours after this comment's timestamp) and try installing again.

gusgustavsohn commented 2 months ago

I'm still experiencing this, using poppler 24.04.0 and pdf-tools version 20240411.1703. PDFs are shown as garbled text and I get the message: "File mode specification error: (wrong-type-argument stringp number-or-marker-p)".

Anyone else experiencing this symptom? Thanks for your help.