electron-userland / electron-builder

A complete solution to package and build a ready for distribution Electron app with “auto update” support out of the box
https://www.electron.build
MIT License
13.47k stars 1.72k forks source link

Building for Linux Arm64 snap will fail #8167

Open coreybruce opened 3 months ago

coreybruce commented 3 months ago

29.1.0

When I build for Arm64 it will give a error failing to build for snap, I don't care about snaps and It still builds a appimage successfully but the warning and errors are annoying

x64 build log

./node_modules/.bin/electron-builder --linux --x64  

  • electron-builder  version=24.13.3 os=6.6.19-1-MANJARO
  • writing effective config  file=dist/builder-effective-config.yaml
  • packaging       platform=linux arch=x64 electron=29.2.0 appOutDir=dist/linux-unpacked
  • building        target=snap arch=x64 file=dist/GoogleKeep_1.0.5_amd64.snap
  • building        target=AppImage arch=x64 file=dist/GoogleKeep-1.0.5.AppImage
  • application Linux category is set to default "Utility"  reason=linux.category is not set and cannot map from macOS docs=https://www.electron.build/configuration/linux
  • application Linux category is set to default "Utility"  reason=linux.category is not set and cannot map from macOS docs=https://www.electron.build/configuration/linux

Arm64 build log

./node_modules/.bin/electron-builder --linux --arm64

  • electron-builder  version=24.13.3 os=6.6.19-1-MANJARO
  • writing effective config  file=dist/builder-effective-config.yaml
  • packaging       platform=linux arch=arm64 electron=29.2.0 appOutDir=dist/linux-arm64-unpacked
  • building        target=snap arch=arm64 file=dist/GoogleKeep_1.0.5_arm64.snap
  • building        target=AppImage arch=arm64 file=dist/GoogleKeep-1.0.5-arm64.AppImage
  • application Linux category is set to default "Utility"  reason=linux.category is not set and cannot map from macOS docs=https://www.electron.build/configuration/linux
  • application Linux category is set to default "Utility"  reason=linux.category is not set and cannot map from macOS docs=https://www.electron.build/configuration/linux
  ⨯ snapcraft is not installed, please: sudo snap install snapcraft --classic  
  ⨯ /home/corey/Stuff/git/GoogleKeep/application/node_modules/app-builder-bin/linux/x64/app-builder process failed ERR_ELECTRON_BUILDER_CANNOT_EXECUTE
Exit code:
1  failedTask=build stackTrace=Error: /home/corey/Stuff/git/GoogleKeep/application/node_modules/app-builder-bin/linux/x64/app-builder process failed ERR_ELECTRON_BUILDER_CANNOT_EXECUTE
Exit code:
1
    at ChildProcess.<anonymous> (/home/corey/Stuff/git/GoogleKeep/application/node_modules/builder-util/src/util.ts:252:14)
    at Object.onceWrapper (node:events:634:26)
    at ChildProcess.emit (node:events:519:28)
    at maybeClose (node:internal/child_process:1105:16)
    at Process.ChildProcess._handle.onexit (node:internal/child_process:305:5)
mmaietta commented 3 months ago

This is why it's failing. snapcraft is not installed, please: sudo snap install snapcraft --classic snapcraft is a huge package and is why it's not installed in the base docker image by default. You'll need to install it locally

coreybruce commented 3 months ago

This is why it's failing. snapcraft is not installed, please: sudo snap install snapcraft --classic snapcraft is a huge package and is why it's not installed in the base docker image by default. You'll need to install it locally

Sorry but why did you close this? did you look at my logs at all? you can clearly see the difference between the log building x64 and Arm64..

I never told it to do snap on either of them and when I told it to do x64 it didn't do snap nor did it give me the error but as soon as I did Arm64 it tried to do snap and gave me that error even tho I never told it to do a snap package

I never said I was even using a docker container, please re open this issue and read the issue post.

mmaietta commented 3 months ago

Apologies. Can you please post your full electron-builder config file, your build command w/ args, and/or a minimum reproducible repo that I can investigate further with? Not sure why yours is building snap if you're not specifically requesting it via config.

coreybruce commented 3 months ago

I'm actually not using a electron-builder config file but here is a example of one of my package.json files

