fathyb / html2svg

Convert HTML and `<canvas>` to SVG, PDF, or images using Chromium

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Building locally fails on MacOS 12, Ubuntu 22.04

davidquintana opened this issue · comments

I've tried building locally (i.e. not using Docker) on both MacOS 12.6.1 and Ubuntu 22.04 and it fails on both during yarn ninja release:

MacOS 12

$ yarn ninja release
yarn run v1.22.19
$ scripts/ninja.sh release
depot_tools/ninja.py: Fallback to a deprecated legacy ninja binary. Note that this ninja binary will be removed soon.
Please install ninja to your project using DEPS. If your project does not have DEPS, Please install ninja in your PATH.
See also https://crbug.com/1340825
ninja: Entering directory `electron/src/out/release'
[2646/46025] ACTION //electron:generate_config_gypi(//build/toolchain/mac:clang_x64)
WARNING: --openssl-no-asm will result in binaries that do not take advantage
         of modern CPU cryptographic instructions and will therefore be slower.
         Please refer to BUILDING.md
WARNING: warnings were emitted in the configure phase
INFO: configure completed successfully
[2895/46025] ACTION //electron:build_electron_definitions(//build/toolchain/mac:clang_x64)
FAILED: gen/electron/tsc/typings/electron.d.ts
python3 ../../electron/build/npm-run.py --silent gn-typescript-definitions -- /Users/jdq/Developer/Projects/qwizy.com/testing/html2svg/electron/src/out/release/gen/electron/tsc/typings/electron.d.ts
NPM script 'gn-typescript-definitions' failed with code '2':
...
[2900/46025] CXX obj/skia/skia_core_and_effects/SkBlurImageFilter.o
ninja: build stopped: subcommand failed.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Ubuntu 22.04

$ yarn ninja release
yarn run v1.22.19
$ scripts/ninja.sh release
depot_tools/ninja.py: Fallback to a deprecated legacy ninja binary. Note that this ninja binary will be removed soon.
Please install ninja to your project using DEPS. If your project does not have DEPS, Please install ninja in your PATH.
See also https://crbug.com/1340825
ninja: Entering directory `electron/src/out/release'
[1014/38062] ACTION //electron:build_electron_definitions(//build/toolchain/linux:clang_x64)
FAILED: gen/electron/tsc/typings/electron.d.ts
python3 ../../electron/build/npm-run.py --silent gn-typescript-definitions -- /home/jdq/Developer/Projects/html2svg/electron/src/out/release/gen/electron/tsc/typings/electron.d.ts
NPM script 'gn-typescript-definitions' failed with code '2':
...
[1031/38062] ACTION //third_party/dav1d:dav1d_asm_action(//build/toolchain/linux:clang_x64)
ninja: build stopped: subcommand failed.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

If anyone can point to a resource where I can learn about building Chromium it would be greatly appreciated. I believe I've followed all the instructions on the Chromium site regarding depot_tools and setting up the dev environment, but obviously I'm missing something. :) Thanks.

Currently on mobile but I think you need to delete the node_modules folder and rerun yarn ninja release. At the end, you can run yarn && yarn tsc -b . to generate JS files.

If you're getting an Xcode build error during the middle of the build do the following to download the latest recommended Xcode version: yarn && yarn e load-xcode && rm -rf node_modules.

For checking out the code and patching it you'll need to do yarn gclient --revision "src/electron@cb22573c3e76e09df9fbad36dc372080c04d349e" && scripts/patch.sh.

If scripts/patch.sh fails you'll have to reset the fork repo and re-apply:

(cd electron/src && git checkout .) && (cd electron/src/third_party/skia/ && git checkout .) && scripts/patch.sh

Sorry it's pretty bumpy, I'm hoping to make everything smoother in the following days :)


If you have a Linux machine I greatly recommend the Docker steps to generate binaries, it should be pretty portable and write the files in a mounted directory!

Thank you for the suggestions. I'm mainly trying to get Mac binaries, I just switching to trying Linux (without Docker) to see if I could shed some light on what was going wrong. I'm still trying with your suggestions (slow Mac), but I'll update with results.

Ok, I got binaries on MacOS, though it takes my old Mac 10 hours to compile. :)

Your suggestions of deleting node_modules and checking out the code and patching worked. I then manually constructed the /app directory and modified the html2svg.cli.js file to reflect the Mac binary.

Thank you!

@davidquintana I am also struggling to get macOS binaries.

Would you mind sharing how you did it?

Are there any changes in the /app/ directory that I can't copy from the dockerfile?

What changes did you make to html2svg.cli.ts? (I'm very comfortable in JS but I've never used typescript before)