Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitd8f4dbe

Browse files
authored
Merge pull request#80 from shahn/friendly_non_linux_compilation
Friendly non linux compilation error
2 parents32fa1af +eb55dab commitd8f4dbe

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

‎Cargo.toml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,17 +39,15 @@ enumerate = ["dep:libudev"]
3939
embedded-can ="0.4"
4040
nb ="1"
4141
log ="0.4"
42-
byte_conv ="0.1.1"
4342
hex ="0.4"
4443
itertools ="0.13"
4544
libc ="0.2"
4645
nix = {version="0.29",features = ["poll","process","net"] }
4746
bitflags ="2.6"
48-
thiserror ="1.0"
47+
thiserror ="2"
4948
socket2 = {version ="0.5",features = ["all"] }
5049
clap = {version ="3.2",optional =true }
5150
anyhow = {version ="1",optional =true }
52-
neli = {version ="0.6",optional =true }
5351
tokio = {version ="1",features = ["net"],optional =true }
5452
mio = {version ="1",features = ["os-ext"],optional =true }
5553
futures = {version ="0.3",optional =true }
@@ -58,6 +56,12 @@ smol = { version = "1.3", optional = true }
5856
async-std = {version ="1.12",optional =true }
5957
libudev = {version ="0.3",optional =true }
6058

59+
# This hack avoids building neli on non-linux platforms, which
60+
# avoids a ton of compile errors. Worthwhile together with the
61+
# build.rs script to error early when building for non-linux
62+
[target.'cfg(target_os="linux")'.dependencies]
63+
neli = {version ="0.6",optional =true }
64+
6165
[dev-dependencies]
6266
anyhow ="1.0"
6367
ctrlc ="3.2.2"

‎build.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
fnmain() ->Result<(),Box<dyn std::error::Error>>{
2+
println!("cargo:rerun-if-changed=build.rs");
3+
match std::env::var("CARGO_CFG_TARGET_OS"){
4+
Ok(val)if val =="linux" =>Ok(()),
5+
_ =>Err("Building for anything but Linux is not supported by socketcan".into()),
6+
}
7+
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp