manubot / rootstock

Clone me to create your Manubot manuscript
https://manubot.github.io/rootstock/
Other
453 stars 178 forks source link

Supporting local Windows weasyprint builds #406

Open agitter opened 3 years ago

agitter commented 3 years ago

The Manubot build environment is not currently supported on Windows. However, the main limitation was previously the pango package, and pango now has win-64 support on the conda-forge channel.

The current conda environment cannot be installed on Windows and gives the ResolvePackageNotFound error reported in #405. However, if I unpin the cairo, cairocffi, and pango versions, I am able to install the manubot conda environment. I end up with

bash build/build.sh shows they are still missing dependencies:

OSError: cannot load library 'gobject-2.0': error 0x7e.  Additionally, ctypes.util.find_library() did not manage to locate a library called 'gobject-2.0'

This is related to https://github.com/Kozea/WeasyPrint/issues/971.

I tried conda install -c conda-forge gtk3 and installed version 3.24.24. That did not resolve the error.

It looked like I had the missing DLLs in .conda\envs\manubot\Library\bin but they did not have the expected names. I copied gobject-2.0-0.dll as libgobject-2.0-0.dll, pango-1.0-0.dll as pango-1.0.dll, and pangocairo-1.0-0.dll as pangocairo-1.0.dll. This gave a new error further into the weasyprint build:

(process:11000): GLib-GObject-WARNING **: 08:49:54.950: cannot register existing type 'PangoLayout'
(process:11000): GLib-CRITICAL **: 08:49:54.950: g_once_init_leave: assertion 'result != 0' failed
(process:11000): Pango-CRITICAL **: 08:49:54.950: pango_layout_get_iter: assertion 'PANGO_IS_LAYOUT (layout)' failed
Error producing PDF.

Perhaps local Windows builds with weasyprint are now possible, but I'm not planning to troubleshoot this further at this time.

agitter commented 3 years ago

I confirmed that building the manuscript locally on Windows with Git for Windows does work when Docker is available. This line in the build script https://github.com/manubot/rootstock/blob/2191d929a12a233347ee79c673b8f2971c10e6dd/build/build.sh#L69

needs to be changed to:

    --volume="/$(pwd)/output:/converted/" \

and then bash build/build.sh works as expected.