baskerville / plato

Document reader
Other
1.26k stars 105 forks source link

`install-importer.sh`: `undefined reference to `jbig2_ctx_new'` #249

Closed rien333 closed 2 years ago

rien333 commented 2 years ago

Trying to install plato-import by running install-importer.sh. However, I keep getting the following error:

= note: /usr/bin/ld: src/mupdf_wrapper/Linux/libmupdf_wrapper.a(mupdf_wrapper.o):in function 
mp_page_number_from_location':
          mupdf_wrapper.c:(.text+0x30b): undefined reference to `fz_page_number_from_location'
          /usr/bin/ld: /usr/lib/libmupdf.so: undefined reference to `jbig2_ctx_new'
          collect2: error: ld returned 1 exit status

  = help: some `extern` functions couldn't be found; some native libraries may needto be installed or have their path specified
  = note: use the `-l` flag to specify native libraries to link
  = note: use the `cargo:rustc-link-lib` directive to specify the native libraries to link with Cargo (see https://doc.rust-lang.org/cargo/reference/build-scripts.html#cargorustc-link-libkindname)

warning: `plato` (bin "plato-import") generated 301 warnings
error: could not compile `plato` due to previous error; 301 warnings emitted
error: failed to compile `plato v0.9.29 (/home/rw/Devil/plato-0.9.29/plato-0.9.29)`, intermediate artifacts can be found at `/home/rw/Devil/plato-0.9.29/plato-0.9.29/target`

I'm using arch linux, with libmupdf 1.20.0.

baskerville commented 2 years ago

Remove the already built wrapper library (rm -rf src/mupdf_wrapper/Linux) and try again.

rien333 commented 2 years ago

Thanks! Didn't work unfortunately. In fact, I also tried working from a fresh copy of the 0.9.29 release, but that ultimately gives the same linking errors.

baskerville commented 2 years ago

Could you try this patch:

diff --git a/build.rs b/build.rs
index e65a1d9..a9c17ef 100644
--- a/build.rs
+++ b/build.rs
@@ -33,5 +33,6 @@ fn main() {
         }

         println!("cargo:rustc-link-lib=mupdf-third");
+        println!("cargo:rustc-link-lib=mupdf");
     }
 }
rien333 commented 2 years ago

