anytype-ts icon indicating copy to clipboard operation
anytype-ts copied to clipboard

Publish linux ARM binaries

Open IdacraBackup opened this issue 1 year ago • 12 comments

Would be great to publish binaries for Linux ARM in releases, I see in package.json there is already a target "dist:linuxarm"

IdacraBackup avatar Jul 20 '23 15:07 IdacraBackup

Also reported here: https://community.anytype.io/t/linux-arm-support/9234

developomp avatar Jul 21 '23 04:07 developomp

it's not building correctly

ra3orblade avatar Jul 21 '23 09:07 ra3orblade

For those who are wondering, the problem comes from the fact that snap currently doesn't support building arm64 on amd64 systems.

image

Should I open a PR so the build workflow can build it using this?

We could also consider dropping snap support entirely in favor of flatpak, which I think is what the majority of Linux users actually want.

developomp avatar Jul 21 '23 14:07 developomp

You can try, middleware builds arm version I think and it should already correctly download the required arch release in update.sh

ra3orblade avatar Jul 21 '23 14:07 ra3orblade

Would also be interested in this as code from a Raspberry Pi 4 running Kali Linux.

Vortigern-The-Grey avatar Jan 17 '24 22:01 Vortigern-The-Grey

I've nearly been able to build this on Asahi Linux, however ran into a snag with primordials being undefined. Nearly completed troubleshooting. When I get it to build successfully, I'll submit my fixes/writeup here.

afro-systems avatar May 19 '24 16:05 afro-systems

I've nearly been able to build this on Asahi Linux, however ran into a snag with primordials being undefined. Nearly completed troubleshooting. When I get it to build successfully, I'll submit my fixes/writeup here.

Sorry, been a bit busy with other stuff. I plan to reattack this week.

afro-systems avatar Jul 10 '24 18:07 afro-systems

I built the app on Asahi Linux running on an Apple MacBook Pro (16-inch, M1 Max, 2021)

anytype-m1-pro

