We are currently planning to migrate to a different platform for the forum. We will announce this fact both here and on Twitter, once we have settled on a solution.

Build for Raspberry Pi

I just tried to build Zettlr on my Raspi 4. I have installed both node.js and yarn. If I try to run yarn install, I get this error and it quits (I have yarn installed):
00h00m00s 0/0: : ERROR: [Errno 2] No such file or directory: 'install'

If I use npm, it seems to build (both in Zettlr and in source), but when I go to run make.sh, I get this:

00h00m00s 0/0: : ERROR: [Errno 2] No such file or directory: 'less'
00h00m00s 0/0: : ERROR: [Errno 2] No such file or directory: 'handlebars'
00h00m00s 0/0: : ERROR: [Errno 2] No such file or directory: 'reveal:build'
00h00m00s 0/0: : ERROR: [Errno 2] No such file or directory: 'wp:prod'
00h00m00s 0/0: : ERROR: [Errno 2] No such file or directory: 'lang:refresh'
00h00m00s 0/0: : ERROR: [Errno 2] No such file or directory: 'release:win'
00h00m00s 0/0: : ERROR: [Errno 2] No such file or directory: 'release:mac'
00h00m00s 0/0: : ERROR: [Errno 2] No such file or directory: 'release:linux'
00h00m00s 0/0: : ERROR: [Errno 2] No such file or directory: 'release:app-image'

(output from the nmp install)

zettlr@1.6.0 postinstall /home/pi/Zettlr
electron-builder install-app-deps

  • electron-builder  version=22.4.1
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.1.2 (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.1.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"arm"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.12 (node_modules/watchpack/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.12: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"arm"})

As a test, I did the exact same thing on my Mac--clone, go to the Zettler folder and do a "yarn install" it works, and everything works, including getting a working Mac app, packages, etc.

But on my Raspi, nothing but the above errors. Is it not possible to compile on arm7? or am I missing something?

