Issue 1:
Problem summery

I cannot install deno in a docker container. Here is what I've tried:

install script

$ curl -fsSL https://deno.land/x/install/install.sh | sh
Deno was installed successfully to /root/.deno/bin/deno

$ deno
zsh: exec format error: deno

cargo install

$ cargo --version
cargo 1.58.0 (7f08ace4f 2021-11-24)

$ cargo install deno --locked
...
error: failed to compile `deno v1.17.3`, intermediate artifacts can be found at `/tmp/cargo-install03hoSN`

Caused by:
could not compile `deno`

Caused by:
process didn't exit successfully: `rustc --crate-name deno --edition=2021 /root/.cargo/registry/src/github.com-1ecc6299db9ec823/deno-1.17.3/main.rs --error-format=json --json=diagnostic-rendered-ansi --crate-type bin --emit=dep-info,link -C opt-level=3 -C embed-bitcode=no -C metadata=1f1c0990b85e63cd -C extra-filename=-1f1c0990b85e63cd --out-dir /tmp/cargo-install03hoSN/release/deps -L dependency=/tmp/cargo-install03hoSN/release/deps --extern atty=/tmp/cargo-install03hoSN/release/deps/libatty-4ca99d75fc4afeac.rlib --extern base64=/tmp/cargo-install03hoSN/release/deps/libbase64-d28f00246089566e.rlib --extern cache_control=/tmp/cargo-install03hoSN/release/deps/libcache_control-5c083f7e46a3a267.rlib --extern chrono=/tmp/cargo-install03hoSN/release/deps/libchrono-d7c1e1b14e054cb5.rlib --extern clap=/tmp/cargo-install03hoSN/release/deps/libclap-ee1e636161eec735.rlib --extern data_url=/tmp/cargo-install03hoSN/release/deps/libdata_url-ffd1e3b6c59321c3.rlib --extern deno_ast=/tmp/cargo-install03hoSN/release/deps/libdeno_ast-e78d45bf92a6010c.rlib --extern deno_core=/tmp/cargo-install03hoSN/release/deps/libdeno_core-d3d6c286afc0159f.rlib --extern deno_doc=/tmp/cargo-install03hoSN/release/deps/libdeno_doc-60198b2d52405ce2.rlib --extern deno_graph=/tmp/cargo-install03hoSN/release/deps/libdeno_graph-4db7a5e99d0f5d9d.rlib --extern deno_lint=/tmp/cargo-install03hoSN/release/deps/libdeno_lint-0acc40d0782ff7b8.rlib --extern deno_runtime=/tmp/cargo-install03hoSN/release/deps/libdeno_runtime-e8b49a87f7f0fa28.rlib --extern dissimilar=/tmp/cargo-install03hoSN/release/deps/libdissimilar-e63dd43ec4866c59.rlib --extern dprint_plugin_json=/tmp/cargo-install03hoSN/release/deps/libdprint_plugin_json-e2d714280fad4f6c.rlib --extern dprint_plugin_markdown=/tmp/cargo-install03hoSN/release/deps/libdprint_plugin_markdown-a1f87a9a7a7ecd89.rlib --extern dprint_plugin_typescript=/tmp/cargo-install03hoSN/release/deps/libdprint_plugin_typescript-a6879a335c708e5f.rlib --extern encoding_rs=/tmp/cargo-install03hoSN/release/deps/libencoding_rs-2417e5640c704bcb.rlib --extern env_logger=/tmp/cargo-install03hoSN/release/deps/libenv_logger-da753f5c37b1b392.rlib --extern fancy_regex=/tmp/cargo-install03hoSN/release/deps/libfancy_regex-14dd253db9d191e3.rlib --extern http=/tmp/cargo-install03hoSN/release/deps/libhttp-261d3f1761718ac6.rlib --extern import_map=/tmp/cargo-install03hoSN/release/deps/libimport_map-4a5386a1e3b6770b.rlib --extern jsonc_parser=/tmp/cargo-install03hoSN/release/deps/libjsonc_parser-41580e29a8b7d38b.rlib --extern libc=/tmp/cargo-install03hoSN/release/deps/liblibc-91d06b1bde96cecd.rlib --extern log=/tmp/cargo-install03hoSN/release/deps/liblog-bafb27118f6409cf.rlib --extern lspower=/tmp/cargo-install03hoSN/release/deps/liblspower-de9f6a790a1ca491.rlib --extern notify=/tmp/cargo-install03hoSN/release/deps/libnotify-af73e75fddd9deb7.rlib --extern num_cpus=/tmp/cargo-install03hoSN/release/deps/libnum_cpus-920ee78dfd09d8ec.rlib --extern once_cell=/tmp/cargo-install03hoSN/release/deps/libonce_cell-b05ef1fb694171f8.rlib --extern percent_encoding=/tmp/cargo-install03hoSN/release/deps/libpercent_encoding-3963a5f7b0bc64ba.rlib --extern pin_project=/tmp/cargo-install03hoSN/release/deps/libpin_project-328f24a44d4d3da3.rlib --extern rand=/tmp/cargo-install03hoSN/release/deps/librand-b4c52f196298cd52.rlib --extern regex=/tmp/cargo-install03hoSN/release/deps/libregex-3fd935d06ccdb69b.rlib --extern ring=/tmp/cargo-install03hoSN/release/deps/libring-39b3a0e1b24dc8c4.rlib --extern rustyline=/tmp/cargo-install03hoSN/release/deps/librustyline-4f64ab9daf82002e.rlib --extern rustyline_derive=/tmp/cargo-install03hoSN/release/deps/librustyline_derive-da5d770779d15e90.so --extern semver_parser=/tmp/cargo-install03hoSN/release/deps/libsemver_parser-4bf4dd4b8f720e1c.rlib --extern serde=/tmp/cargo-install03hoSN/release/deps/libserde-a4afd6832cbb73de.rlib --extern shell_escape=/tmp/cargo-install03hoSN/release/deps/libshell_escape-a7268498298d47d9.rlib --extern sourcemap=/tmp/cargo-install03hoSN/release/deps/libsourcemap-3620a1cfdeeb5de2.rlib --extern tempfile=/tmp/cargo-install03hoSN/release/deps/libtempfile-e17a77263d6f4a0a.rlib --extern text_size=/tmp/cargo-install03hoSN/release/deps/libtext_size-82d43970e9c9065a.rlib --extern text_lines=/tmp/cargo-install03hoSN/release/deps/libtext_lines-363e440556091276.rlib --extern tokio=/tmp/cargo-install03hoSN/release/deps/libtokio-3e0a45ac81bdfe4f.rlib --extern typed_arena=/tmp/cargo-install03hoSN/release/deps/libtyped_arena-7facb343436693cd.rlib --extern uuid=/tmp/cargo-install03hoSN/release/deps/libuuid-eed30c67f4c9eb8d.rlib --extern walkdir=/tmp/cargo-install03hoSN/release/deps/libwalkdir-f62f207390a87e39.rlib --cap-lints allow -L /tmp/cargo-install03hoSN/release/gn_out/obj -L native=/tmp/cargo-install03hoSN/release/build/ring-fb737f9aa437b798/out -L /tmp/cargo-install03hoSN/release/build/libffi-sys-71ef03a069068459/out/libffi-root/lib -L /tmp/cargo-install03hoSN/release/build/libffi-sys-71ef03a069068459/out/libffi-root/lib64 -L native=/tmp/cargo-install03hoSN/release/build/libsqlite3-sys-60762d2c6263e170/out -L native=/tmp/cargo-install03hoSN/release/build/sys-info-5764e84cf674759b/out` (signal: 9, SIGKILL: kill)

(copy the binary installed in host)

$ deno
zsh: exec format error: deno

Environment

Host

macOS 12.1

Apple M1 Chip

docker 20.10

Container

Ubuntu 20.04

aarch64

Issue 2:
Builds for arm64 are now in CI, but are not ready for release. We still need to make some changes to make the tests work with this build.

I managed to get deno to build for arm64 using the aarch64-unknown-linux-gnu target. Currently It doesn't execute successfully on a raspberry pi 3b+ running a preview image of debian buster arm64/aarch64. It gives me the following print out:

root@rpi3:~/deno-build# ./deno https://deno.land/welcome.ts
#
# Fatal error in , line 0
# unreachable code
#
#
#
#FailureMessage Object: 0xfffff58d4d10
==== C stack trace ===============================

./deno(+0x8ad5fc) [0xaaaaafc445fc]
./deno(+0x9dd72c) [0xaaaaafd7472c]
./deno(+0x8a9f10) [0xaaaaafc40f10]
./deno(+0x83aa08) [0xaaaaafbd1a08]
./deno(+0x69c070) [0xaaaaafa33070]
./deno(+0x7bdbb4) [0xaaaaafb54bb4]
./deno(+0x7bdb00) [0xaaaaafb54b00]
./deno(+0x7bc6bc) [0xaaaaafb536bc]
./deno(+0x7bd9f8) [0xaaaaafb549f8]
./deno(+0x7bbbb8) [0xaaaaafb52bb8]
./deno(+0x2165dc) [0xaaaaaf5ad5dc]
./deno(+0x7c0be4) [0xaaaaafb57be4]
./deno(+0x663f68) [0xaaaaaf9faf68]
./deno(+0x7c0124) [0xaaaaafb57124]
./deno(+0x1c8e80) [0xaaaaaf55fe80]
./deno(+0x1c8f68) [0xaaaaaf55ff68]
./deno(+0x1b3dec) [0xaaaaaf54adec]
./deno(+0xce2f0) [0xaaaaaf4652f0]
./deno(+0x112b78) [0xaaaaaf4a9b78]
./deno(+0x11ef74) [0xaaaaaf4b5f74]
./deno(+0xb80c38) [0xaaaaaff17c38]
./deno(+0xb8fcf4) [0xaaaaaff26cf4]
./deno(+0xb814ec) [0xaaaaaff184ec]
./deno(+0x112d50) [0xaaaaaf4a9d50]
/lib/aarch64-linux-gnu/libc.so.6(__libc_start_main+0xe4) [0xffff8644ed24]
./deno(+0xbae4c) [0xaaaaaf451e4c]

I opened up the executable with a arm compatible disassembler, and located the last call from within deno before failure, 0x1b3dec. It looks like this call occurs here

deno/libdeno/api.cc

Line 54
in
b8a537d

v8::Isolate* isolate = v8::Isolate::New(params);

This leads me to suspect an issue with loading the snapshot.

I managed to get this working successfully with the changes in [my forked branch](https://github.com/afinch7/deno/tree/arm-builds).

To replicate my arm64 build you will need docker installed.

Then it should be as simple as:

Add the following options to .gn

target_cpu = "arm64"
v8_target_cpu = "arm64"

Add the following to Dockerfile in your deno repo root

FROM ubuntu:bionic

RUN apt update && apt install -y curl

RUN curl https://sh.rustup.rs -sSf | sh -s -- -y

RUN /root/.cargo/bin/rustup target add aarch64-unknown-linux-gnu

RUN echo "[target.aarch64-unknown-linux-gnu]\nlinker = \"aarch64-linux-gnu-gcc\"" > /root/.cargo/config

RUN apt install -y nodejs yarn python build-essential cmake make

RUN apt -yq --no-install-suggests --no-install-recommends install g++-aarch64-linux-gnu gcc-aarch64-linux-gnu g++-7-multilib libc6-arm64-cross

WORKDIR /deno

RUN echo "source $HOME/.cargo/env" > /root/.bash

CMD ["/bin/bash", "--init-file", "/root/.bash"]

Run docker build -f Dockerfile -t deno-arm64-build . && docker run -it -v "$PWD/:/deno" -u $(id -u root):$(id -g ${USER}) deno-arm64-build in your deno repo root. This should build a docker image with the required tools and drop you into a bash shell on said image with your deno repo mounted at /deno.

From this point you simply need to run cargo build --target=aarch64-unknown-linux-gnu --release

Once the build completes the executable should be located at target/aarch64-unknown-linux-gnu/release/deno

I wasn't able to get a build working with tools/build.py, since I couldn't find a way to specify a target for rust it might be possible to use env vars like CC, AR, CFLAGS, etc. I might try that at some point, but I'm putting my efforts into figuring out if the snapshots are even being included in the build correctly right now.

I not sure what changed, but I can't get the build to work anymore with docker. I can still get this to work outside of docker though. I'm working on getting this into CI see #1887. The main problem with getting this into CI is how long it takes to build.

Edit: fixed some issues with the Dockerfile

Edit: added the current user group to the docker run command so this doesn't break your repo as much

Edit: my forked branch has modifications to make this work now