Same errors. If nobody can reproduce this, it may be something weird with my environment (though I really don't mess with rust and mupdf, and this all was building fine a few months ago)

Here's a slightly larger part of my log, including the incredibly long linker invocation:

plato-0.9.29> ./install-importer.sh # build

...

warning: associated function is never used: `new`
  --> src/lightsensor/kobo.rs:13:12
   |
13 |     pub fn new() -> Result<Self, Error> {
   |            ^^^

error: linking with `cc` failed: exit status: 1
  |
  = note: "cc" "-m64" "/tmp/rustc9CGO4i/symbols.o" "/home/rw/Devil/plato-0.9.29/target/release/deps/plato_import-d4f95c7f894ef3b6.plato_import.df87fe3d-cgu.0.rcgu.o" "/home/rw/Devil/plato-0.9.29/target/release/deps/plato_import-d4f95c7f894ef3b6.plato_import.df87fe3d-cgu.1.rcgu.o" "/home/rw/Devil/plato-0.9.29/target/release/deps/plato_import-d4f95c7f894ef3b6.plato_import.df87fe3d-cgu.10.rcgu.o" "/home/rw/Devil/plato-0.9.29/target/release/deps/plato_import-d4f95c7f894ef3b6.plato_import.df87fe3d-cgu.11.rcgu.o" "/home/rw/Devil/plato-0.9.29/target/release/deps/plato_import-d4f95c7f894ef3b6.plato_import.df87fe3d-cgu.12.rcgu.o" "/home/rw/Devil/plato-0.9.29/target/release/deps/plato_import-d4f95c7f894ef3b6.plato_import.df87fe3d-cgu.13.rcgu.o" "/home/rw/Devil/plato-0.9.29/target/release/deps/plato_import-d4f95c7f894ef3b6.plato_import.df87fe3d-cgu.14.rcgu.o" "/home/rw/Devil/plato-0.9.29/target/release/deps/plato_import-d4f95c7f894ef3b6.plato_import.df87fe3d-cgu.15.rcgu.o" "/home/rw/Devil/plato-0.9.29/target/release/deps/plato_import-d4f95c7f894ef3b6.plato_import.df87fe3d-cgu.2.rcgu.o" "/home/rw/Devil/plato-0.9.29/target/release/deps/plato_import-d4f95c7f894ef3b6.plato_import.df87fe3d-cgu.3.rcgu.o" "/home/rw/Devil/plato-0.9.29/target/release/deps/plato_import-d4f95c7f894ef3b6.plato_import.df87fe3d-cgu.4.rcgu.o" "/home/rw/Devil/plato-0.9.29/target/release/deps/plato_import-d4f95c7f894ef3b6.plato_import.df87fe3d-cgu.5.rcgu.o" "/home/rw/Devil/plato-0.9.29/target/release/deps/plato_import-d4f95c7f894ef3b6.plato_import.df87fe3d-cgu.6.rcgu.o" "/home/rw/Devil/plato-0.9.29/target/release/deps/plato_import-d4f95c7f894ef3b6.plato_import.df87fe3d-cgu.7.rcgu.o" "/home/rw/Devil/plato-0.9.29/target/release/deps/plato_import-d4f95c7f894ef3b6.plato_import.df87fe3d-cgu.8.rcgu.o" "/home/rw/Devil/plato-0.9.29/target/release/deps/plato_import-d4f95c7f894ef3b6.plato_import.df87fe3d-cgu.9.rcgu.o" "/home/rw/Devil/plato-0.9.29/target/release/deps/plato_import-d4f95c7f894ef3b6.v1u4fz8rzpi3fei.rcgu.o" "-Wl,--as-needed" "-L" "/home/rw/Devil/plato-0.9.29/target/release/deps" "-L" "src/mupdf_wrapper/Linux" "-L" "/usr/lib" "-L" "/home/rw/Devil/plato-0.9.29/target/release/build/zstd-sys-0815b2fa69a81396/out" "-L" "/home/rw/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-lharfbuzz" "-lfreetype" "-ldjvulibre" "-Wl,-Bstatic" "-lmupdf_wrapper" "-Wl,-Bdynamic" "-lstdc++" "-lmupdf-third" "-lmupdf" "-Wl,-Bstatic" "/home/rw/Devil/plato-0.9.29/target/release/deps/libtoml-ceab19e414c24965.rlib" "/home/rw/Devil/plato-0.9.29/target/release/deps/libserde_json-e86fe5e3eb97e849.rlib" "/home/rw/Devil/plato-0.9.29/target/release/deps/libryu-f41a15f237cf3b0c.rlib" "/home/rw/Devil/plato-0.9.29/target/release/deps/libpng-a11feaeef78e21f9.rlib" "/home/rw/Devil/plato-0.9.29/target/release/deps/libdeflate-0702c14ff53b2414.rlib" "/home/rw/Devil/plato-0.9.29/target/release/deps/libadler32-0f2c4fae8b9881d1.rlib" "/home/rw/Devil/plato-0.9.29/target/release/deps/libgetopts-40ecf73dd3c9c205.rlib" "/home/rw/Devil/plato-0.9.29/target/release/deps/libunicode_width-c420ccdeb5fd199d.rlib" "/home/rw/Devil/plato-0.9.29/target/release/deps/libtitlecase-983dec1703cea8e8.rlib" "/home/rw/Devil/plato-0.9.29/target/release/deps/libfiletime-10cb97695b565446.rlib" "/home/rw/Devil/plato-0.9.29/target/release/deps/libindexmap-d3158bfdb946c03f.rlib" "/home/rw/Devil/plato-0.9.29/target/release/deps/libhashbrown-7a5f505bd8d2c70c.rlib" "/home/rw/Devil/plato-0.9.29/target/release/deps/libunicode_normalization-a9f98782012545f6.rlib" "/home/rw/Devil/plato-0.9.29/target/release/deps/libtinyvec-72620f2b457afb0c.rlib" "/home/rw/Devil/plato-0.9.29/target/release/deps/libtinyvec_macros-8a463b7dd2d24897.rlib" "/home/rw/Devil/plato-0.9.29/target/release/deps/libseptem-d016fc4f47310915.rlib" "/home/rw/Devil/plato-0.9.29/target/release/deps/libxi_unicode-26fafbc9721d1d99.rlib" "/home/rw/Devil/plato-0.9.29/target/release/deps/libparagraph_breaker-1e68417a6dd91fe2.rlib" "/home/rw/Devil/plato-0.9.29/target/release/deps/libkl_hyphenate-5ee2714b6c2bc0b8.rlib" "/home/rw/Devil/plato-0.9.29/target/release/deps/libkl_hyphenate_commons-d86e36199e413e14.rlib" "/home/rw/Devil/plato-0.9.29/target/release/deps/libbincode-6c3e5d8e336622f8.rlib" "/home/rw/Devil/plato-0.9.29/target/release/deps/libatlatl-68c728197e2abac3.rlib" "/home/rw/Devil/plato-0.9.29/target/release/deps/libpercent_encoding-6d3ae098e9ff20d8.rlib" "/home/rw/Devil/plato-0.9.29/target/release/deps/libzip-3e230692a9e0cb7b.rlib" "/home/rw/Devil/plato-0.9.29/target/release/deps/libpbkdf2-d5b0198a2afcf08d.rlib" "/home/rw/Devil/plato-0.9.29/target/release/deps/libsha2-531e6ac33d4c6c75.rlib" "/home/rw/Devil/plato-0.9.29/target/release/deps/libpassword_hash-6aba238054ca372d.rlib" "/home/rw/Devil/plato-0.9.29/target/release/deps/libbase64ct-508389fcb69c4654.rlib" "/home/rw/Devil/plato-0.9.29/target/release/deps/librand_core-7c2661ca946d06f0.rlib" "/home/rw/Devil/plato-0.9.29/target/release/deps/libtime-32f9a2c0a9e123f7.rlib" "/home/rw/Devil/plato-0.9.29/target/release/deps/libitoa-f5762eaa3bbe4bb3.rlib" "/home/rw/Devil/plato-0.9.29/target/release/deps/libzstd-60f22d91ecbae4fe.rlib" "/home/rw/Devil/plato-0.9.29/target/release/deps/libzstd_safe-47f98d301438fc47.rlib" "/home/rw/Devil/plato-0.9.29/target/release/deps/libzstd_sys-338c609966ecdbb8.rlib" "/home/rw/Devil/plato-0.9.29/target/release/deps/libbzip2-aae6bd73a17aec1c.rlib" "/home/rw/Devil/plato-0.9.29/target/release/deps/libbzip2_sys-c710faa7cff00c55.rlib" "/home/rw/Devil/plato-0.9.29/target/release/deps/libflate2-264395f80c809029.rlib" "/home/rw/Devil/plato-0.9.29/target/release/deps/libminiz_oxide-6018b38b77306acc.rlib" "/home/rw/Devil/plato-0.9.29/target/release/deps/libadler-93a3aafa08255620.rlib" "/home/rw/Devil/plato-0.9.29/target/release/deps/libcrc32fast-d3deb61882f3577f.rlib" "/home/rw/Devil/plato-0.9.29/target/release/deps/libaes-025cbadb3c3a1f24.rlib" "/home/rw/Devil/plato-0.9.29/target/release/deps/libopaque_debug-30bca6372ba015ab.rlib" "/home/rw/Devil/plato-0.9.29/target/release/deps/libcipher-3476cec93f1f84b4.rlib" "/home/rw/Devil/plato-0.9.29/target/release/deps/libsha1-5c06f9c30a206f4c.rlib" "/home/rw/Devil/plato-0.9.29/target/release/deps/libcpufeatures-8fe634dad9fe1a55.rlib" "/home/rw/Devil/plato-0.9.29/target/release/deps/libhmac-5dec12300c979571.rlib" "/home/rw/Devil/plato-0.9.29/target/release/deps/libdigest-ce787a99cd62d306.rlib" "/home/rw/Devil/plato-0.9.29/target/release/deps/libsubtle-914dc0bf21736fb8.rlib" "/home/rw/Devil/plato-0.9.29/target/release/deps/libblock_buffer-6f2cceb5db396d94.rlib" "/home/rw/Devil/plato-0.9.29/target/release/deps/libcrypto_common-27ac4f28f42c661f.rlib" "/home/rw/Devil/plato-0.9.29/target/release/deps/libgeneric_array-380113ddaa7e8d8f.rlib" "/home/rw/Devil/plato-0.9.29/target/release/deps/libtypenum-7c26863d84f6e6dc.rlib" "/home/rw/Devil/plato-0.9.29/target/release/deps/libconstant_time_eq-8e60ecc7bd8952a4.rlib" "/home/rw/Devil/plato-0.9.29/target/release/deps/libglobset-dfe9710aad6b1d83.rlib" "/home/rw/Devil/plato-0.9.29/target/release/deps/libfnv-5936c05eecc82550.rlib" "/home/rw/Devil/plato-0.9.29/target/release/deps/liblog-73f4a2913a03a7e2.rlib" "/home/rw/Devil/plato-0.9.29/target/release/deps/libregex-f1a06dc3dddbf7b4.rlib" "/home/rw/Devil/plato-0.9.29/target/release/deps/libregex_syntax-337cfc13a046dc2c.rlib" "/home/rw/Devil/plato-0.9.29/target/release/deps/libbstr-729701355b9f4c37.rlib" "/home/rw/Devil/plato-0.9.29/target/release/deps/libaho_corasick-c0eef6fa9f7df825.rlib" "/home/rw/Devil/plato-0.9.29/target/release/deps/libmemchr-82ac28409f03df8b.rlib" "/home/rw/Devil/plato-0.9.29/target/release/deps/libthiserror-ddbd8a89dba5603d.rlib" "/home/rw/Devil/plato-0.9.29/target/release/deps/libchrono-3016721ca2b519c6.rlib" "/home/rw/Devil/plato-0.9.29/target/release/deps/libnum_integer-c455c45adf381a50.rlib" "/home/rw/Devil/plato-0.9.29/target/release/deps/libnum_traits-63e76c090888898b.rlib" "/home/rw/Devil/plato-0.9.29/target/release/deps/libtime-42d0b0da50718f31.rlib" "/home/rw/Devil/plato-0.9.29/target/release/deps/libwalkdir-402bdb8466aa73e8.rlib" "/home/rw/Devil/plato-0.9.29/target/release/deps/libsame_file-664eb96295c7334d.rlib" "/home/rw/Devil/plato-0.9.29/target/release/deps/libentities-60e4fc1606e0da02.rlib" "/home/rw/Devil/plato-0.9.29/target/release/deps/libnix-8ae97d3e4492fc01.rlib" "/home/rw/Devil/plato-0.9.29/target/release/deps/libmemoffset-b6667f27ce16838c.rlib" "/home/rw/Devil/plato-0.9.29/target/release/deps/libbitflags-d4b6a1deff53cdce.rlib" "/home/rw/Devil/plato-0.9.29/target/release/deps/libcfg_if-ae9304d0b4aa9b61.rlib" "/home/rw/Devil/plato-0.9.29/target/release/deps/liblibc-6fce902828354ed3.rlib" "/home/rw/Devil/plato-0.9.29/target/release/deps/libanyhow-4a2af6bbff1dbb5b.rlib" "/home/rw/Devil/plato-0.9.29/target/release/deps/libfxhash-51c245b79c20fa85.rlib" "/home/rw/Devil/plato-0.9.29/target/release/deps/libbyteorder-b6900773a2c3119e.rlib" "/home/rw/Devil/plato-0.9.29/target/release/deps/liblazy_static-53863b77cbb23189.rlib" "/home/rw/Devil/plato-0.9.29/target/release/deps/libserde-17ec7ca160a8f1a9.rlib" "-Wl,--start-group" "/home/rw/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd-7ca39ac42651c3df.rlib" "/home/rw/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libpanic_unwind-62c6d032818141a1.rlib" "/home/rw/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libobject-50484fc03eb1eb5b.rlib" "/home/rw/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libmemchr-758be083b246d9c6.rlib" "/home/rw/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libaddr2line-3cdf9a3c68f76e2d.rlib" "/home/rw/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libgimli-3a1b74821c25a0e1.rlib" "/home/rw/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_demangle-e046d82ebd84bb7f.rlib" "/home/rw/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd_detect-a61cdd33cfa8394f.rlib" "/home/rw/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libhashbrown-410c38f8df854235.rlib" "/home/rw/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libminiz_oxide-f79d7458e122215f.rlib" "/home/rw/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libadler-7d24b750ce5b22e8.rlib" "/home/rw/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_std_workspace_alloc-4c2aa1ea3133ab73.rlib" "/home/rw/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libunwind-41220dc85a7f114f.rlib" "/home/rw/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcfg_if-230d004276c898f9.rlib" "/home/rw/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/liblibc-03ae30169a5438be.rlib" "/home/rw/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/liballoc-6f82c44b7818af35.rlib" "/home/rw/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_std_workspace_core-1a0b7681f7efa789.rlib" "/home/rw/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcore-83735dd4dae9b02c.rlib" "-Wl,--end-group" "/home/rw/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcompiler_builtins-385029872275478f.rlib" "-Wl,-Bdynamic" "-lbz2" "-lgcc_s" "-lutil" "-lrt" "-lpthread" "-lm" "-ldl" "-lc" "-Wl,--eh-frame-hdr" "-Wl,-znoexecstack" "-L" "/home/rw/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-o" "/home/rw/Devil/plato-0.9.29/target/release/deps/plato_import-d4f95c7f894ef3b6" "-Wl,--gc-sections" "-pie" "-Wl,-zrelro,-znow" "-Wl,-O1" "-nodefaultlibs"
  = note: /usr/bin/ld: src/mupdf_wrapper/Linux/libmupdf_wrapper.a(mupdf_wrapper.o): in function `mp_page_number_from_location':
          mupdf_wrapper.c:(.text+0x30b): undefined reference to `fz_page_number_from_location'
          /usr/bin/ld: /usr/lib/libmupdf.so: undefined reference to `jbig2_ctx_new'
          collect2: error: ld returned 1 exit status

  = help: some `extern` functions couldn't be found; some native libraries may need to be installed or have their path specified
  = note: use the `-l` flag to specify native libraries to link
  = note: use the `cargo:rustc-link-lib` directive to specify the native libraries to link with Cargo (see https://doc.rust-lang.org/cargo/reference/build-scripts.html#cargorustc-link-libkindname)

warning: `plato` (bin "plato-import") generated 301 warnings
error: could not compile `plato` due to previous error; 301 warnings emitted
error: failed to compile `plato v0.9.29 (/home/rw/Devil/plato-0.9.29)`, intermediate artifacts can be found at `/home/rw/Devil/plato-0.9.29/target`
rien333 commented 2 years ago

EDIT @baskerville

Okay, I had an old libmupdf.so somewhere (my bad), that was part of the problem. However, I'm getting a bunch of other linker errors now. In particular, I get

 /usr/bin/ld: /usr/lib/libfreetype.so: undefined reference to symbol 'inflateInit2_'
          /usr/bin/ld: /usr/lib/libz.so.1: error adding symbols: DSO missing from command line

If I then add println!("cargo:rustc-link-lib=z"); to build.rs that removes aforementioned linker errors, but creates new ones. In the end, after adding a bunch more of seemingly necessary linking flags, I can't avoid linking errors related to mupdf:

 note: /usr/bin/ld: /usr/lib/libmupdf.a(pdf-js.o): in function `field_finalize':
          (.text.field_finalize+0xa): undefined reference to `js_getcontext'
          /usr/bin/ld: /usr/lib/libmupdf.a(pdf-js.o): in function `pdf_drop_js':
          (.text.pdf_drop_js+0x32): undefined reference to `js_freestate'
          /usr/bin/ld: /usr/lib/libmupdf.a(pdf-js.o): in function `pdf_js_event_init':
          (.text.pdf_js_event_init+0x30): undefined reference to `js_getglobal'
...

This is with the following added to my build.rs:

        println!("cargo:rustc-link-lib=mupdf-third");
        println!("cargo:rustc-link-lib=mupdf");
        println!("cargo:rustc-link-lib=z");
        println!("cargo:rustc-link-lib=jpeg");
        println!("cargo:rustc-link-lib=gumbo");
        println!("cargo:rustc-link-lib=openjp2");
        println!("cargo:rustc-link-lib=jbig2dec");

Trying to build by way of the docker route right now (not my preferred method tbh), but that also fails. Any hope of just providing plato-import as a pre-build binary somewhere, as also requested in https://github.com/baskerville/plato/issues/58?

Probably should open a new issue, but here's the docker log (note that it fails somewhere in the third step ).

Docker log ``` Removing intermediate container 0972d09497eb ---> b38470975ca1 Step 3/7 : RUN echo "deb http://deb.debian.org/debian testing main" > /etc/apt/sources.list && apt-get update && apt-get install -y mupdf libmupdf-dev ---> Running in cac2ff0da437 Get:1 http://deb.debian.org/debian testing InRelease [130 kB] Get:2 http://deb.debian.org/debian testing/main amd64 Packages [8532 kB] Fetched 8662 kB in 3s (2836 kB/s) Reading package lists... ... (some info omitted) Fetched 139 MB in 33s (4179 kB/s) Selecting previously unselected package gcc-12-base:amd64. (Reading database ... 26555 files and directories currently installed.) Preparing to unpack .../gcc-12-base_12.1.0-5_amd64.deb ... Unpacking gcc-12-base:amd64 (12.1.0-5) ... Setting up gcc-12-base:amd64 (12.1.0-5) ... Selecting previously unselected package libgcc-s1:amd64. (Reading database ... 26560 files and directories currently installed.) Preparing to unpack .../libgcc-s1_12.1.0-5_amd64.deb ... Unpacking libgcc-s1:amd64 (12.1.0-5) ... Replacing files in old package libgcc1:amd64 (1:8.3.0-6) ... Setting up libgcc-s1:amd64 (12.1.0-5) ... (Reading database ... 26562 files and directories currently installed.) Preparing to unpack .../g++_4%3a11.2.0-2_amd64.deb ... Unpacking g++ (4:11.2.0-2) over (4:8.3.0-1) ... (Reading database ... 26562 files and directories currently installed.) Removing g++-8 (8.3.0-6) ... dpkg: gcc-8: dependency problems, but removing anyway as you requested: gcc depends on gcc-8 (>= 8.3.0-1~). Removing gcc-8 (8.3.0-6) ... dpkg: libgcc-8-dev:amd64: dependency problems, but removing anyway as you requested: libstdc++-8-dev:amd64 depends on libgcc-8-dev (= 8.3.0-6). Removing libgcc-8-dev:amd64 (8.3.0-6) ... (Reading database ... 26350 files and directories currently installed.) Preparing to unpack .../libc6_2.33-7_amd64.deb ... debconf: unable to initialize frontend: Dialog debconf: (TERM is not set, so the dialog frontend is not usable.) debconf: falling back to frontend: Readline Checking for services that may need to be restarted... Checking init scripts... Unpacking libc6:amd64 (2.33-7) over (2.28-10+deb10u1) ... Setting up libc6:amd64 (2.33-7) ... /usr/bin/perl: error while loading shared libraries: libcrypt.so.1: cannot open shared object file: No such file or directory dpkg: error processing package libc6:amd64 (--configure): installed libc6:amd64 package post-installation script subprocess returned error exit status 127 Errors were encountered while processing: libc6:amd64 E: Sub-process /usr/bin/dpkg returned an error code (1) ```
rien333 commented 2 years ago

Nice! I got it. With the following patch, plato-import finally builds. Not sure if all lines are necessary.

diff --git a/build.rs b/build.rs
index e65a1d9..0bbda70 100644
--- a/build.rs
+++ b/build.rs
@@ -32,6 +32,15 @@ fn main() {
             _ => panic!("Unsupported platform: {}.", target_os),
         }

+        println!("cargo:rustc-link-lib=mupdf");
+        println!("cargo:rustc-link-lib=jbig2dec");
+        println!("cargo:rustc-link-lib=jpeg");
+        println!("cargo:rustc-link-lib=z");
+        println!("cargo:rustc-link-lib=m");
+        println!("cargo:rustc-link-lib=freetype");
+        println!("cargo:rustc-link-lib=png16");
         println!("cargo:rustc-link-lib=mupdf-third");
+        println!("cargo:rustc-link-lib=gumbo");
+        println!("cargo:rustc-link-lib=openjp2");
     }
 }