oxen-io / session-desktop

Session Desktop - Onion routing based messenger
https://getsession.org
GNU General Public License v3.0
1.56k stars 197 forks source link

Error compiling on Arm64 linux #3232

Open amirseyedian opened 2 weeks ago

amirseyedian commented 2 weeks ago

Is there an existing issue for this?

1635

Current Behavior

Im facing an error while trying to compile on linux ARM64 architecture. yarn install --frozen-lockfile results in the following error asking for .git directory by husky

error /home/user/session-desktop/node_modules/postinstall-prepare: Command failed.
Exit code: 1
Command: node ./run.js
Arguments: 
Directory: /home/user/session-desktop/node_modules/postinstall-prepare
Output:
husky - .git can't be found (see https://typicode.github.io/husky/#/?id=custom-directory)
node:child_process:960
    throw err;
    ^

Error: Command failed: npm run prepare
husky - .git can't be found (see https://typicode.github.io/husky/#/?id=custom-directory)

    at checkExecSyncError (node:child_process:885:11)
    at execSync (node:child_process:957:15)
    at Object.<anonymous> (/home/user/session-desktop/node_modules/postinstall-prepare/run.js:14:5)
    at Module._compile (node:internal/modules/cjs/loader:1254:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1308:10)
    at Module.load (node:internal/modules/cjs/loader:1117:32)
    at Module._load (node:internal/modules/cjs/loader:958:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
    at node:internal/main/run_main_module:23:47 {
  status: 1,
  signal: null,
  output: [
    null,
    Buffer(51) [Uint8Array] [
       10,  62,  32, 115, 101, 115, 115, 105, 111, 110,
       45, 100, 101, 115, 107, 116, 111, 112,  64,  49,
       46,  49,  52,  46,  48,  32, 112, 114, 101, 112,
       97, 114, 101,  10,  62,  32, 104, 117, 115, 107,
      121,  32, 105, 110, 115, 116,  97, 108, 108,  10,
       10
    ],
    Buffer(90) [Uint8Array] [
      104, 117, 115, 107, 121,  32,  45,  32,  46, 103, 105, 116,
       32,  99,  97, 110,  39, 116,  32,  98, 101,  32, 102, 111,
      117, 110, 100,  32,  40, 115, 101, 101,  32, 104, 116, 116,
      112, 115,  58,  47,  47, 116, 121, 112, 105,  99, 111, 100,
      101,  46, 103, 105, 116, 104, 117,  98,  46, 105, 111,  47,
      104, 117, 115, 107, 121,  47,  35,  47,  63, 105, 100,  61,
       99, 117, 115, 116, 111, 109,  45, 100, 105, 114, 101,  99,
      116, 111, 114, 121,  41,  10
    ]
  ],
  pid: 1052555,
  stdout: Buffer(51) [Uint8Array] [
     10,  62,  32, 115, 101, 115, 115, 105, 111, 110,
     45, 100, 101, 115, 107, 116, 111, 112,  64,  49,
     46,  49,  52,  46,  48,  32, 112, 114, 101, 112,
     97, 114, 101,  10,  62,  32, 104, 117, 115, 107,
    121,  32, 105, 110, 115, 116,  97, 108, 108,  10,
     10
  ],
  stderr: Buffer(90) [Uint8Array] [
    104, 117, 115, 107, 121,  32,  45,  32,  46, 103, 105, 116,
     32,  99,  97, 110,  39, 116,  32,  98, 101,  32, 102, 111,
    117, 110, 100,  32,  40, 115, 101, 101,  32, 104, 116, 116,
    112, 115,  58,  47,  47, 116, 121, 112, 105,  99, 111, 100,
    101,  46, 103, 105, 116, 104, 117,  98,  46, 105, 111,  47,
    104, 117, 115, 107, 121,  47,  35,  47,  63, 105, 100,  61,
     99, 117, 115, 116, 111, 109,  45, 100, 105, 114, 101,  99,
    116, 111, 114, 121,  41,  10
  ]

I was able to mitigate this issue by copying the contents of .github directory to .git yarn install --frozen-lockfile runs successfully but when I try to build a release I get the following error asking for a app.asar file yarn build-release :

$ yarn build-release-base --publish=never --config.directories.output=release --arm64
$ cross-env NODE_ENV=production electron-builder --config.extraMetadata.environment=production --publish=never --config.directories.output=release --arm64
  • electron-builder  version=23.0.8 os=6.8.11-arm64
  • loaded configuration  file=package.json ("build" field)
  • writing effective config  file=release/builder-effective-config.yaml
  • rebuilding native dependencies  dependencies=@signalapp/better-sqlite3@8.7.1 platform=linux arch=arm64
  • rebuilding native dependency  name=@signalapp/better-sqlite3 version=8.7.1
  • packaging       platform=linux arch=arm64 electron=25.8.4 appOutDir=release/linux-arm64-unpacked
targets [ 'deb' ]
AppImage false
afterPack hook not triggered as this is not an appImage build
  ⨯ Application entry file "ts/mains/main_node.js" in the "/home/user/session-desktop-unstable/release/linux-arm64-unpacked/resources/app.asar" does not exist. Seems like a wrong configuration.  failedTask=build stackTrace=Error: Application entry file "ts/mains/main_node.js" in the "/home/user/session-desktop-unstable/release/linux-arm64-unpacked/resources/app.asar" does not exist. Seems like a wrong configuration.
    at error (/home/user/session-desktop-unstable/node_modules/app-builder-lib/src/asar/asarFileChecker.ts:7:12)
    at Object.checkFileInArchive (/home/user/session-desktop-unstable/node_modules/app-builder-lib/src/asar/asarFileChecker.ts:31:11)
    at LinuxPackager.checkFileInPackage (/home/user/session-desktop-unstable/node_modules/app-builder-lib/src/platformPackager.ts:503:7)
    at LinuxPackager.sanityCheckPackage (/home/user/session-desktop-unstable/node_modules/app-builder-lib/src/platformPackager.ts:551:5)
    at LinuxPackager.doPack (/home/user/session-desktop-unstable/node_modules/app-builder-lib/src/platformPackager.ts:312:5)
    at LinuxPackager.pack (/home/user/session-desktop-unstable/node_modules/app-builder-lib/src/platformPackager.ts:136:5)
    at Packager.doBuild (/home/user/session-desktop-unstable/node_modules/app-builder-lib/src/packager.ts:441:9)
    at Object.executeFinally (/home/user/session-desktop-unstable/node_modules/builder-util/src/promise.ts:12:14)
    at Packager._build (/home/user/session-desktop-unstable/node_modules/app-builder-lib/src/packager.ts:376:31)
    at Packager.build (/home/user/session-desktop-unstable/node_modules/app-builder-lib/src/packager.ts:337:12)
    at Object.executeFinally (/home/user/session-desktop-unstable/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.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

An executeable will get compiled into the /release directory but will not run due to the following error. ./session-desktop

A JavaScript error occurred in the main process
Uncaught Exception:                                                                                                                                                             
Error: Cannot find module '/home/user/session-desktop-unstable/release/linux-arm64-unpacked/resources/app.asar/ts/mains/main_node.js'                                          
    at Module._resolveFilename (node:internal/modules/cjs/loader:1082:15)                                                                                                       
    at n._resolveFilename (node:electron/js2c/browser_init:2:117603)                                                                                                            
    at node:electron/js2c/browser_init:2:123740                                                                                                                                 
    at node:electron/js2c/browser_init:2:123983                                                                                                                                 
    at node:electron/js2c/browser_init:2:123987                                                                                                                                 
    at BuiltinModule.compileForInternalLoader (node:internal/bootstrap/loaders:334:7)                                                                                           
    at BuiltinModule.compileForPublicLoader (node:internal/bootstrap/loaders:270:10)                                                                                            
    at loadBuiltinModule (node:internal/modules/cjs/helpers:56:9)                                                                                                               
    at Module._load (node:internal/modules/cjs/loader:941:15)                                                                                                                   
    at f._load (node:electron/js2c/asar_bundle:2:13377)  

Expected Behavior

successful build

Steps To Reproduce

yarn install --frozen-lockfile yarn build-release