baskerville / plato

Document reader
Other
1.26k stars 104 forks source link

[question] emulator does not build #194

Open skinkie opened 3 years ago

skinkie commented 3 years ago

I am trying to run the emulator to see if I can contribute to the project. I am running on Gentoo Linux. I have changed mupdf-third to mupdf, because linking failed. After running run-emulator.sh I now get an ocean of errors starting with the log below.

I have installed:

  = note: /usr/lib/gcc/x86_64-pc-linux-gnu/11.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: /mnt/storage/home/skinkie/Sources/plato/target/debug/deps/plato_emulator-78b8d5fa155c8685.20nzl4pt4sxc12if.rcgu.o: in function `plato_emulator::font::font_data_from_script':
          /mnt/storage/home/skinkie/Sources/plato/src/font/mod.rs:880: undefined reference to `_binary_resources_fonts_droid_DroidSansFallback_ttf_start'
          /usr/lib/gcc/x86_64-pc-linux-gnu/11.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: /mnt/storage/home/skinkie/Sources/plato/src/font/mod.rs:746: undefined reference to `_binary_resources_fonts_droid_DroidSansFallback_ttf_start'
          /usr/lib/gcc/x86_64-pc-linux-gnu/11.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: /mnt/storage/home/skinkie/Sources/plato/src/font/mod.rs:748: undefined reference to `_binary_resources_fonts_noto_NotoNaskhArabic_Regular_ttf_start'
          /usr/lib/gcc/x86_64-pc-linux-gnu/11.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: /mnt/storage/home/skinkie/Sources/plato/src/font/mod.rs:749: undefined reference to `_binary_resources_fonts_noto_NotoSansSyriac_Regular_otf_start'
          /usr/lib/gcc/x86_64-pc-linux-gnu/11.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: /mnt/storage/home/skinkie/Sources/plato/src/font/mod.rs:751: undefined reference to `_binary_resources_fonts_noto_NotoSansMeroitic_Regular_otf_start'
          /usr/lib/gcc/x86_64-pc-linux-gnu/11.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: /mnt/storage/home/skinkie/Sources/plato/src/font/mod.rs:753: undefined reference to `_binary_resources_fonts_noto_NotoSansAdlam_Regular_otf_start'
          /usr/lib/gcc/x86_64-pc-linux-gnu/11.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: /mnt/storage/home/skinkie/Sources/plato/src/font/mod.rs:754: undefined reference to `_binary_resources_fonts_noto_NotoSerifAhom_Regular_otf_start'
          /usr/lib/gcc/x86_64-pc-linux-gnu/11.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: /mnt/storage/home/skinkie/Sources/plato/src/font/mod.rs:755: undefined reference to `_binary_resources_fonts_noto_NotoSansAnatolianHieroglyphs_Regular_otf_start'

After which I went through the thirdparty still, where the mupdf build fails on not having lcms2mt.h. (LCMS2 is installed) I mitigated this by changing the -DLCMS2MT, but then found an issue with ft2build.h

Maybe the most trivial question: how would one build the emulator?

baskerville commented 3 years ago

I have changed mupdf-third to mupdf, because linking failed.

There's no libmupdf-third in the mupdf-gl package?

After running run-emulator.sh I now get an ocean of errors starting with the log below.

I have installed:

  • media-fonts/droid.

You don't need to install the Droid fonts: there are embedded in libmupdf.

  • mupdf-gl version 1.18.0
  = note: /usr/lib/gcc/x86_64-pc-linux-gnu/11.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: /mnt/storage/home/skinkie/Sources/plato/target/debug/deps/plato_emulator-78b8d5fa155c8685.20nzl4pt4sxc12if.rcgu.o: in function `plato_emulator::font::font_data_from_script':
          /mnt/storage/home/skinkie/Sources/plato/src/font/mod.rs:880: undefined reference to `_binary_resources_fonts_droid_DroidSansFallback_ttf_start'
          /usr/lib/gcc/x86_64-pc-linux-gnu/11.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: /mnt/storage/home/skinkie/Sources/plato/src/font/mod.rs:746: undefined reference to `_binary_resources_fonts_droid_DroidSansFallback_ttf_start'
          /usr/lib/gcc/x86_64-pc-linux-gnu/11.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: /mnt/storage/home/skinkie/Sources/plato/src/font/mod.rs:748: undefined reference to `_binary_resources_fonts_noto_NotoNaskhArabic_Regular_ttf_start'
          /usr/lib/gcc/x86_64-pc-linux-gnu/11.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: /mnt/storage/home/skinkie/Sources/plato/src/font/mod.rs:749: undefined reference to `_binary_resources_fonts_noto_NotoSansSyriac_Regular_otf_start'
          /usr/lib/gcc/x86_64-pc-linux-gnu/11.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: /mnt/storage/home/skinkie/Sources/plato/src/font/mod.rs:751: undefined reference to `_binary_resources_fonts_noto_NotoSansMeroitic_Regular_otf_start'
          /usr/lib/gcc/x86_64-pc-linux-gnu/11.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: /mnt/storage/home/skinkie/Sources/plato/src/font/mod.rs:753: undefined reference to `_binary_resources_fonts_noto_NotoSansAdlam_Regular_otf_start'
          /usr/lib/gcc/x86_64-pc-linux-gnu/11.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: /mnt/storage/home/skinkie/Sources/plato/src/font/mod.rs:754: undefined reference to `_binary_resources_fonts_noto_NotoSerifAhom_Regular_otf_start'
          /usr/lib/gcc/x86_64-pc-linux-gnu/11.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: /mnt/storage/home/skinkie/Sources/plato/src/font/mod.rs:755: undefined reference to `_binary_resources_fonts_noto_NotoSansAnatolianHieroglyphs_Regular_otf_start'

