Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error compiling on Arm64 linux #3232

Open
amirseyedian opened this issue Oct 17, 2024 · 3 comments
Open

Error compiling on Arm64 linux #3232

amirseyedian opened this issue Oct 17, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@amirseyedian
Copy link

amirseyedian commented Oct 17, 2024

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/[email protected] 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

@amirseyedian amirseyedian added the bug Something isn't working label Oct 17, 2024
@Bilb
Copy link
Collaborator

Bilb commented Nov 6, 2024

Hey @amirseyedian

This builds without error on an arm64 vps.

apt update
apt install git libopenjp2-tools make cmake build-essential # libopenjp2-tools needed for yarn build-release step
git clone https://github.com/oxen-io/session-desktop/
cd session-desktop/
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | bash
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"  # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"  # This loads nvm bash_completion
nvm install
nvm use
npm install -g yarn
yarn install --frozen-lockfile
yarn build-everything
vim package.json # change "deb" in line 264 to "AppImage"
yarn build-release

Could you give those a try, confirm that you do not have any errors and try to run the built binaries?

Thanks

@amirseyedian
Copy link
Author

Hey @Bilb I appreciate you taking the time to respond.

The instructions you provided is exactly the build process I followed in the first place.

the first issue I encounter was this
husky - .git can't be found (see https://typicode.github.io/husky/#/?id=custom-directory)
which I pointed out and I was able to fix that by copying .github directory to a new .git directory.

after some tweaking I was able to fix the build issues so build-everything and build-release runs Ok. and an AppImage is generated but when I try to execute the appimage i get the following error

A JavaScript error occurred in the main process
Uncaught Exception:                                                                                                                                                            
Error: Cannot find module '/tmp/.mount_sessio3ynbOC/resources/app.asar/node_modules/os-locale/node_modules/human-signals/build/src/main.js'. Please verify that the package.json has a valid "main" entry                                                                                                                                                     
    at tryPackage (node:internal/modules/cjs/loader:443:19)                                                                                                                    
    at Module._findPath (node:internal/modules/cjs/loader:685:18)                                                                                                              
    at Module._resolveFilename (node:internal/modules/cjs/loader:1068:27)                                                                                                      
    at n._resolveFilename (node:electron/js2c/browser_init:2:117603)                                                                                                           
    at Module._load (node:internal/modules/cjs/loader:927:27)                                                                                                                  
    at f._load (node:electron/js2c/asar_bundle:2:13377)                                                                                                                        
    at Module.require (node:internal/modules/cjs/loader:1148:19)                                                                                                               
    at require (node:internal/modules/cjs/helpers:110:18)                                                                                                                      
    at Object.<anonymous> (/tmp/.mount_sessio3ynbOC/resources/app.asar/node_modules/os-locale/node_modules/execa/lib/error.js:2:25)                                            
    at Module._compile (node:internal/modules/cjs/loader:1269:14)  

Im interested to know if you were successful on building the binary why not just add it to the repository releases?

@Bilb
Copy link
Collaborator

Bilb commented Nov 6, 2024

Hey @amirseyedian

The first step I've mentioned is cloning the git repository with git clone https://github.com/oxen-io/session-desktop/ .
This should clone the .git folder for you. I guess your hack of copying the .github folder to .git should make it work, but I wasn't too sure.

I'll try to find an arm64 to debug this further

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants