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

Make paths msys2 friendly #2

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Make paths msys2 friendly #2

wants to merge 2 commits into from

Conversation

dilawar
Copy link
Contributor

@dilawar dilawar commented Jan 9, 2024

With current paths, the build will fail in msys2 terminal on Windows. This PR changes the paths.

@dilawar dilawar requested a review from cyberphantom52 January 9, 2024 09:47
])
.output()
.expect("Failed to clone dtrace");
fn build_dtrace() -> anyhow::Result<()> {
Copy link
Collaborator

Choose a reason for hiding this comment

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

If there's no Err variant. Why even return a result?

Comment on lines +75 to +79
Command::new("git")
.arg("udpate")
.current_dir(DTRACE_SRC_DIR)
.output()
.expect("Failed to update dtrace");
Copy link
Collaborator

Choose a reason for hiding this comment

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

git update is not a valid command.

println!("> git update/clone {output:?}");

let output = Command::new("powershell.exe")
.arg("-F")
Copy link
Collaborator

Choose a reason for hiding this comment

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

-F is not a valid option to powershell.

.args(&[".\\build-dtrace.ps1"])
println!("> git update/clone {output:?}");

let output = Command::new("powershell.exe")
Copy link
Collaborator

Choose a reason for hiding this comment

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

We don't need this output, build logs get generated inside dtrace directory not in stdout

Comment on lines +11 to +13
std::path::Path::new(&dir)
.join(DTRACE_SRC_DIR)
.join("dtrace/build/x64/Release/lib")
Copy link
Collaborator

Choose a reason for hiding this comment

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

Wrong path, evaluates to libdtrace-rs\_dtrace\dtrace/build/x64/Release/lib

Should be libdtrace-rs\target\_dtrace/build/x64/Release/lib

.args(&[
"clone",
"https://github.com/microsoft/DTrace-on-Windows.git",
DTRACE_SRC_DIR,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Don't clone anything inside root directory, use the target directory for any external dependencies

build.rs Outdated
@@ -68,7 +64,7 @@ fn build_dtrace() {
.output()
.expect("Failed to clone dtrace");

Command::new("powershell")
let _ = Command::new("powershell")
Copy link
Collaborator

Choose a reason for hiding this comment

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

We don't need this result at all.

@cyberphantom52
Copy link
Collaborator

Failing to build on my machine, the include paths have changed.

error: failed to run custom build command for `libdtrace-rs v0.1.0 (C:\Users\Phantom\Desktop\libdtrace-rs)`

Caused by:
  process didn't exit successfully: `C:\Users\Phantom\Desktop\libdtrace-rs\target\debug\build\libdtrace-rs-6d9bed805b1b19d7\build-script-build` (exit code: 101)
  --- stdout
  cargo:rerun-if-changed=wrapper.h
  cargo:rustc-link-lib=dtrace
  cargo:rustc-link-search=native=C:\Users\Phantom\Desktop\libdtrace-rs\_dtrace\dtrace/build/x64/Release/lib
  Trying to buidld dtrace library... > git update/clone ()
        ....[DONE]
  cargo:rerun-if-env-changed=TARGET
  cargo:rerun-if-env-changed=BINDGEN_EXTRA_CLANG_ARGS_x86_64-pc-windows-msvc
  cargo:rerun-if-env-changed=BINDGEN_EXTRA_CLANG_ARGS_x86_64_pc_windows_msvc
  cargo:rerun-if-env-changed=BINDGEN_EXTRA_CLANG_ARGS
  cargo:rerun-if-changed=wrapper.h

  --- stderr
  wrapper.h:2:10: fatal error: 'dtrace.h' file not found
  thread 'main' panicked at build.rs:55:10:
  Unable to generate bindings: ClangDiagnostic("wrapper.h:2:10: fatal error: 'dtrace.h' file not found\n")
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

@cyberphantom52
Copy link
Collaborator

After fixing the include paths, the tests fail with

LINK : fatal error LNK1181: cannot open input file 'dtrace.lib'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants