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

[FEATURE] Make examples depending on libbpf able to build on macos #306

Open
hp77-creator opened this issue Jun 14, 2024 · 8 comments
Open
Labels
enhancement New feature or request

Comments

@hp77-creator
Copy link
Contributor

Is your feature request related to a problem? Please describe.

Right now, libbpf doesn't compile on macOS because of some headers which are not present. This issue is to add those headers or maybe their alternatives to the project and make bpftime work with libbpf on macOS.

Describe the solution you'd like

libbpf should work with bpftime on macOS. identify all the headers and syscalls that are being used and replace it with hooks to make them work.

Provide usage examples

After this feature is incoporated, bpftime will be able to work on macOS without LIBBPF flag disabled.

@hp77-creator hp77-creator added the enhancement New feature or request label Jun 14, 2024
@hp77-creator
Copy link
Contributor Author

relates to #145

@Officeyutong
Copy link
Contributor

Officeyutong commented Jun 14, 2024

A better title: Make examples depending on libbpf able to build on macos

libbpf itself can't work on macos obviously, but if we may get it able to be built on macos by providing mocked implementation of linux-specified functions that libbpf needs. These mocked implementations could be just empty functions. They don't need to really work, since they'll be overriden by function implementations provided by syscall-server. We provide these functions just to trick the linker.

If we were able to build examples of bpftime on macos, we'll be able to test them on macos with bpftime.

@hp77-creator hp77-creator changed the title [FEATURE] Make libbpf work on macOS so that we can run bpftime without keeping it off [FEATURE] Make examples depending on libbpf able to build on macos Jun 14, 2024
@hp77-creator
Copy link
Contributor Author

@Officeyutong , I am planning to close this one before frida, working on this atm.

@Officeyutong
Copy link
Contributor

@Officeyutong , I am planning to close this one before frida, working on this atm.

ok

@hp77-creator
Copy link
Contributor Author

@Officeyutong I observe that 'bpftime_frida_uprobe_attach_tests' fail in '--config RelWithDebInfo' and pass in '--config Debug' when using CMake to build tests and whole 'bpftime'.

@Officeyutong
Copy link
Contributor

@Officeyutong I observe that 'bpftime_frida_uprobe_attach_tests' fail in '--config RelWithDebInfo' and pass in '--config Debug' when using CMake to build tests and whole 'bpftime'.

Let me have a look at compile messages

@hp77-creator
Copy link
Contributor Author

@Officeyutong Do you mean the output of make commands? I tried running make build-wo-libbpf with slight change in config option and then ran the tests. Do you want to see the output of the same. I am not building tests separately as such. I can try that if you mean that

@Officeyutong
Copy link
Contributor

Referenc

I mean CMake output when building bpftime_frida_uprobe_attach_tests with RelWithDebInfo. It is not expected to fail

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

No branches or pull requests

2 participants