updates and aarch64-unknown-linux-gnu build in earthly

This commit is contained in:
John Smith 2022-01-10 22:36:54 -05:00
parent 124bddfe17
commit 02c0d065ef
10 changed files with 149 additions and 125 deletions

7
.cargo/config.toml Normal file
View File

@ -0,0 +1,7 @@
[target.aarch64-unknown-linux-gnu]
# ar = "aarch64-linux-gnu-ar"
linker = "aarch64-linux-gnu-gcc"
[target.aarch64-linux-android]
#ar = "$ANDROID_NDK_HOME/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android-ar"
linker = "$ANDROID_NDK_HOME/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android-clang"

95
Cargo.lock generated
View File

@ -116,15 +116,6 @@ dependencies = [
"log", "log",
] ]
[[package]]
name = "ansi_term"
version = "0.12.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d52a9bb7ec0cf484c551830a7ce27bd20d67eac647e1befb56b0be4ee39a55d2"
dependencies = [
"winapi",
]
[[package]] [[package]]
name = "anyhow" name = "anyhow"
version = "1.0.52" version = "1.0.52"
@ -686,13 +677,24 @@ version = "2.34.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a0610544180c38b88101fecf2dd634b174a62eef6946f84dfc6a7127512b381c" checksum = "a0610544180c38b88101fecf2dd634b174a62eef6946f84dfc6a7127512b381c"
dependencies = [ dependencies = [
"ansi_term", "bitflags",
"textwrap 0.11.0",
"unicode-width",
]
[[package]]
name = "clap"
version = "3.0.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1957aa4a5fb388f0a0a73ce7556c5b42025b874e5cdc2c670775e346e97adec0"
dependencies = [
"atty", "atty",
"bitflags", "bitflags",
"strsim 0.8.0", "indexmap",
"textwrap", "os_str_bytes",
"unicode-width", "strsim",
"vec_map", "termcolor",
"textwrap 0.14.2",
] ]
[[package]] [[package]]
@ -830,7 +832,7 @@ checksum = "1604dafd25fba2fe2d5895a9da139f8dc9b319a5fe5354ca137cbbce4e178d10"
dependencies = [ dependencies = [
"atty", "atty",
"cast", "cast",
"clap", "clap 2.34.0",
"criterion-plot", "criterion-plot",
"csv", "csv",
"itertools", "itertools",
@ -1103,7 +1105,7 @@ dependencies = [
"ident_case", "ident_case",
"proc-macro2", "proc-macro2",
"quote", "quote",
"strsim 0.10.0", "strsim",
"syn", "syn",
] ]
@ -1144,15 +1146,6 @@ dependencies = [
"generic-array", "generic-array",
] ]
[[package]]
name = "directories"
version = "3.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e69600ff1703123957937708eb27f7a564e48885c537782722ed0ba3189ce1d7"
dependencies = [
"dirs-sys",
]
[[package]] [[package]]
name = "directories" name = "directories"
version = "4.0.1" version = "4.0.1"
@ -1836,11 +1829,11 @@ dependencies = [
"android_logger", "android_logger",
"backtrace", "backtrace",
"byteorder", "byteorder",
"cfg-if 0.1.10", "cfg-if 1.0.0",
"clap", "clap 3.0.6",
"core-foundation 0.9.2", "core-foundation 0.9.2",
"core-foundation-sys 0.8.3", "core-foundation-sys 0.8.3",
"directories 4.0.1", "directories",
"fs4", "fs4",
"jni", "jni",
"keychain-services", "keychain-services",
@ -1848,14 +1841,13 @@ dependencies = [
"log", "log",
"ndk", "ndk",
"ndk-glue", "ndk-glue",
"owning_ref",
"rpassword", "rpassword",
"secret-service", "secret-service",
"security-framework", "security-framework",
"security-framework-sys", "security-framework-sys",
"serde 1.0.133", "serde 1.0.133",
"serde_cbor", "serde_cbor",
"serial_test 0.4.0", "serial_test 0.5.1",
"simplelog", "simplelog",
"snailquote", "snailquote",
"tempfile", "tempfile",
@ -2444,6 +2436,15 @@ version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5"
[[package]]
name = "os_str_bytes"
version = "6.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8e22443d1643a904602595ba1cd8f7d896afe56d26712531c5ff73a15b2fbf64"
dependencies = [
"memchr",
]
[[package]] [[package]]
name = "owning_ref" name = "owning_ref"
version = "0.4.1" version = "0.4.1"
@ -3422,12 +3423,6 @@ version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f"
[[package]]
name = "strsim"
version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a"
[[package]] [[package]]
name = "strsim" name = "strsim"
version = "0.10.0" version = "0.10.0"
@ -3522,6 +3517,12 @@ dependencies = [
"unicode-width", "unicode-width",
] ]
[[package]]
name = "textwrap"
version = "0.14.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0066c8d12af8b5acd21e00547c3797fde4e8677254a7ee429176ccebbe93dd80"
[[package]] [[package]]
name = "thiserror" name = "thiserror"
version = "1.0.30" version = "1.0.30"
@ -3760,12 +3761,6 @@ version = "0.2.15"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426"
[[package]]
name = "vec_map"
version = "0.8.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191"
[[package]] [[package]]
name = "veilid-cli" name = "veilid-cli"
version = "0.1.0" version = "0.1.0"
@ -3777,14 +3772,14 @@ dependencies = [
"capnp", "capnp",
"capnp-rpc", "capnp-rpc",
"capnpc", "capnpc",
"cfg-if 0.1.10", "cfg-if 1.0.0",
"clap", "clap 3.0.6",
"config 0.10.1", "config 0.10.1",
"crossbeam-channel", "crossbeam-channel",
"cursive", "cursive",
"cursive-flexi-logger-view", "cursive-flexi-logger-view",
"cursive_buffered_backend", "cursive_buffered_backend",
"directories 3.0.2", "directories",
"flexi_logger", "flexi_logger",
"futures", "futures",
"log", "log",
@ -3813,7 +3808,7 @@ dependencies = [
"bugsalot", "bugsalot",
"capnp", "capnp",
"capnpc", "capnpc",
"cfg-if 0.1.10", "cfg-if 1.0.0",
"chacha20poly1305", "chacha20poly1305",
"chrono", "chrono",
"config 0.11.0", "config 0.11.0",
@ -3821,7 +3816,7 @@ dependencies = [
"curve25519-dalek-ng", "curve25519-dalek-ng",
"data-encoding", "data-encoding",
"digest", "digest",
"directories 3.0.2", "directories",
"ed25519-dalek", "ed25519-dalek",
"futures-util", "futures-util",
"generic-array", "generic-array",
@ -3884,12 +3879,12 @@ dependencies = [
"capnp", "capnp",
"capnp-rpc", "capnp-rpc",
"capnpc", "capnpc",
"cfg-if 0.1.10", "cfg-if 1.0.0",
"clap", "clap 3.0.6",
"config 0.11.0", "config 0.11.0",
"ctrlc", "ctrlc",
"daemonize", "daemonize",
"directories 3.0.2", "directories",
"failure", "failure",
"futures", "futures",
"lazy_static", "lazy_static",

View File

@ -16,9 +16,15 @@ deps-base:
RUN apt-get remove -y python3.5 RUN apt-get remove -y python3.5
RUN curl https://bootstrap.pypa.io/get-pip.py | python3.8 RUN curl https://bootstrap.pypa.io/get-pip.py | python3.8
# Install Cap'n Proto
deps-capnp:
FROM +deps-base
COPY scripts/earthly/install_capnproto.sh /
RUN /bin/bash /install_capnproto.sh; rm /install_capnproto.sh
# Install Rust # Install Rust
deps-rust: deps-rust:
FROM +deps-base FROM +deps-capnp
ENV RUSTUP_HOME=/usr/local/rustup ENV RUSTUP_HOME=/usr/local/rustup
ENV CARGO_HOME=/usr/local/cargo ENV CARGO_HOME=/usr/local/cargo
ENV PATH=/usr/local/cargo/bin:$PATH ENV PATH=/usr/local/cargo/bin:$PATH
@ -37,21 +43,20 @@ deps-rust:
# WASM # WASM
RUN rustup target add wasm32-unknown-unknown RUN rustup target add wasm32-unknown-unknown
# Install Cap'n Proto # Install cross-platform tooling
deps-capnp: deps-cross:
FROM +deps-rust FROM +deps-rust
COPY scripts/earthly/install_capnproto.sh / RUN apt-get install -y gcc-aarch64-linux-gnu
RUN /bin/bash /install_capnproto.sh; rm /install_capnproto.sh
# Install stub secrets daemon for keyring tests # Install stub secrets daemon for keyring tests
deps-secretsd: deps-secretsd:
FROM +deps-capnp FROM +deps-cross
COPY scripts/earthly/secretsd /secretsd COPY scripts/earthly/secretsd /secretsd
RUN pip install -r /secretsd/requirements.txt RUN pip install -r /secretsd/requirements.txt
RUN pip install keyring RUN pip install keyring
RUN cp /secretsd/dbus/org.freedesktop.secrets.service /usr/share/dbus-1/services/org.freedesktop.secrets.service RUN cp /secretsd/dbus/org.freedesktop.secrets.service /usr/share/dbus-1/services/org.freedesktop.secrets.service
# Clean up the apt cache to save space # Clean up the apt cache to save space
deps: deps:
FROM +deps-secretsd FROM +deps-secretsd
@ -78,6 +83,10 @@ build-linux-arm64:
SAVE ARTIFACT ./target/aarch64-unknown-linux-gnu AS LOCAL ./target/artifacts/aarch64-unknown-linux-gnu SAVE ARTIFACT ./target/aarch64-unknown-linux-gnu AS LOCAL ./target/artifacts/aarch64-unknown-linux-gnu
# Unit tests # Unit tests
unit-test: unit-tests-linux-amd64:
FROM +code FROM +code
RUN cargo test --release RUN cargo test --target x86_64-unknown-linux-gnu --release
unit-tests-linux-arm64:
FROM +code
RUN cargo test --target aarch64-unknown-linux-gnu --release

@ -1 +1 @@
Subproject commit 3713e10599c6078e058aab785ef46594420dc11b Subproject commit 935ca957d7e223ef560a0b20b656730a325e0ba7

View File

@ -20,14 +20,14 @@ cursive_buffered_backend = { path = "../external/cursive_buffered_backend" }
# cursive_tree_view = "0.6.0" # cursive_tree_view = "0.6.0"
# cursive_table_view = "0.12.0" # cursive_table_view = "0.12.0"
# cursive-tabs = "0.5.0" # cursive-tabs = "0.5.0"
clap = "^2.33.2" clap = "^3"
directories = "^3" directories = "^4"
log = "^0.4" log = "^0.4"
futures = "^0.3" futures = "^0.3"
serde = "^1.0.122" serde = "^1.0.122"
serde_derive = "^1.0.122" serde_derive = "^1.0.122"
parking_lot = "^0.11" parking_lot = "^0.11"
cfg-if = "^0.1" cfg-if = "^1"
capnp = "^0.14" capnp = "^0.14"
capnp-rpc = "^0.14" capnp-rpc = "^0.14"
config = { version = "0.10.1", features = ["yaml"] } config = { version = "0.10.1", features = ["yaml"] }

View File

@ -3,7 +3,7 @@
use anyhow::*; use anyhow::*;
use async_std::prelude::*; use async_std::prelude::*;
use clap::{App, Arg}; use clap::{App, Arg, ColorChoice};
use flexi_logger::*; use flexi_logger::*;
use log::*; use log::*;
use std::ffi::OsStr; use std::ffi::OsStr;
@ -22,31 +22,32 @@ pub mod veilid_client_capnp {
fn parse_command_line(default_config_path: &OsStr) -> Result<clap::ArgMatches, anyhow::Error> { fn parse_command_line(default_config_path: &OsStr) -> Result<clap::ArgMatches, anyhow::Error> {
let matches = App::new("veilid-cli") let matches = App::new("veilid-cli")
.version("0.1") .version("0.1")
.color(ColorChoice::Auto)
.about("Veilid Console Client") .about("Veilid Console Client")
.arg( .arg(
Arg::with_name("address") Arg::new("address")
.required(false) .required(false)
.help("Address to connect to"), .help("Address to connect to"),
) )
.arg( .arg(
Arg::with_name("debug") Arg::new("debug")
.long("debug") .long("debug")
.help("Turn on debug logging"), .help("Turn on debug logging"),
) )
.arg( .arg(
Arg::with_name("wait-for-debug") Arg::new("wait-for-debug")
.long("wait-for-debug") .long("wait-for-debug")
.help("Wait for debugger to attach"), .help("Wait for debugger to attach"),
) )
.arg( .arg(
Arg::with_name("trace") Arg::new("trace")
.long("trace") .long("trace")
.conflicts_with("debug") .conflicts_with("debug")
.help("Turn on trace logging"), .help("Turn on trace logging"),
) )
.arg( .arg(
Arg::with_name("config-file") Arg::new("config-file")
.short("c") .short('c')
.takes_value(true) .takes_value(true)
.value_name("FILE") .value_name("FILE")
.default_value_os(default_config_path) .default_value_os(default_config_path)

View File

@ -18,7 +18,7 @@ capnp = { version = "^0", default_features = false }
rust-fsm = "^0" rust-fsm = "^0"
static_assertions = "^1" static_assertions = "^1"
log = "^0" log = "^0"
cfg-if = "^0" cfg-if = "^1"
anyhow = "^1" anyhow = "^1"
thiserror = "^1" thiserror = "^1"
@ -31,7 +31,7 @@ serde-big-array = "^0"
futures-util = { version = "^0", default_features = false, features = ["alloc"] } futures-util = { version = "^0", default_features = false, features = ["alloc"] }
parking_lot = "^0" parking_lot = "^0"
lazy_static = "^1" lazy_static = "^1"
directories = "^3" directories = "^4"
once_cell = "^1" once_cell = "^1"
ed25519-dalek = { version = "^1", default_features = false, features = ["alloc", "u64_backend"] } ed25519-dalek = { version = "^1", default_features = false, features = ["alloc", "u64_backend"] }

View File

@ -21,7 +21,7 @@ use tools::*;
fn get_interface_name(index: u32) -> Result<String, String> { fn get_interface_name(index: u32) -> Result<String, String> {
let mut ifnamebuf = [0u8; (IF_NAMESIZE + 1)]; let mut ifnamebuf = [0u8; (IF_NAMESIZE + 1)];
cfg_if! { cfg_if! {
if #[cfg(all(target_os = "android", any(target_arch = "arm", target_arch = "aarch64")))] { if #[cfg(all(any(target_os = "android", target_os="linux"), any(target_arch = "arm", target_arch = "aarch64")))] {
if unsafe { if_indextoname(index, ifnamebuf.as_mut_ptr()) }.is_null() { if unsafe { if_indextoname(index, ifnamebuf.as_mut_ptr()) }.is_null() {
return Err("if_indextoname returned null".to_owned()); return Err("if_indextoname returned null".to_owned());
} }

View File

@ -13,17 +13,17 @@ path = "src/main.rs"
[dependencies] [dependencies]
log = "^0" log = "^0"
simplelog = { version = "^0", features = ["test"] } simplelog = { version = "^0", features = ["test"] }
clap = "^2" clap = "^3"
async-std = { version = "^1", features = ["unstable"] } async-std = { version = "^1", features = ["unstable"] }
async-tungstenite = { version = "^0", features = ["async-std-runtime", "async-tls"] } async-tungstenite = { version = "^0", features = ["async-std-runtime", "async-tls"] }
veilid-core = { path = "../veilid-core" } veilid-core = { path = "../veilid-core" }
directories = "^3" directories = "^4"
capnp = "^0" capnp = "^0"
parking_lot = "^0" parking_lot = "^0"
capnp-rpc = "^0" capnp-rpc = "^0"
config = { version = "^0", features = ["yaml"] } config = { version = "^0", features = ["yaml"] }
failure = "^0" failure = "^0"
cfg-if = "^0" cfg-if = "^1"
serde = "^1" serde = "^1"
serde_derive = "^1" serde_derive = "^1"
serde_yaml = "^0" serde_yaml = "^0"

View File

@ -17,73 +17,82 @@ use std::time::{Duration, Instant};
use veilid_core::xx::SingleShotEventual; use veilid_core::xx::SingleShotEventual;
fn parse_command_line(default_config_path: &OsStr) -> Result<clap::ArgMatches, clap::Error> { fn parse_command_line(default_config_path: &OsStr) -> Result<clap::ArgMatches, clap::Error> {
let matches = App::new("veilid-server") let matches = App::new("veilid-server")
.version("0.1") .version("0.1")
.about("Veilid Server") .about("Veilid Server")
.color(clap::ColorChoice::Auto)
.arg( .arg(
Arg::with_name("daemon") Arg::new("daemon")
.long("daemon") .long("daemon")
.short("d") .short('d')
.help("Run in daemon mode in the background"), .help("Run in daemon mode in the background"),
) )
.arg( .arg(
Arg::with_name("subnode_index") Arg::new("config-file")
.long("subnode_index") .short('c')
.takes_value(true)
.help("Run as an extra daemon on the same machine for testing purposes, specify a number greater than zero to offset the listening ports"),
)
.arg(
Arg::with_name("debug")
.long("debug")
.help("Turn on debug logging on the terminal"),
)
.arg(
Arg::with_name("trace")
.long("trace")
.conflicts_with("debug")
.help("Turn on trace logging on the terminal"),
)
.arg(
Arg::with_name("generate-id")
.long("generate-id")
.help("Only generate a new node id and print it"),
)
.arg(
Arg::with_name("config-file")
.short("c")
.long("config-file") .long("config-file")
.takes_value(true) .takes_value(true)
.value_name("FILE") .value_name("FILE")
.default_value_os(default_config_path) .default_value_os(default_config_path)
.help("Specify a configuration file to use"), .help("Specify a configuration file to use"),
) ).arg(
.arg( Arg::new("attach")
Arg::with_name("dump-config")
.long("dump-config")
.help("Instead of running the server, print the configuration it would use to the console"),
)
.arg(
Arg::with_name("bootstrap")
.long("bootstrap")
.takes_value(true)
.value_name("BOOTSTRAP_LIST")
.help("Specify a list of bootstrap servers to use"),
)
.arg(
Arg::with_name("attach")
.long("attach") .long("attach")
.takes_value(true) .takes_value(true)
.value_name("BOOL") .value_name("BOOL")
.possible_values(&["false", "true"]) .possible_values(&["false", "true"])
.help("Automatically attach the server to the Veilid network"), .help("Automatically attach the server to the Veilid network"),
) )
; // Dev options
#[cfg(debug_assertions)] .arg(
let matches = matches.arg( Arg::new("debug")
Arg::with_name("wait-for-debug") .long("debug")
.long("wait-for-debug") .help("Turn on debug logging on the terminal"),
.help("Wait for debugger to attach"), )
); .arg(
Arg::new("trace")
.long("trace")
.conflicts_with("debug")
.help("Turn on trace logging on the terminal"),
)
.arg(
Arg::new("subnode_index")
.long("subnode_index")
.takes_value(true)
.help("Run as an extra daemon on the same machine for testing purposes, specify a number greater than zero to offset the listening ports"),
)
.arg(
Arg::new("generate-dht-key")
.long("generate-dht-key")
.help("Only generate a new dht key and print it"),
)
.arg(
Arg::new("dump-config")
.long("dump-config")
.help("Instead of running the server, print the configuration it would use to the console"),
)
.arg(
Arg::new("bootstrap")
.long("bootstrap")
.takes_value(true)
.value_name("BOOTSTRAP_LIST")
.help("Specify a list of bootstrap servers to use"),
)
.arg(
Arg::new("local")
.long("local")
.help("Enable local peer scope")
);
#[cfg(debug_assertions)]
let matches = matches.arg(
Arg::new("wait-for-debug")
.long("wait-for-debug")
.help("Wait for debugger to attach"),
);
Ok(matches.get_matches()) Ok(matches.get_matches())
} }
@ -163,6 +172,9 @@ pub async fn main() -> Result<(), String> {
if matches.is_present("attach") { if matches.is_present("attach") {
settingsrw.auto_attach = !matches!(matches.value_of("attach"), Some("true")); settingsrw.auto_attach = !matches!(matches.value_of("attach"), Some("true"));
} }
if matches.is_present("local") {
settingsrw.core.network.enable_local_peer_scope = true;
}
if matches.occurrences_of("bootstrap") != 0 { if matches.occurrences_of("bootstrap") != 0 {
let bootstrap = match matches.value_of("bootstrap") { let bootstrap = match matches.value_of("bootstrap") {
Some(x) => { Some(x) => {