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

Failing to build or install py-spy on Mac OS 13 #596

Closed
jrabinow opened this issue Jun 26, 2023 · 5 comments · Fixed by #699 · May be fixed by zanieb/py-spy#9
Closed

Failing to build or install py-spy on Mac OS 13 #596

jrabinow opened this issue Jun 26, 2023 · 5 comments · Fixed by #699 · May be fixed by zanieb/py-spy#9

Comments

@jrabinow
Copy link

jrabinow commented Jun 26, 2023

I'm trying to build py-spy to add it to MacPorts, but I seem to be running into an issue with libproc.
Machine info:

macOS 13.3 22E252 arm64
Xcode 14.3 14E222b

When attempting to cargo install, I get the following error:

$ cargo install py-spy
error: failed to run custom build command for `libproc v0.12.0`

Caused by:
  process didn't exit successfully: `/var/folders/4q/2c5n_3vx589cd7qdpn31dxfm0000gn/T/cargo-installdn4ixI/release/build/libproc-194877f4dcf5bf8d/build-script-build` (exit status: 101)
  --- stderr
  /Users/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/libproc-0.12.0/libproc_rs.h:1:10: fatal error: 'libproc.h' file not found
  /Users/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/libproc-0.12.0/libproc_rs.h:1:10: fatal error: 'libproc.h' file not found, err: true
  thread 'main' panicked at 'Failed to build libproc bindings: ()', /Users/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/libproc-0.12.0/build.rs:9:10
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
warning: build failed, waiting for other jobs to finish...
error: failed to run custom build command for `libproc v0.13.0`

Caused by:
  process didn't exit successfully: `/var/folders/4q/2c5n_3vx589cd7qdpn31dxfm0000gn/T/cargo-installdn4ixI/release/build/libproc-0bbbc2f2356e2d3b/build-script-build` (exit status: 101)
  --- stderr
  /Users/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/libproc-0.13.0/libproc_rs.h:1:10: fatal error: 'libproc.h' file not found
  thread 'main' panicked at 'Failed to build libproc bindings: ClangDiagnostic("/Users/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/libproc-0.13.0/libproc_rs.h:1:10: fatal error: 'libproc.h' file not found\n")', /Users/user/.car
go/registry/src/index.crates.io-6f17d22bba15001f/libproc-0.13.0/build.rs:10:10
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
error: failed to compile `py-spy v0.3.14`, intermediate artifacts can be found at `/var/folders/4q/2c5n_3vx589cd7qdpn31dxfm0000gn/T/cargo-installdn4ixI`

My attempt at a macports port seems to be running into an issue with libproc as well:
macports_build.txt

Any ideas on how I could get py-spy to build?

@benfred
Copy link
Owner

benfred commented Jul 29, 2023

it looks like libproc is failing to build here w/ fatal error: 'libproc.h' file not found .

This seems to be the same error as andrewdavidmackenzie/libproc-rs#82 .

I just built successfully on my OSX system, but I'm still on Catalina (and on an intel based machine).

@jrabinow
Copy link
Author

Thanks for linking both issues, I reported my issue upstream along with a patch. I'm not sure how long it'll take to fix or what functionality is included in the libproc library - asking with zero context here, does it make sense to try to remove the dependency on libproc-rs?
If not, it might make sense to close this issue since it looks like the problem is upstream

@benfred
Copy link
Owner

benfred commented Jul 31, 2023

does it make sense to try to remove the dependency on libproc-rs?

py-spy isn't actually using libproc directly, libproc is being used by the remoteprocess and proc-maps dependencies of py-spy. the remoteprocess dependency is using it to get the exe/cwd https://github.com/benfred/remoteprocess/blob/70509587992eead0fdeb5534125c8ac7db2ce9a8/src/osx/mod.rs#L50-L62 - and proc-maps is using it to get the filename for a region of memory https://github.com/rbspy/proc-maps/blob/6d6fcb987fe663a7232b90a4182feb0dfc7c1f4c/src/mac_maps/mod.rs#L146 .

We could replace it in both cases, but ideally we'd just get it fixed upstream.

@jrabinow
Copy link
Author

jrabinow commented Sep 27, 2023

Both libproc-rs and proc-maps have released new versions with the fix

@jrabinow
Copy link
Author

Hi @benfred would it be possible to release a new version of py-spy including the upstream fix from libproc-rs?

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 a pull request may close this issue.

2 participants