bpf_conformance icon indicating copy to clipboard operation
bpf_conformance copied to clipboard

bpf_conformance dependency on elfio is hard to use

Open dthaler opened this issue 1 year ago • 0 comments

A change made to bpf_conformance apparently breaks the verifier compilation, so I’m trying to determine the right way to fix. Bump external/bpf_conformance from 78df87a to ab34094 by dependabot[bot] · Pull Request #543 · vbpf/ebpf-verifier (github.com) hits:

CMake Error at external/bpf_conformance/src/CMakeLists.txt:53 (add_dependencies): The dependency target "elfio" of target "bpf_conformance" does not exist.

After the recent change, bpf_conformance\src\CMakeLists.txt now has:

add_dependencies(bpf_conformance elfio)

In the bpf_conformance repository this is fine since bpf_conformance\CMakeLists.txt (one level up) has:

add_subdirectory("external/elfio")

But ebpf-verifier\CMakeLists.txt has:

add_subdirectory("external/bpf_conformance/src")

Which means it tries to use the src\CMakeLists.txt without first invoking bpf_conformance\CMakeLists.txt, and hence can’t find the dependency that is added inside bpf_conformance\external\elfio\CMakeLists.txt.

Options:

  1. Don’t add the dependency in bpf_conformance\src\CMakeLists.txt. This seems like the wrong choice.
  2. Move add_subdirectory("external/elfio") down inside bpf_conformance\src\CMakeLists.txt
  3. Update ebpf-verifier\CMakeLists.txt to depend on all of bpf_conformance\CMakeLists.txt not just bpf_conformance\src\CMakeLists.txt. This would slow down the build by having to compile bpf_conformance\tests etc. when that’s not needed by the verifier.
  4. Update ebpf-verifier\CMakeLists.txt to add_subdirectory(“external/bpf_conformance/external/elfio”) so the dependency is defined before invoking bpf_conformance\src\CMakeLists.txt

Alan stated offline: "option 2 is probably the best option as this should permit other projects to consume bpf_conformance more easily."

dthaler avatar Dec 11 '23 21:12 dthaler