Skip to content

Commit

Permalink
fix: proc-macro building + completion
Browse files Browse the repository at this point in the history
  • Loading branch information
qjerome committed Oct 7, 2024
1 parent 7ebea35 commit 0702c7d
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,5 @@
"rust-analyzer.runnables.extraArgs": [
"--target=x86_64-unknown-linux-gnu"
],
"rust-analyzer.procMacro.enable": false,
"rust-analyzer.procMacro.enable": true,
}
3 changes: 3 additions & 0 deletions kunai-ebpf/rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
[toolchain]
# this channel needs to be aligned with the
# one in workspace if we want to benefit from
# proc-macro analysis
channel = "nightly-2024-07-07"

# The source code of rustc, provided by the rust-src component, is needed for
Expand Down
5 changes: 4 additions & 1 deletion rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
[toolchain]
channel = "1.80"
# this channel needs to be aligned with the
# one in kunai-ebpf if we want to benefit from
# proc-macro analysis
channel = "nightly-2024-07-07"
targets = ["x86_64-unknown-linux-gnu", "aarch64-unknown-linux-gnu"]

# to have the necessary for code analysis
Expand Down
8 changes: 8 additions & 0 deletions xtask/src/user.rs
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,14 @@ fn cargo(command: &str, opts: &BuildOptions) -> Result<(), anyhow::Error> {
rustflags.push(format!("-C linker={linker}"))
}

let cargo_version = Command::new("cargo").arg("-V").output()?;

// address issue when building yara with rust nightly
// https://github.com/VirusTotal/yara-x/issues/217
if String::from_utf8(cargo_version.stdout)?.contains("nightly") {
rustflags.push("-C link-args=-znostart-stop-gc".into());
}

args.push(format!("--target={}", opts.target));

opts.build_args.iter().for_each(|ba| args.push(ba.clone()));
Expand Down

0 comments on commit 0702c7d

Please sign in to comment.