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

Arm64 build process for ci #1887

Merged
merged 46 commits into from
Mar 8, 2019
Merged
Show file tree
Hide file tree
Changes from 41 commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
620c3eb
Arm64 build process for ci
afinch7 Mar 5, 2019
adbf4f8
Added sysroot install to build script
afinch7 Mar 5, 2019
6364e4c
Arm build before linux cargo
afinch7 Mar 5, 2019
ed23bab
Fixed typo in dockerfile
afinch7 Mar 5, 2019
759e931
Added quotes here
afinch7 Mar 5, 2019
9f1c739
Fixed issue with installing sysroot.
afinch7 Mar 5, 2019
c518671
Moved build out of docker
afinch7 Mar 5, 2019
eb861f5
This should be home not root.
afinch7 Mar 5, 2019
8912aff
Added build args to setup and cargo build
afinch7 Mar 5, 2019
fdee970
Added apt update.
afinch7 Mar 6, 2019
a60d530
Changed multilib version
afinch7 Mar 6, 2019
6f3d673
Wait a little longer for this to fail.
afinch7 Mar 6, 2019
de65454
Extend wait and remove setup before build
afinch7 Mar 6, 2019
d25e5d1
Verbose build to keep travis from timing out.
afinch7 Mar 6, 2019
9804a92
Added back setup to before_script
afinch7 Mar 6, 2019
282f994
Set linker with env var
afinch7 Mar 6, 2019
d34d3da
Merge remote-tracking branch 'upstream/master' into arm-builds-ci
afinch7 Mar 6, 2019
d932d13
Changed gcc version
afinch7 Mar 6, 2019
0b129ea
Added seperate gn build group without snapshots
afinch7 Mar 6, 2019
99c0379
Fixed some issues with submodules
afinch7 Mar 6, 2019
1476ec4
Fixed deployment scripts
afinch7 Mar 6, 2019
92e35f2
fmt
afinch7 Mar 6, 2019
bd09e94
Fixed gzip command
afinch7 Mar 6, 2019
4852932
Merge remote-tracking branch 'upstream/master' into arm-builds-ci
afinch7 Mar 6, 2019
49dab37
Added ls to build for debug
afinch7 Mar 6, 2019
cde9b5b
Removed release, and added some other test commands.
afinch7 Mar 7, 2019
1f42601
Use CARGO_TARGET_DIR to find binary for gzip.
afinch7 Mar 7, 2019
618d71c
Fixed some submodule stuffs
afinch7 Mar 7, 2019
cffa6c9
Added in virtulized tests.
afinch7 Mar 7, 2019
23bd502
Arm64 tests with qemu expect bugs
afinch7 Mar 7, 2019
cf7388a
Fixed typo
afinch7 Mar 7, 2019
732004c
Simplified testing emulation
afinch7 Mar 7, 2019
316eca0
Fixed error in mv command
afinch7 Mar 7, 2019
b4f0eb6
Fixed build path for cross compiled builds in build.rs and fixed some…
afinch7 Mar 7, 2019
0e1a6e4
fmt
afinch7 Mar 7, 2019
70c38b7
Fixed some other tests stuff commented out test for now. Will fix later
afinch7 Mar 7, 2019
7cd3a2f
qemu-user-binfmt
afinch7 Mar 8, 2019
b5c0c45
Revert changes to tools.
afinch7 Mar 8, 2019
4067dee
Removed whitespace here
afinch7 Mar 8, 2019
46927e7
Added some comments and added another variable in build.rs for nonsta…
afinch7 Mar 8, 2019
7820d5f
Merge remote-tracking branch 'upstream/master' into arm-builds-ci
afinch7 Mar 8, 2019
136040d
Format and renamed some variables in build.rs
afinch7 Mar 8, 2019
420a0be
Some backslashes for .travis.yml
afinch7 Mar 8, 2019
d97c1ff
Fixed accidental changes to submodules
afinch7 Mar 8, 2019
844db3a
Added some more detailed comments to build.rs
afinch7 Mar 8, 2019
5ac3ed4
Removed rename tests binary from .travis.yml
afinch7 Mar 8, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 30 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ script:
jobs:
fast_finish: true
include:
- name: "gn release mac"
- name: "gn release mac x86_64"
os: osx
after_success:
- &gzip_release
Expand All @@ -93,7 +93,7 @@ jobs:
repo: denoland/deno
skip-cleanup: true

- name: "gn release linux"
- name: "gn release linux x86_64"
os: linux
after_success:
- *gzip_release
Expand All @@ -109,12 +109,38 @@ jobs:
branch: master
repo: denoland/deno
skip-cleanup: true