The font symbols should be in libmupdf. What's the output of nm /path/to/libmupdf | grep Droid?

After which I went through the thirdparty still, where the mupdf build fails on not having lcms2mt.h. (LCMS2 is installed) I mitigated this by changing the -DLCMS2MT, but then found an issue with ft2build.h

All the third party dependencies (including MuPDF's custom version of LCMS2) are normally in libmupdf-third.

Maybe the most trivial question: how would one build the emulator?

Running it builds it first (if necessary), so you'd normally be fine with just: ./run-emulator.sh.

skinkie commented 3 years ago

There is no libmupdf-third is what Gentoo installs.

lrwxrwxrwx 1 root root       18 Apr 29 20:59 /usr/lib64/libmupdf.so -> libmupdf.so.1.18.0
-rwxr-xr-x 1 root root 48283568 Apr 29 20:59 /usr/lib64/libmupdf.so.1.18.0

When I check what is is the build folder, it is only libmupdf.so.1.18.0

nm /usr/lib64/libmupdf.so | grep Droid
nm: /usr/lib64/libmupdf.so: no symbols

After not stripping symbols;

nm /usr/lib64/libmupdf.so | grep Droid
0000000001fcea40 R _binary_DroidSansFallbackFull_ttf
0000000002e0ad30 D _binary_DroidSansFallbackFull_ttf_size
0000000001c6a660 R _binary_DroidSansFallback_ttf
0000000002e0ad2c D _binary_DroidSansFallback_ttf_size
lunasophia commented 3 months ago

I did a bunch of digging in this and found that mupdf no longer ships libmupdf-third.so and haven't done for almost three years, shortly before this ticket was filed. Beyond that, the emulator has a runtime dependency on the very specific version of the vendor mupdf package, which will only cause headaches--especially for rapidly updating distros like Gentoo and Arch (which I use btw). Would you accept a patch to remove the outdated libmupdf-third linking and (potentially a separate one) for eliminating the runtime version locking?

I'm quite interested in helping out with this project, and getting the emulator to work is the very clearly the first step for that :)