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

ARM building support #1074

Closed
wants to merge 15 commits into from
Closed

ARM building support #1074

wants to merge 15 commits into from

Conversation

sr229
Copy link
Contributor

@sr229 sr229 commented Oct 14, 2019

This allows building for ARM using Travis's new Multiarch support. This will supersede ALL PRs I had for ARM support.

Resolves #35 and requires coder/nbin#25.

sr229 and others added 4 commits September 21, 2019 03:37
This is the same PR but with some fixes for v2.

Co-Authored-by: nwtnsqrd <noreply@github.com>
Signed-off-by: Ayane Satomi <chinodesuuu@gmail.com>
 this will replace my previous ARM PRs

Signed-off-by: Ayane Satomi <sr229@coder.com>
Copy link
Member

@code-asher code-asher left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very cool. 🎉

.travis.yml Show resolved Hide resolved
.travis.yml Outdated Show resolved Hide resolved
.travis.yml Outdated Show resolved Hide resolved
.travis.yml Outdated Show resolved Hide resolved
Ayane Satomi added 9 commits October 23, 2019 13:24
Signed-off-by: Ayane Satomi <sr229@coder.com>
Signed-off-by: Ayane Satomi <sr229@coder.com>
Signed-off-by: Ayane Satomi <sr229@coder.com>
Signed-off-by: Ayane Satomi <sr229@coder.com>
Signed-off-by: Ayane Satomi <sr229@coder.com>
Signed-off-by: Ayane Satomi <sr229@coder.com>
Signed-off-by: Ayane Satomi <sr229@coder.com>
Signed-off-by: Ayane Satomi <sr229@coder.com>
@SpinningK
Copy link

I want to turn my Android phone to a server and code on my ipad. I check this PR every day👻

@mirsella
Copy link

me too @SpinningK, my rpi4. you can 1) activate notification when a new release is uploaded, and 2) you can also activate notification for all new message on this particular thread. hope it helps

@sr229
Copy link
Contributor Author

sr229 commented Nov 1, 2019

Might need to trial out ARM builds first in my LKGR repo first before merging this so if anyone's interested I'll be releasing builds there first.

@Akarys42
Copy link

Akarys42 commented Nov 5, 2019

Hi, I hope this will be merged soon! @sr229 you said we can download build in your LKGR repo in the meantime, but I can't find it. Do you have any link please?

@sr229
Copy link
Contributor Author

sr229 commented Nov 6, 2019

Hi, I hope this will be merged soon! @sr229 you said we can download build in your LKGR repo in the meantime, but I can't find it. Do you have any link please?

Right here chief. It'll take a while to run ARM builds though since we haven't built nbin to do package builds yet.

@SpinningK
Copy link

Any progress?

@deftdawg
Copy link

deftdawg commented Nov 20, 2019

The Alpine Arm build failed because the environment is missing the libsecret-dev package... I'm in the process if trying to manually build this branch now.

@deftdawg
Copy link

On Android I can make it as far as yarn watch in the build instructions, but then gulp kills itself after exceeding the system file watch limits ENOSPC. Trying to yarn start it without having completed the compile also fails...