Comments

  • So if I got you right:
    Have you changed the possible build targets in electron builder?
    They currently are defined as:

    const linuxTargets = [{ target: 'AppImage', arch: [ 'x64', 'ia32' ] }, 'deb', 'rpm' ]
    const win32Targets = [{ target: 'nsis', arch: [ 'x64', 'ia32' ] }]

    Which means you have to define an own target for your raspi build.
    target: 'appimage', arch: ['armv7l']

    You could probably try to change the value of linuxTargets in _Zettlr/scripts/build-app.js to that. I guess it's worth trying this change but it might get you some other trouble with build platforms not supported for a variety of reasons.

    Also make sure: git clone into the repo. Use npm install in both directories (Zettlr and Zettlr/source), then run the build-script. (Actually I don't remember there's any need for running make directly.) If there's some other errors, like the one you got at 00h00m00s 0/0: : ERROR: [Errno 2] No such file or directory: 'less' then it's probably also a good idea to build that stuff manually.

    $ yarn less # Or npm run less, this recompiles the stylesheets
    $ yarn handlebars # Or npm run handlebars, this recompiles the templates
    $ yarn wp:dev # Or npm run wp:dev, this recompiles the Vue components
    $ yarn reveal:build # Or npm run reveal:build, needs to be run once

  • Thanks for your input!

    At some point, I finally got past the earlier errors--turns out I needed to use a newer version of yarn than what the Raspi had installed by default. I got it to the point of build, and found out that arch arm is not supported. I just went and followed your directions, and still get the same result:

    CWD is: /home/pi/Zettlr Starting build process Building for: linux • electron-builder version=22.4.1 os=4.19.97-v7l+ • writing effective config file=release/builder-effective-config.yaml Build failed! Error: Unsupported arch arm

    And for the record, in make.sh, I have commented out all the other build targets (mac, win, appimage) only linux deb and rpm files.

    It seems to me that somehow, Zettlr doesn't like arm? Is that possible? Or am I missing something else.

    Here's what I did in the build-app.js script

    const linuxTargets = [{ target: 'AppImage', arch: [ 'x64', 'ia32', 'arm64' ] }, 'deb', 'rpm' ]

    I first tried with arm7l as you suggested, and got the same result.

    btw, I'm not a programmer, so don't know how to change build targets in electron builder. I just modified the build-app.js

    And once again, thanks for your help.

  • Commenting out shouldn't be necessary, and as long as electron-builder supports ARM builds, it shooooouuuuld work — maybe double check the necessary configuration for that build target!

  • I commented them out because when I built on my Mac, it built all of the various platforms. Now, it's a relatively fast and capable machine. The Pi, on the other hand... Just it case it tried to build everything, I don't want to waste my time waiting for all that. :-)

    As I said, I'm not a programmer, and electron is entirely new to me. Any guidance as to where to look and what to look for? TIA

  • edited April 2020

    Egg on my face!

    I finally got smart and built on my Mac, adding the arm options to the build file, and then looked in my release folder on my Mac, and there were both unpacked files and appimage files. (the deb files refused to build for some reason)

    i copied them to my Pi, set the executable of th arm7l image and doubleclicked--and there's Zettler running on my Pi! Anybody want a copy? :-)

    Thanks for your help folks. i couldn't have done it without your help.
    proof.

  • Thank you for letting us know! Nice you got Zettlr to build for raspberry pi.

    So, what exactly was the change necessary to build it finally? I mean, you tried to build on another platform (directly on the pi itself) at first where it didn't build? And then putting the arm target into the build-app.js file on mac and building there did the job?
    Have I got this right?

  • No. I never got it to build on the Pi itself. I built on my Mac with the armv7l added to the targets in the build-app.js file on the Mac. When I did that, the deb failed to build, but I got both the unpacked app and appimage for both armv7l and arm64. I was then able to copy the files over my network to my Pi, and ended up deciding to put the unpacked files into their proper locations in the system. I may regret that, due to the fact that I will always have to update the app by building it, and an appimage is a lot easier to deal with than loose files scattered through a dozen folder. Most, of course, I can leave, but still...

    I don't know why it won't build on the Pi. I do know I can't use yarn, and have to use npm to get anywhere, but why it gives up on the build itself, I don't know. I suppose there are issues with my yarn install, but as I said, I'm not a programmer, and yarn and electron are new to me. I have built apps on GCC and such for ages, but this is my first attempt at an electron app, and I'm getting too old to learn new tricks. ;-)

  • OK, thank you for clarifying this!

    I guess I know where the issue might be. Have a look at this: https://github.com/electron/electron/issues/16205

    So electron seems to run well on Raspbian when it's already prebuilt. But I cannot be build because of an incompatible glibc I guess. So you'd probably always have to use another machine to build. Probably .deb file creation does not work on your machine because the script requires some deb-tools to create that - which likely aren't available on your macOS device?

  • Hm. I don't know about either. I will check the glibc issue, but that post is 2018. Buster is now on the Pi. It'd be weird if there wasn't a newer version of it.

    As to the Mac, I also don't know. the deb for x86 built fine, just not for the arm.

    In any case, I'm not gonna complain. I've got a working build, and, in the end, I'm fine with that. :-)

  • OK, happy when you are it! :smile:

    Nevertheless a working build for arm/raspbian that's ready for release would be very nice so I'll be checking this issue and let you know if I get anything new. Just had no time to set up my pi and check this :disappointed: but rest assured, I will do.

  • I'm trying to build this on a Pi 4 running Ubuntu MATE 20.10. I'm not a programmer or an admin, but I'm not shy about the CLI either. This is my first time installing Yarn or trying to build anything with it or with Electron. I'm trying to get an RPI build so I can have cross-platform support with my Mac. Ok, so here's my problem (documenting extra steps in case it helps others down the line):

    At first, I tried to install Yarn from symantec package manager, but the yarn version in the Ubuntu repos made a mess and didn't install properly, so I added it manually from the yarnpkg repo:

    $ sudo apt install curl
    $ curl -sL https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
    $ echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.lis
    $ sudo apt update && sudo apt install yarn
    

    Apparently there are some further dependencies needed for building .deb, .rpm, and snap:
    https://www.beekeeperstudio.io/blog/electron-apps-for-arm-and-raspberry-pi
    But an AppImage is good enough for me, so I skipped those other steps.

    Next I cloned the Zettlr release from Github

    $ git clone https://github.com/Zettlr/Zettlr.git
    $ cd Zettlr
    $ yarn install
    

    I also edited the electron-builder.yml, in case it matters-- I'm not sure if it does, as the Yarn build defaults on linux are apparently Appimage. But here's the code I added, after commenting out all the other OS options and retaining lines 1-29 (appId:, etc):

    # Generic Linux options on ARM64 (e.g. Raspberry Pi, Pinebook Pro...)
    # only compiling to AppImage and zip cuz 
    # https://www.beekeeperstudio.io/blog/electron-apps-for-arm-and-raspberry-pi
    # and I'm lazy, and AppImage suits me just fine. ;) - Lucid-Gem
    #
    linux:
      target:
      - AppImage
    #  - deb
    #  - rpm
      - zip
      artifactName: "Zettlr-${version}-${arch}.${ext}"
      executableName: Zettlr
      synopsis: Markdown editor
      category: Office
      icon: "./resources/icons/png"
      desktop:
        StartupWMClass: zettlr
    

    So far, so good, right? One can hope. It throws an error when I try to build it (executed in the Zettlr build dir):

    $ yarn electron-builder -l --arm64
        yarn run v1.22.5
        warning ../package.json: No license field
        $ /home/username/Zettlr/node_modules/.bin/electron-builder -l --arm64
        • electron-builder  version=22.10.5 os=5.8.0-1021-raspi
        • loaded configuration  file=/home/username/Zettlr/electron-builder.yml
        • writing effective config  file=release/builder-effective-config.yaml
        • skipped dependencies rebuild  reason=npmRebuild is set to false
        • packaging       platform=linux arch=arm64 electron=12.0.2 appOutDir=release/linux-arm64-unpacked
        • Unpacking electron zip  zipPath=undefined
        ⨯ Application entry file ".webpack/main" in the "/home/username/Zettlr/release/linux-arm64-unpacked/resources/app.asar" does not exist. Seems like a wrong configuration.  stackTrace=                                                                                                                                                             Error: Application entry file ".webpack/main" in the "/home/username/Zettlr/release/linux-arm64-unpacked/resources/app.asar" does not exist. Seems like a wrong configuration.
        at error (/home/username/Zettlr/node_modules/app-builder-lib/src/asar/asarFileChecker.ts:7:12)
        at checkFileInArchive (/home/username/Zettlr/node_modules/app-builder-lib/src/asar/asarFileChecker.ts:33:11)
        at LinuxPackager.checkFileInPackage (/home/username/Zettlr/node_modules/app-builder-lib/src/platformPackager.ts:430:7)
        at LinuxPackager.sanityCheckPackage (/home/username/Zettlr/node_modules/app-builder-lib/src/platformPackager.ts:481:5)
        at LinuxPackager.doPack (/home/username/Zettlr/node_modules/app-builder-lib/src/platformPackager.ts:253:5)
        at LinuxPackager.pack (/home/username/Zettlr/node_modules/app-builder-lib/src/platformPackager.ts:115:5)
        at Packager.doBuild (/home/username/Zettlr/node_modules/app-builder-lib/src/packager.ts:434:9)
        at executeFinally (/home/username/Zettlr/node_modules/builder-util/src/promise.ts:12:14)
        at Packager._build (/home/username/Zettlr/node_modules/app-builder-lib/src/packager.ts:369:31)
        at Packager.build (/home/username/Zettlr/node_modules/app-builder-lib/src/packager.ts:333:12)
        at executeFinally (/home/username/Zettlr/node_modules/builder-util/src/promise.ts:12:14)
        error Command failed with exit code 1.
        info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
    

    Same deal when I just run yarn electron-builder .

  • Apparently I'm getting a bit too verbose for the forum defaults. A few more details:

    Notably, I also had some errors thrown during installation, also involving webpack (which is a Node.js library, I'm gathering?):

    $ yarn add electron-builder --dev
    yarn add v1.22.5
    warning ../package.json: No license field
    [1/4] Resolving packages...
    [2/4] Fetching packages...
    info fsevents@2.3.2: The platform "linux" is incompatible with this module.
    info "fsevents@2.3.2" is an optional dependency and failed compatibility check. Excluding it from installation.
    info fsevents@1.2.9: The platform "linux" is incompatible with this module.
    info "fsevents@1.2.9" is an optional dependency and failed compatibility check. Excluding it from installation.
    info dmg-license@1.0.8: The platform "linux" is incompatible with this module.
    info "dmg-license@1.0.8" is an optional dependency and failed compatibility check. Excluding it from installation.
    info iconv-corefoundation@1.1.5: The platform "linux" is incompatible with this module.
    info "iconv-corefoundation@1.1.5" is an optional dependency and failed compatibility check. Excluding it from installation.
    [3/4] Linking dependencies...
    warning " > @clr/icons@5.1.0" has unmet peer dependency "@webcomponents/custom-elements@^1.0.0".
    warning " > copy-webpack-plugin@6.4.0" has unmet peer dependency "webpack@^4.37.0 || ^5.0.0".
    warning " > css-loader@5.2.0" has unmet peer dependency "webpack@^4.27.0 || ^5.0.0".
    warning " > eslint-loader@4.0.2" has unmet peer dependency "webpack@^4.0.0 || ^5.0.0".
    warning " > file-loader@6.2.0" has unmet peer dependency "webpack@^4.0.0 || ^5.0.0".
    warning " > less-loader@7.3.0" has unmet peer dependency "webpack@^4.0.0 || ^5.0.0".
    warning " > node-loader@1.0.2" has unmet peer dependency "webpack@^4.0.0 || ^5.0.0".
    warning " > raw-loader@4.0.2" has unmet peer dependency "webpack@^4.0.0 || ^5.0.0".
    warning " > style-loader@2.0.0" has unmet peer dependency "webpack@^4.0.0 || ^5.0.0".
    warning " > ts-loader@8.1.0" has unmet peer dependency "webpack@*".
    warning " > vue-loader@15.9.6" has unmet peer dependency "webpack@^3.0.0 || ^4.1.0 || ^5.0.0-0".
    [4/4] Building fresh packages...
    success Saved 1 new dependency.
    info Direct dependencies
    └─ electron-builder@22.10.5
    info All dependencies
    └─ electron-builder@22.10.5
    $ electron-builder install-app-deps
      • electron-builder  version=22.10.5
      • loaded configuration  file=/home/username/Zettlr/electron-builder.yml
    Done in 24.13s.
    

    There is a folder /node_modules/webpack , and plenty of things with the string webpack at different levels in the Zettlr build directory:

    Perhaps there is an error with a stray period or something? Application entry file ".webpack/main" in the "/home/username/Zettlr/release/linux-arm64-unpacked/resources/app.asar" does not exist. Seems like a wrong configuration There don't seem to be any hidden directories... Anyhow, it quite outstrips my knowledge.

    Could some kind soul lend a hand?

  • You need to run yarn package before running yarn release, as the latter expects the previous to have run. Possibly also make sure to specify the correct target and platform as indicated in the corresponding "scripts" section in the package.json.

  • Hmm... I tried that but got an error. Decided to reinstall electron-builder, but I still got a bunch of peer dependency errors:

    $ yarn add electron-builder --dev
    yarn add v1.22.5
    warning ../../package.json: No license field
    [1/4] Resolving packages...
    [2/4] Fetching packages...
    info fsevents@2.3.2: The platform "linux" is incompatible with this module.
    info "fsevents@2.3.2" is an optional dependency and failed compatibility check. Excluding it from installation.
    info fsevents@1.2.9: The platform "linux" is incompatible with this module.
    info "fsevents@1.2.9" is an optional dependency and failed compatibility check. Excluding it from installation.
    info dmg-license@1.0.8: The platform "linux" is incompatible with this module.
    info "dmg-license@1.0.8" is an optional dependency and failed compatibility check. Excluding it from installation.
    info iconv-corefoundation@1.1.5: The platform "linux" is incompatible with this module.
    info "iconv-corefoundation@1.1.5" is an optional dependency and failed compatibility check. Excluding it from installation.
    [3/4] Linking dependencies...
    warning " > @clr/icons@5.1.0" has unmet peer dependency "@webcomponents/custom-elements@^1.0.0".
    warning " > copy-webpack-plugin@6.4.0" has unmet peer dependency "webpack@^4.37.0 || ^5.0.0".
    warning " > css-loader@5.2.0" has unmet peer dependency "webpack@^4.27.0 || ^5.0.0".
    warning " > eslint-loader@4.0.2" has unmet peer dependency "webpack@^4.0.0 || ^5.0.0".
    warning " > file-loader@6.2.0" has unmet peer dependency "webpack@^4.0.0 || ^5.0.0".
    warning " > less-loader@7.3.0" has unmet peer dependency "webpack@^4.0.0 || ^5.0.0".
    warning " > node-loader@1.0.2" has unmet peer dependency "webpack@^4.0.0 || ^5.0.0".
    warning " > raw-loader@4.0.2" has unmet peer dependency "webpack@^4.0.0 || ^5.0.0".
    warning " > style-loader@2.0.0" has unmet peer dependency "webpack@^4.0.0 || ^5.0.0".
    warning " > ts-loader@8.1.0" has unmet peer dependency "webpack@*".
    warning " > vue-loader@15.9.6" has unmet peer dependency "webpack@^3.0.0 || ^4.1.0 || ^5.0.0-0".
    [4/4] Building fresh packages...
    [-/3] ⠠ waiting...
    [2/3] ⠐ lzma-native
    [-/3] ⠐ waiting...
    

    and ran yarn install --peerin case there were other unresolved peer dependencies...
    When I run yarn package, i get a verbose error which includes:

    $ yarn package
    yarn run v1.22.5
    warning ../../package.json: No license field
    $ electron-forge package
    ✔ Checking your system
    ✖ Compiling Main Process Code
    An unhandled error has occurred inside Forge:
    Compilation errors in the main process: Hash: 7b785b2e7ab5ebfad041
    Version: webpack 4.44.2
    Time: 133321ms
    Built at: 04/25/2021 10:57:35 AM
    

    then a bunch of filenames and sizes, then

    ERROR in unable to locate '/home/sasha/Applications/Zettlr-develop/source/main/modules/export/assets/template.revealjs.htm' glob
    ERROR in unable to locate '/home/sasha/Applications/Zettlr-develop/source/main/modules/export/assets/revealjs-styles' glob
    

    I'm guessing this is still a webpack-related error... Any tips for getting those dependencies installed? Thx!

  • Ahhh!

    You have to run yarn reveal:build once. I have to finally add that command to the CI pipeline since that's so extremely easily overlooked …

  • edited May 10

    Ok, so this went well:

    $ yarn reveal:build
    yarn run v1.22.5
    warning ../package.json: No license field
    $ node scripts/update-reveal.js
    [INPUT] revealJS:  130769 characters, 10 lines
    [INPUT] revealCSS: 47146 characters, 38 lines
    Wrote output template file to ../source/main/modules/export/assets/template.revealjs.htm
    Processing theme beige ...
    [abridged for brevity- processing more themes]
    reveal.JS has been updated successfully!
    Done in 2.65s.
    

    as did:

    $ yarn package
    yarn run v1.22.5
    warning ../package.json: No license field
    $ electron-forge package
    ✔ Checking your system
    ✔ Compiling Main Process Code
    Done in 314.61s.
    

    however:

    $ yarn release
    yarn run v1.22.5
    warning ../package.json: No license field
    error Command "release" not found.
    info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
    

    so... what am I missing? thx!

  • You're missing a specifier for the release command, as outlined in the README file. Please consult that one!

Sign In or Register to comment.