{
  "name": "Youtube",
  "version": "1.1.1",
  "pkgrel": "3",
  "description": "Youtube desktop app",
  "main": "main.js",
  "scripts": {
    "start": "electron ."
  },
  "repository": "",
  "keywords": [
    "Youtube"
  ],
  "author": "Corey Bruce",
  "license": "GPL",
  "devDependencies": {
    "electron": "^29.1.0",
    "electron-builder": "^24.13.3",
    "electron-packager": "^17.1.2"
  },
  "dependencies": {
    "electron-context-menu": "^3.6.1"
  }
}

Not sure why it tries to build a snap package when I tell it to do arm64 but not x64 I'm sure we can figure out the bug

mmaietta commented 3 months ago

Having an electron-builder config in your package.json would probably help significantly. What's your build command though? I don't see anything in the scripts for electron-builder.

The default targets for linux include snap https://github.com/electron-userland/electron-builder/blob/fa6fc16040a93c6ee751a7a27ab6eeb1dbdd31a7/packages/app-builder-lib/src/linuxPackager.ts#L24-L26

coreybruce commented 2 months ago

Yeh but I don't need a electron-builder config

The default targets for linux include snap

But it doesn't give this error when building for x64 and only Arm64, why is it different between the two architectures and give this error for Arm64 but doesn't on x64 when I don't have the snap packages and don't want to build for snap??

github-actions[bot] commented 3 weeks ago

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 30 days.

Ladvace commented 2 days ago

did you find any solution?

mmaietta commented 1 day ago

Can you try adding this to your package.json build field or to the electron-builder config file? Just trying to determine if an explicit configuration can resolve the issue here while also giving me more direction on what's going wrong

linux: {
      target: ['AppImage']
}
jmurphy-dev commented 1 day ago

I am somewhat bogged down here too. I can my dev command is correctly opening but when I go to build chrome there seems to be something wrong with chromium itself. I cannot open dev tools the page is white.

"build": {
    "appId": "com.swimstudios.uncanned",
    "productName": "Uncanned",
    "directories": {
      "output": "build"
    },
    "files": [
      "dist-electron/**/*",
      ".output/**/*",
      "node_modules/**/*",
      "package.json"
    ],
    "linux": {
      "target": [
        "AppImage",
        "deb"
      ],
      "category": "public.app-category.tools"
    }
  }
  ./build/Uncanned-0.0.1-arm64.AppImage 
(node:10025) UnhandledPromiseRejectionWarning: TypeError: Error processing argument at index 0, conversion failure from undefined
    at _.loadURL (node:electron/js2c/browser_init:2:79794)
    at n.loadURL (node:electron/js2c/browser_init:2:13178)
    at file:///tmp/.mount_UncannXVoPBs/resources/app.asar/dist-electron/main.js:3:11
(Use `nuxt-app --trace-warnings ...` to show where the warning was created)
(node:10025) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
[10068:0710/124722.759134:ERROR:gbm_wrapper.cc(72)] Failed to get fd for plane.: No such file or directory (2)
[10068:0710/124722.759298:ERROR:gbm_wrapper.cc(255)] Failed to export buffer to dma_buf: No such file or directory (2)
[10068:0710/124722.761209:ERROR:gbm_wrapper.cc(72)] Failed to get fd for plane.: No such file or directory (2)
[10068:0710/124722.761253:ERROR:gbm_wrapper.cc(255)] Failed to export buffer to dma_buf: No such file or directory (2)
mmaietta commented 1 day ago

@jmurphy-dev can you open a new GH issue for that? Looks to be a different issue. Please include the electron-builder version you're using. It might be worth trying out next version of electron-builder as well as some changes were made to app-builder upstream dependency that I think impacts AppImage packaging

coreybruce commented 1 day ago

did you find any solution?

I haven't seen any updates to this issue or seen any solutions but hopefully we do get some sort of update about fixing this issue.

coreybruce commented 1 day ago

Can you try adding this to your package.json build field or to the electron-builder config file? Just trying to determine if an explicit configuration can resolve the issue here while also giving me more direction on what's going wrong

linux: {
      target: ['AppImage']
}

Sure I'll give it a try when I can