Is there another way to get it to compile without watching all the files for changes (I assume that's what yarn watch is doing)?

Unfortunately, there's no easy way to override the fs.inotify.max_user_watches value on a non-rooted Android device.

In any case, I'll try to build a Pi as well, if I get a chance. 😞

@code-asher
Copy link
Member

@deftdawg You might have better luck with the build instructions (https://github.com/cdr/code-server#build) instead of the development instructions. You won't need yarn watch if you're just building.

@deftdawg
Copy link

@code-asher, I gave those instructions a try... modifying package.json to point at @sr229 's nbin package, but unfortunately, it fails to find nbin and I'm too much of a node noob to understand why.

These are my steps

git clone https://github.com/cdr/code-server.git
cd code-server
git checkout sr229/travis-arm
sed -ie 's=@coder/nbin": "^1.2.2=@coder/nbin": "github:sr229/nbin#sr229/travis-arm=' package.json
yarn build "1.39.2" "deftdawg-android-1.39.2"

And this is how yarn dies:

yarn run v1.16.0
$ yarn && yarn runner build 1.39.2 deftdawg-android-1.39.2
[1/4] Resolving packages...
[2/4] Fetching packages...
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.
[3/4] Linking dependencies...
warning " > @coder/logger@1.1.8" has unmet peer dependency "@google-cloud/logging@^4.5.2".
warning "@coder/nbin > @coder/logger@1.1.11" has unmet peer dependency "@google-cloud/logging@^4.5.2".
[4/4] Building fresh packages...
success Saved lockfile.
$ cd ./scripts && node --max-old-space-size=32384 -r ts-node/register ./build.ts build 1.39.2 deftdawg-android-1.39.2
Error: Cannot find module '@coder/nbin'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)
    at Function.Module._load (internal/modules/cjs/loader.js:562:25)
    at Module.require (internal/modules/cjs/loader.js:692:17)
    at require (internal/modules/cjs/helpers.js:25:18)
    at Object.<anonymous> (/source/code-server/scripts/build.ts:1:1)
    at Module._compile (internal/modules/cjs/loader.js:778:30)
    at Module.m._compile (/source/code-server/node_modules/ts-node/src/index.ts:493:23)
    at Module._extensions..js (internal/modules/cjs/loader.js:789:10)
    at Object.require.extensions.(anonymous function) [as .ts] (/source/code-server/node_modules/ts-node/src/index.ts:496:12)
    at Module.load (internal/modules/cjs/loader.js:653:32)
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.

@Merith-TK
Copy link
Contributor

@deftdawg interesting, it just states that it is missing a dependancy, try installing that dependancy and try again?

@deftdawg
Copy link

@deftdawg interesting, it just states that it is missing a dependancy, try installing that dependancy and try again?

@Merith-TK yeah cool, like how?

I tried this:
npm install "github:sr229/nbin#sr229/travis-arm" --loglevel verbose
which installed after 64minutes on my phone, same error (both with and without -g global option).

I added:
"@google-cloud/logging": "^4.5.2",
to packages.json's devDependencies and that made the warning about cloud logging go away, but still can't find nbin

I tried adding
"@coder/nbin": "github:sr229/nbin#sr229/travis-arm",
to both dependencies and devDependencies in scripts/packages.json, however that had no effect.

Feel like this should be a very easy thing to solve, but I don't really know node very well and my google searches haven't turned up anything helpful... just stuff like rm -rf node_modules which I have already tried.

@sr229
Copy link
Contributor Author

sr229 commented Nov 27, 2019

There isn't much change in my ARM branch so don't point it there, I'll be working on a experimental distribution format for a bit for ARM since compiling it for the architecture requires a custom gcc toolchain.

Not a pleasant experience but I'll get around it soon.

@code-asher
Copy link
Member

@deftdawg yeah I'd recommend just building from master and not modifying anything. You should be able to just do something similar to this:

git clone https://github.com/cdr/code-server.git
cd code-server
yarn build "1.39.2" "android"
node ./build/code-server*/out/vs/server/main.js

So basically you'll just run the compiled JavaScript files with node. You won't be able to package into a binary since nbin doesn't support that architecture yet.

@Akarys42
Copy link

Akarys42 commented Dec 9, 2019

Here is the build output I get while doing sudo yarn build 1.39.2 arm after adding a lot of missing packages, still doesn’t work. Any fix for it?
CAC22BB7-3E9F-42D1-A5EA-641EB2EF693C

@code-asher
Copy link
Member

I think the build script swallows some error output. You could try running that command manually in the root VS Code directory and it might show you what's really going on: yarn gulp compile-extensions-build --max-old-space-size=32384.

@code-asher
Copy link
Member

You can also run yarn in the root VS Code directory when there are missing dependencies, although there should only be missing dependencies if the build is cancelled while it's installing because then on the next run it sees that node_modules exists and doesn't try to install again. Actually I'll fix that right now so it always runs yarn.

@deftdawg
Copy link

deftdawg commented Dec 9, 2019

@code-asher's fix commit is 015a99e...

I'll cherry pick it to @sr229 's arm branch and have another go at attempting to build this with nbin/master this time.

@code-asher
Copy link
Member

@deftdawg this PR only changes the CI so there's no benefit in building against it locally. You could just build against master.

@deftdawg
Copy link

@code-asher my bad, I'll have a go against master then.

@Akarys42
Copy link

Akarys42 commented Dec 11, 2019

@code-asher I don’t really get more output with yarn gulp compile-extensions-build --max-old-space-size=32384 (I also tried yarn gulp compile-extensions-build)

377B54FC-4C4A-499C-9377-644B187B9982

@sr229
Copy link
Contributor Author

sr229 commented Dec 13, 2019

@Akarys42 I was observing this behavior as well, along with a Illegal Instruction error. @coadler and I are gonna attempt it on a ARM64 VM and see if we can compile it.

@Akarys42
Copy link

Akarys42 commented Dec 13, 2019 via email

@deftdawg
Copy link

deftdawg commented Jan 3, 2020

@Akarys42 I'm getting "SIGKILL" as well... best I can figure it is the OS killing yarn because max-old-space-size is set to 32GB on my 4GB RPi4 (exit code 137 is out of memory).

image

I'm going to try with setting --max-old-space-size to 3096 (3GB) in package.json and see if that helps.

@deftdawg
Copy link

deftdawg commented Jan 4, 2020

Reducing max-old-space-size did not work.

I did however have success building it in a aarch64 alpine Docker container running under qemu-aarch64-static... The x86-64 host machine had 64GB of RAM and I estimate the build required 10GB of memory to complete.

The same machine only reported 2GB free with an arm Docker container, so will need to figure out how to get past that for an arm 32-bit build.

@mirsella
Copy link

mirsella commented Jan 4, 2020

@deftdawg make a 12GB swap can work ?

@code-asher
Copy link
Member

code-asher commented Jan 6, 2020 via email

@deftdawg
Copy link

deftdawg commented Jan 6, 2020

@code-asher

Yarn complains about using node >8 or >11. For my successful build, I used Alpine 3.9 inside a Docker container with qemu-aarch64-static registered to build Master on an x86-64. Then I scp'ed the full code-server directory and started it on a Raspbery Pi 4 running aarch64.

Newer versions of Alpine didn't work inside of Docker on x86-64, node will fail to compile while QEMU spits up (alpinelinux/docker-alpine#48).

Screenshot of it running:

image

I'm not sure how we can get this built on Arm32v7 though, I think qemu-arm-static maybe has some 2GB memory limit or something on 32-bit... I searched for Arm 32 machines with lots of ram and the only one I could find is an older QNAP NAS w/ a Coretex-A15 and DDR3 ram slots for up to 16gb.

@sr229
Copy link
Contributor Author

sr229 commented Jan 7, 2020

Closing since we found a better way now :3c

@sr229 sr229 closed this Jan 7, 2020
@sr229 sr229 deleted the sr229/travis-arm branch January 7, 2020 18:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ARM binary release
7 participants