- name: "cargo release linux arm64"
os: linux
dist: xenial
script:
- rustup target add aarch64-unknown-linux-gnu
- sudo apt update
- |-
sudo apt -yq --no-install-suggests --no-install-recommends install
g++-5-aarch64-linux-gnu gcc-5-aarch64-linux-gnu g++-5-multilib
libc6-arm64-cross
afinch7 marked this conversation as resolved.
Show resolved Hide resolved
- build/linux/sysroot_scripts/install-sysroot.py --arch=arm64
- export DENO_BUILD_ARGS="target_cpu=\"arm64\" v8_target_cpu=\"arm64\""
- export CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER="/usr/bin/aarch64-linux-gnu-gcc-5"
- export CC_aarch64_unknown_linux_gnu="/usr/bin/aarch64-linux-gnu-gcc-5"
- cargo build -vv --target=aarch64-unknown-linux-gnu --release --locked
afinch7 marked this conversation as resolved.
Show resolved Hide resolved
- cargo build -vv --target=aarch64-unknown-linux-gnu --release --tests --locked
- |-
mv $(find $CARGO_TARGET_DIR/aarch64-unknown-linux-gnu/release
-maxdepth 1 -type f -executable -regextype sed -regex
'.*/[a-z_]*-[0-9a-f]*')
afinch7 marked this conversation as resolved.
Show resolved Hide resolved
$CARGO_TARGET_DIR/aarch64-unknown-linux-gnu/release/test_rs
afinch7 marked this conversation as resolved.
Show resolved Hide resolved
- sudo apt -yq install qemu qemu-user binfmt-support qemu-user-binfmt
- sudo ln -s /usr/aarch64-linux-gnu/lib/ld-linux-aarch64.so.1 /lib/ld-linux-aarch64.so.1
- export QEMU_LD_PREFIX=/usr/aarch64-linux-gnu
- $CARGO_TARGET_DIR/aarch64-unknown-linux-gnu/release/deno tests/002_hello.ts
# - DENO_BUILD_MODE=release ./tools/test.py $CARGO_TARGET_DIR/aarch64-unknown-linux-gnu/release TODO(afinch7): Get the tests working
afinch7 marked this conversation as resolved.
Show resolved Hide resolved

- name: "cargo release linux"
- name: "cargo release linux x86_64"
os: linux
script:
- cargo build -vv --release --locked

# LSAN: We are in the process of getting a completely clean LSAN build,
# but it will take some work. So for now we just run a subset of the
# tests. We want to detect leaks during the build process as well as
Expand Down
13 changes: 13 additions & 0 deletions BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,19 @@ group("deno_deps") {
]
}

# Optimized dependencies for cross compiled builds.
# This can be removed once we get snapshots into cross compiled builds.
group("deno_deps_cross") {
testonly = true
deps = [
":compiler_bundle",
":main_bundle",
":msg_rs",
"libdeno:libdeno_static_lib",
"libdeno:test_cc",
]
}

# Reads the cargo info from Cargo.toml
deno_cargo_info = exec_script("build_extra/rust/get_cargo_info.py",
[ rebase_path("Cargo.toml", root_build_dir) ],
Expand Down
34 changes: 25 additions & 9 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,26 @@ fn main() {
env::var("PROFILE").unwrap()
};

// Equivalent to target arch != host arch
let is_cross_compile = env::var("CARGO_CFG_TARGET_ARCH").unwrap().as_str()
Copy link
Member

Choose a reason for hiding this comment

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

I would suggest let is_cross_compile = env::var("TARGET") != env::var("HOST");

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This might not have the intended effect. Some targets might vary from host, but will still be compatible with the host. I.E. x86_64-unknown-linux-musl

Copy link
Contributor Author

Choose a reason for hiding this comment

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

is_cross_compile might be a bad name for this one.

!= env::var("HOST")
.unwrap()
.as_str()
.split("-")
.collect::<Vec<&str>>()[0];

// If we are not using a standard target
let is_nonstandard_target = env::var("TARGET").unwrap() != env::var("HOST").unwrap();

let cwd = env::current_dir().unwrap();
let gn_out_path = cwd.join(format!("target/{}", gn_mode));
// If not using standard target tell gn to use the correct directory
let gn_out_path = cwd.join(format!(
"target/{}",
match is_nonstandard_target {
false => gn_mode.clone(),
true => format!("{}/{}", env::var("TARGET").unwrap(), gn_mode.clone()),
}
));
let gn_out_dir = normalize_path(&gn_out_path);

// Tell Cargo when to re-run this file. We do this first, so these directives
Expand Down Expand Up @@ -56,8 +74,11 @@ fn main() {
println!("cargo:rustc-cfg=feature=\"check-only\"");
} else {
// "Full" (non-RLS) build.
gn_target = "deno_deps";

if is_cross_compile {
gn_target = "deno_deps_cross";
} else {
gn_target = "deno_deps";
}
// Link with libdeno.a/.lib, which includes V8.
println!("cargo:rustc-link-search=native={}/obj/libdeno", gn_out_dir);
if cfg!(target_os = "windows") {
Expand All @@ -77,12 +98,7 @@ fn main() {
}

// If target_arch != host_arch disable snapshots since we are cross compiling.
if env::var("CARGO_CFG_TARGET_ARCH").unwrap().as_str() != env::var("HOST")
.unwrap()
.as_str()
.split("-")
.collect::<Vec<&str>>()[0]
{
if is_cross_compile {
// no-snapshot-init is not related to v8_use_snapshots
println!("cargo:rustc-cfg=feature=\"no-snapshot-init\"");
}
Expand Down
8 changes: 4 additions & 4 deletions src/isolate_init.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ pub fn deno_isolate_init() -> IsolateInit {
}
} else {
debug!("Deno isolate init with snapshots.");
#[cfg(not(feature = "check-only"))]
#[cfg(not(any(feature = "check-only", feature = "no-snapshot-init")))]
let data =
include_bytes!(concat!(env!("GN_OUT_DIR"), "/gen/snapshot_deno.bin"));
#[cfg(feature = "check-only")]
#[cfg(any(feature = "check-only", feature = "no-snapshot-init"))]
let data = vec![];

unsafe {
Expand Down Expand Up @@ -62,10 +62,10 @@ pub fn compiler_isolate_init() -> IsolateInit {
}
} else {
debug!("Deno isolate init with snapshots.");
#[cfg(not(feature = "check-only"))]
#[cfg(not(any(feature = "check-only", feature = "no-snapshot-init")))]
let data =
include_bytes!(concat!(env!("GN_OUT_DIR"), "/gen/snapshot_compiler.bin"));
#[cfg(feature = "check-only")]
#[cfg(any(feature = "check-only", feature = "no-snapshot-init"))]
let data = vec![];

unsafe {
Expand Down