Git Product home page Git Product logo

Comments (4)

andreimatei avatar andreimatei commented on June 14, 2024

Another observation: clang does seem to want to search that arch-specific dir when not using -target bpf:

$ clang -v -g -O2  -D__TARGET_ARCH_x86 -I.output -c minimal.bpf.c -o .output/minimal.bpf.o
Ubuntu clang version 11.0.0-2
...
#include "..." search starts here:
#include <...> search starts here:
 .output
 /usr/local/include
 /usr/lib/llvm-11/lib/clang/11.0.0/include
 /usr/include/x86_64-linux-gnu
 /usr/include

from libbpf-bootstrap.

anakryiko avatar anakryiko commented on June 14, 2024

Oh, I think this is how we deal with it in kernel selftests: https://github.com/torvalds/linux/blob/master/tools/testing/selftests/bpf/Makefile#L215-L224

This seems to be due to using -target bpf, so for some systems not all the necessary include paths used... You are right that just using "vmlinux.h" would be enough, but that puts a requirement for kernel BTF on the system, and my goal was to have something to use even without kernel built with BTF...

Do you mind trying the get_sys_includes trick and confirming if that works? We can "backport" it here. Not that it's simple and obvious, but should just work.

from libbpf-bootstrap.

andreimatei avatar andreimatei commented on June 14, 2024

It works indeed. Would you like a patch?

from libbpf-bootstrap.

anakryiko avatar anakryiko commented on June 14, 2024

that would be great, thanks. Please also include a comment explaining why we need that.

from libbpf-bootstrap.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.