itsjunetime / tdf

A tui-based PDF viewer
Mozilla Public License 2.0
540 stars 8 forks source link

The system library `poppler-glib` required by crate `poppler-sys-rs` was not found. #8

Closed swarnendubiswas closed 1 month ago

swarnendubiswas commented 3 months ago

I am trying to build tdf on Ubuntu 22.04 LTS and I get the following error.

❯ cargo build --release
  ...
  cargo:rerun-if-env-changed=HOST_PKG_CONFIG_SYSROOT_DIR
  cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR
  cargo:warning=
  pkg-config exited with status code 1
  > PKG_CONFIG_ALLOW_SYSTEM_CFLAGS=1 pkg-config --libs --cflags poppler-glib poppler-glib >= 23.7

  The system library `poppler-glib` required by crate `poppler-sys-rs` was not found.
  The file `poppler-glib.pc` needs to be installed and the PKG_CONFIG_PATH environment variable must contain its parent directory.
  The PKG_CONFIG_PATH environment variable is not set.

  HINT: if you have installed the library, try setting PKG_CONFIG_PATH to the directory containing `poppler-glib.pc`.

  warning: build failed, waiting for other jobs to finish...

I think I have all relevant poppler packages installed. rustc version is 1.75.

br0wnee commented 2 months ago

I had the same issue on my Fedora 40. Solved by installing poppler-glib-devel package. I can see there that there's a similar package for Debian. See if you have that installed

itsjunetime commented 2 months ago

Yes, sorry for not getting to this earlier - @swarnendubiswas I would definitely recommend doing as suggested and installing the libpoppler-glib-devel to see if that fixes it. If that doesn't, would you be able to run apt list --installed | grep poppler and put the output here?

swarnendubiswas commented 2 months ago

I am using Ubuntu 22.04. The related packages are libpoppler-dev and libpoppler-glib-dev. I have installed the other -dev packages as well, just in case.

https://packages.ubuntu.com/search?suite=jammy&searchon=names&keywords=libpoppler

╰─❯ apt search libpoppler-glib-dev
Sorting... Done
Full Text Search... Done
libpoppler-glib-dev/jammy-updates,jammy-security,now 22.02.0-2ubuntu0.5 amd64 [installed]
  PDF rendering library -- development files (GLib interface)

I still get the following error.

  The system library `poppler-glib` required by crate `poppler-sys-rs` was not found.
  The file `poppler-glib.pc` needs to be installed and the PKG_CONFIG_PATH environment variable must contain its parent directory.
  The PKG_CONFIG_PATH environment variable is not set.

  HINT: if you have installed the library, try setting PKG_CONFIG_PATH to the directory containing `poppler-glib.pc`.
itsjunetime commented 2 months ago

Ah - the error says that the PKG_CONFIG_PATH environment variable is not set. This means that something is wrong with your pkg-config installation. Make sure it's installed, and if it already was, try reinstalling and restarting your machine to see if that fixes it.

swarnendubiswas commented 2 months ago

It is possible, but I have the same error on two Ubuntu 22 LTS systems.

tushar1977 commented 2 months ago

It is possible, but I have the same error on two Ubuntu 22 LTS systems.

1) sudo apt-get install libpoppler-glib-dev 2) sudo find /usr -name "poppler-glib.pc" 2) export PKG_CONFIG_PATH="enter path here":$PKG_CONFIG_PATH 3) source ~/.bashrc

try this it will export the path

itsjunetime commented 1 month ago

This is almost definitely an issue on the local machine, and if it's not, it should be filed in either the poppler-rs or system-deps crates' repos.

yyc94 commented 1 week ago

It is possible, but I have the same error on two Ubuntu 22 LTS systems.

r u using WSL? the error occurs in my WSL and I can't solve the problem. But it can run on my Linux pc.

yyc94 commented 1 week ago

I have almost solved the problem. you can edit the Cargo.toml of tdf as below from poppler-rs = {version = "0.24.1", default-features = false, features =["v23_7"]} to poppler-rs = {version = "0.24.1"} It can compile after the modification, but the executable file tdf can not work.

swarnendubiswas commented 1 week ago

It is possible, but I have the same error on two Ubuntu 22 LTS systems.

r u using WSL? the error occurs in my WSL and I can't solve the problem. But it can run on my Linux pc.

No, I am using Linux.

N1lsE commented 1 week ago

I have almost solved the problem. you can edit the Cargo.toml of tdf as below from poppler-rs = {version = "0.24.1", default-features = false, features =["v23_7"]} to poppler-rs = {version = "0.24.1"} It can compile after the modification, but the executable file tdf can not work.

I dug deep into this rabbit hole today, and this worked for me. Thanks! (i am on wsl2) But now the pdf is not displaying correctly. Screenshot 2024-10-18 174040