Here are relevant instructions (very closely mirrors what's mentioned in the README.md file):

# Installed node using nvm: 
$ node -v
v22.6.0

# install dependencies
$ sudo dnf install libsecret jq libsecret-devel make g++

# clone the anytype-ts repo and install node dependencies
$ git clone https://github.com/anyproto/anytype-ts
$ cd anytype-ts
# checkout to the latest release...in this case, I checked out to 0.42.4
$ git checkout tags/0.42.4 -b 0.42.4
$ npm install -D

# install middleware library and protobuf bindings
$ ./update.sh ubuntu-latest arm
$ mv linux-arm/anytypeHelper dist/

# build
$ npm run update:locale
$ npm run dist:linuxarm

The build fails with the following error message but the dist folder does have an Anytype-0.42.4-arm64.AppImage file that can be run.

• adding autoupdate files for: deb. (Beta feature)  resourceDir=/home/abijeet/Projects/Personal/anytype-ts/dist/linux-arm64-unpacked/resources
  ⨯ cannot execute  cause=exit status 1
                    errorOut=/home/abijeet/.cache/electron-builder/fpm/fpm-1.9.3-2.3.1-linux-x86/lib/ruby/bin/ruby: line 6: /home/abijeet/.cache/electron-builder/fpm/fpm-1.9.3-2.3.1-linux-x86/lib/ruby/bin.real/ruby: cannot execute binary file: Exec format error
    /home/abijeet/.cache/electron-builder/fpm/fpm-1.9.3-2.3.1-linux-x86/lib/ruby/bin/ruby: line 6: /home/abijeet/.cache/electron-builder/fpm/fpm-1.9.3-2.3.1-linux-x86/lib/ruby/bin.real/ruby: Success

I've also provided a build here: https://github.com/Abijeet/anytype-ts/releases/tag/v0.42.4 but I recommend building one from source yourself.

Abijeet avatar Aug 18 '24 19:08 Abijeet

fpm-1.9.3-2.3.1-linux-x86/ Are you sure that terminal is working in correct environment, it's trying to use x86 binary.

ra3orblade avatar Aug 19 '24 10:08 ra3orblade

fpm-1.9.3-2.3.1-linux-x86/ Are you sure that terminal is working in correct environment, it's trying to use x86 binary.

I didn't spend too much time figuring out what's going on since the AppImage is created. I might debug some more later but looks like the command tries to build a deb package and that's where it fails.

I re-ran the command npm run dist:linuxarm again, and here's the full output:

$ npm run dist:linuxarm

> [email protected] dist:linuxarm
> npm run build:deps && webpack --mode=production --node-env=production && DATE=`date '+%Y-%m-%d_%H_%M'` GIT_COMMIT=`git rev-parse --short HEAD` electron-builder --linux --arm64


> [email protected] build:deps
> webpack --config webpack.node.config.js --stats detailed | grep 'node_modules' | sed -E 's/.*(node_modules[\/][^\\/[:space:]]{1,})[\\/].*/\1/' | uniq | node save-node-deps.js

[
  { from: 'node_modules/@electron', to: 'node_modules/@electron' },
  { from: 'node_modules/async', to: 'node_modules/async' },
  {
    from: 'node_modules/balanced-match',
    to: 'node_modules/balanced-match'
  },
  {
    from: 'node_modules/brace-expansion',
    to: 'node_modules/brace-expansion'
  },
  {
    from: 'node_modules/builder-util-runtime',
    to: 'node_modules/builder-util-runtime'
  },
  { from: 'node_modules/concat-map', to: 'node_modules/concat-map' },
  {
    from: 'node_modules/core-util-is',
    to: 'node_modules/core-util-is'
  },
  { from: 'node_modules/debug', to: 'node_modules/debug' },
  { from: 'node_modules/electron-dl', to: 'node_modules/electron-dl' },
  {
    from: 'node_modules/electron-is-dev',
    to: 'node_modules/electron-is-dev'
  },
  {
    from: 'node_modules/electron-json-storage',
    to: 'node_modules/electron-json-storage'
  },
  {
    from: 'node_modules/electron-log',
    to: 'node_modules/electron-log'
  },
  {
    from: 'node_modules/electron-updater',
    to: 'node_modules/electron-updater'
  },
  {
    from: 'node_modules/electron-util',
    to: 'node_modules/electron-util'
  },
  {
    from: 'node_modules/electron-window-state',
    to: 'node_modules/electron-window-state'
  },
  { from: 'node_modules/ext-list', to: 'node_modules/ext-list' },
  { from: 'node_modules/ext-name', to: 'node_modules/ext-name' },
  { from: 'node_modules/fs-extra', to: 'node_modules/fs-extra' },
  { from: 'node_modules/fs.realpath', to: 'node_modules/fs.realpath' },
  { from: 'node_modules/glob', to: 'node_modules/glob' },
  { from: 'node_modules/graceful-fs', to: 'node_modules/graceful-fs' },
  { from: 'node_modules/has-flag', to: 'node_modules/has-flag' },
  { from: 'node_modules/if-async', to: 'node_modules/if-async' },
  { from: 'node_modules/imurmurhash', to: 'node_modules/imurmurhash' },
  { from: 'node_modules/inflight', to: 'node_modules/inflight' },
  { from: 'node_modules/inherits', to: 'node_modules/inherits' },
  {
    from: 'node_modules/is-plain-obj',
    to: 'node_modules/is-plain-obj'
  },
  { from: 'node_modules/isarray', to: 'node_modules/isarray' },
  { from: 'node_modules/js-yaml', to: 'node_modules/js-yaml' },
  { from: 'node_modules/jsonfile', to: 'node_modules/jsonfile' },
  { from: 'node_modules/keytar', to: 'node_modules/keytar' },
  { from: 'node_modules/lazy-val', to: 'node_modules/lazy-val' },
  { from: 'node_modules/lockfile', to: 'node_modules/lockfile' },
  { from: 'node_modules/lodash', to: 'node_modules/lodash' },
  {
    from: 'node_modules/lodash.escaperegexp',
    to: 'node_modules/lodash.escaperegexp'
  },
  {
    from: 'node_modules/lodash.isequal',
    to: 'node_modules/lodash.isequal'
  },
  { from: 'node_modules/mime-db', to: 'node_modules/mime-db' },
  { from: 'node_modules/minimatch', to: 'node_modules/minimatch' },
  { from: 'node_modules/mkdirp', to: 'node_modules/mkdirp' },
  {
    from: 'node_modules/modify-filename',
    to: 'node_modules/modify-filename'
  },
  { from: 'node_modules/ms', to: 'node_modules/ms' },
  {
    from: 'node_modules/new-github-issue-url',
    to: 'node_modules/new-github-issue-url'
  },
  { from: 'node_modules/once', to: 'node_modules/once' },
  { from: 'node_modules/path-exists', to: 'node_modules/path-exists' },
  {
    from: 'node_modules/path-is-absolute',
    to: 'node_modules/path-is-absolute'
  },
  { from: 'node_modules/pupa', to: 'node_modules/pupa' },
  {
    from: 'node_modules/readable-stream',
    to: 'node_modules/readable-stream'
  },
  { from: 'node_modules/regedit', to: 'node_modules/regedit' },
  { from: 'node_modules/rimraf', to: 'node_modules/rimraf' },
  {
    from: 'node_modules/sanitize-filename',
    to: 'node_modules/sanitize-filename'
  },
  { from: 'node_modules/sax', to: 'node_modules/sax' },
  { from: 'node_modules/semver', to: 'node_modules/semver' },
  { from: 'node_modules/signal-exit', to: 'node_modules/signal-exit' },
  { from: 'node_modules/sort-keys', to: 'node_modules/sort-keys' },
  {
    from: 'node_modules/sort-keys-length',
    to: 'node_modules/sort-keys-length'
  },
  {
    from: 'node_modules/stream-slicer',
    to: 'node_modules/stream-slicer'
  },
  {
    from: 'node_modules/string_decoder',
    to: 'node_modules/string_decoder'
  },
  {
    from: 'node_modules/supports-color',
    to: 'node_modules/supports-color'
  },
  { from: 'node_modules/through2', to: 'node_modules/through2' },
  {
    from: 'node_modules/truncate-utf8-bytes',
    to: 'node_modules/truncate-utf8-bytes'
  },
  {
    from: 'node_modules/universalify',
    to: 'node_modules/universalify'
  },
  {
    from: 'node_modules/unused-filename',
    to: 'node_modules/unused-filename'
  },
  { from: 'node_modules/wrappy', to: 'node_modules/wrappy' },
  {
    from: 'node_modules/write-file-atomic',
    to: 'node_modules/write-file-atomic'
  },
  { from: 'node_modules/xtend', to: 'node_modules/xtend' }
]
(node:37314) [DEP_WEBPACK_DEPRECATION_ARRAY_TO_SET] DeprecationWarning: Compilation.modules was changed from Array to Set (using Array method 'reduce' is deprecated)
(Use `node --trace-deprecation ...` to show where the warning was created)
(node:37314) [DEP_WEBPACK_MODULE_ERRORS] DeprecationWarning: Module.errors was removed (use getErrors instead)
asset js/main.js 31.7 MiB [compared for emit] [big] (name: app) 1 related asset
asset extension/js/main.js 27.5 MiB [compared for emit] [big] (name: extension) 1 related asset
asset 803.js 5 MiB [compared for emit] [big] 1 related asset
orphan modules 9.48 MiB [orphan] 2076 modules
runtime modules 14.3 KiB 24 modules
built modules 42.6 MiB [built]
  modules by path ./node_modules/ 13.8 MiB 932 modules
  modules by path ./src/ 8.81 MiB 692 modules
  modules by path ./dist/ 13.4 MiB
    javascript modules 11 MiB 66 modules
    json modules 2.4 MiB 26 modules
  modules by path ./extension/ 6.63 MiB
    modules by path ./extension/scss/*.scss 829 KiB 6 modules
    modules by path ./extension/img/*.svg 690 bytes 2 modules
    ./extension/entry.tsx + 611 modules 5.82 MiB [built] [code generated]
  + 6 modules

WARNING in asset size limit: The following asset(s) exceed the recommended size limit (244 KiB).
This can impact web performance.
Assets: 
  js/main.js (31.7 MiB)
  extension/js/main.js (27.5 MiB)
  803.js (5 MiB)

WARNING in entrypoint size limit: The following entrypoint(s) combined asset size exceeds the recommended limit (244 KiB). This can impact web performance.
Entrypoints:
  app (31.7 MiB)
      js/main.js
  extension (27.5 MiB)
      extension/js/main.js


webpack 5.91.0 compiled with 2 warnings in 32785 ms
  • electron-builder  version=24.13.3 os=6.9.12-401.asahi.fc40.aarch64+16k
  • loaded configuration  file=package.json ("build" field)
  • writing effective config  file=dist/builder-effective-config.yaml
[BeforeBuild] platform: linux arch: arm64
[BeforeBuild] folder: linux-arm
  • packaging       platform=linux arch=arm64 electron=31.0.0 appOutDir=dist/linux-arm64-unpacked
error: Auth token is required for this request. Please run `sentry-cli login` and try again!

Add --log-level=[info|debug] or export SENTRY_LOG_LEVEL=[info|debug] to see more output.
Please attach the full debug log to all bug reports.
  • skipping "afterSign" hook as no signing occurred, perhaps you intended "afterPack"?
  • building        target=AppImage arch=arm64 file=dist/Anytype-0.42.4-arm64.AppImage
  • building        target=tar.gz arch=arm64 file=dist/anytype-0.42.4-arm64.tar.gz


  • building        target=deb arch=arm64 file=dist/anytype_0.42.4_arm64.deb
  • adding autoupdate files for: deb. (Beta feature)  resourceDir=/home/abijeet/Projects/Personal/anytype-ts/dist/linux-arm64-unpacked/resources
  ⨯ cannot execute  cause=exit status 1
                    errorOut=/home/abijeet/.cache/electron-builder/fpm/fpm-1.9.3-2.3.1-linux-x86/lib/ruby/bin/ruby: line 6: /home/abijeet/.cache/electron-builder/fpm/fpm-1.9.3-2.3.1-linux-x86/lib/ruby/bin.real/ruby: cannot execute binary file: Exec format error
    /home/abijeet/.cache/electron-builder/fpm/fpm-1.9.3-2.3.1-linux-x86/lib/ruby/bin/ruby: line 6: /home/abijeet/.cache/electron-builder/fpm/fpm-1.9.3-2.3.1-linux-x86/lib/ruby/bin.real/ruby: Success
    
                    command=/home/abijeet/.cache/electron-builder/fpm/fpm-1.9.3-2.3.1-linux-x86/fpm -s dir --force -t deb -d libgtk-3-0 -d libnotify4 -d libnss3 -d libxss1 -d libxtst6 -d xdg-utils -d libatspi2.0-0 -d libuuid1 -d libsecret-1-0 --deb-recommends libappindicator3-1 --deb-compression xz --architecture arm64 --after-install /tmp/t-d3cex3/0-after-install --after-remove /tmp/t-d3cex3/2-after-remove --description '
     Anytype' --version 0.42.4 --package /home/abijeet/Projects/Personal/anytype-ts/dist/anytype_0.42.4_arm64.deb --name anytype --maintainer 'Any Association <[email protected]>' --url https://anytype.io --vendor 'Any Association <[email protected]>' --deb-priority optional --license 'SEE LICENSE IN LICENSE.md' /home/abijeet/Projects/Personal/anytype-ts/dist/linux-arm64-unpacked/=/opt/Anytype /home/abijeet/Projects/Personal/anytype-ts/electron/img/icons/16x16.png=/usr/share/icons/hicolor/16x16/apps/anytype.png /home/abijeet/Projects/Personal/anytype-ts/electron/img/icons/32x32.png=/usr/share/icons/hicolor/32x32/apps/anytype.png /home/abijeet/Projects/Personal/anytype-ts/electron/img/icons/64x64.png=/usr/share/icons/hicolor/64x64/apps/anytype.png /home/abijeet/Projects/Personal/anytype-ts/electron/img/icons/128x128.png=/usr/share/icons/hicolor/128x128/apps/anytype.png /home/abijeet/Projects/Personal/anytype-ts/electron/img/icons/256x256.png=/usr/share/icons/hicolor/256x256/apps/anytype.png /home/abijeet/Projects/Personal/anytype-ts/electron/img/icons/512x512.png=/usr/share/icons/hicolor/512x512/apps/anytype.png /home/abijeet/Projects/Personal/anytype-ts/electron/img/icons/1024x1024.png=/usr/share/icons/hicolor/1024x1024/apps/anytype.png /tmp/t-d3cex3/5-Anytype.desktop=/usr/share/applications/anytype.desktop
                    workingDir=

Abijeet avatar Aug 19 '24 13:08 Abijeet

error: Auth token is required for this request. Please run `sentry-cli login` and try again!

Try to run it like this ELECTRON_SKIP_SENTRY=1 npm run dist:linuxarm to skip sentry hook. And if you want to build only AppImage you can remove deb target from package.json

"linux": {
			"icon": "electron/img/icons",
			"category": "Utility",
			"target": [
				"AppImage",
				"deb",
				"rpm",
				"tar.gz"
			],

But I do not think it will build anything since it tries to use ruby for x86.

ra3orblade avatar Aug 20 '24 06:08 ra3orblade

Here is the doc on Linux builds https://www.electronjs.org/docs/latest/development/build-instructions-linux https://www.electronjs.org/docs/latest/development/build-instructions-gn

ra3orblade avatar Aug 20 '24 06:08 ra3orblade

You can try, middleware builds arm version I think and it should already correctly download the required arch release in update.sh

Since https://github.com/anyproto/anytype-heart/releases/tag/v0.35.6 the linux-arm64 builds are not being released, so the update.sh script no longer works.

$ ./update.sh ubuntu-latest arm
Arch: linux-arm
Folder: linux-arm
Version: "v0.36.4"
Found asset: null
Downloading file...Done
Uncompressing...
gzip: stdin: not in gzip format
tar: Child returned status 1
tar: Error is not recoverable: exiting now
Done
Moving...
mv: cannot stat 'grpc-server': No such file or directory
mv: cannot stat 'protobuf/*': No such file or directory
mv: cannot stat 'json/*': No such file or directory
Done

Would the older version of the middle-ware work with newer versions of the app?

Abijeet avatar Oct 31 '24 06:10 Abijeet