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

Fix KBUILD_MODNAME #1352

Merged
merged 1 commit into from
May 27, 2020
Merged

Fix KBUILD_MODNAME #1352

merged 1 commit into from
May 27, 2020

Conversation

mmisono
Copy link
Collaborator

@mmisono mmisono commented May 27, 2020

I found that bpftrace cannot include net/sock.h on Linux 5.7-rc7.

% sudo ./src/bpftrace -e 'BEGIN {}' --include net/sock.h
[...]
/lib/modules/5.7.0-rc7/source/include/net/flow_offload.h:342:3: error: array initializer must be an initializer list or string literal
/lib/modules/5.7.0-rc7/source/include/net/flow_offload.h:342:3: error: expected ';' at end of declaration

Related parts are

torvalds/linux@319a1d1#diff-c92be59c4d9bb3274ff03bce22e057b4R269
https://github.com/torvalds/linux/blob/444fc5cde64330661bf59944c43844e7d4c2ccd8/include/linux/netlink.h#L96

and it seems KBUILD_MODNAME is invalid. Use "bpftrace" instead of '"bpftrace"' as KBUILD_MODNAME.

Checklist
  • Language changes are updated in docs/reference_guide.md
    • This is no language changes.
  • User-visible and non-trivial changes updated in CHANGELOG.md

Use "bpftrace" instead of '"bpftrace"'. Previously this causes build
error if included header files use KBUILD_MODNAME.
@danobi danobi merged commit 1033f91 into bpftrace:master May 27, 2020
@mmisono
Copy link
Collaborator Author

mmisono commented May 28, 2020

The workaround without recompiling is

#define KBUILD_MODNAME "bpftrace"
#include <net/sock.h>

BEGIN {}

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