Skip to content

Commit

Permalink
fix: make sure binarie's the dependencies inherit the includes from t…
Browse files Browse the repository at this point in the history
…he bpf target

Error was:
error: build/.gens/api/linux/x86_64/release/api.h:87:10: fatal error: block_ip.skel.h: No such file or directory
   87 | #include "block_ip.skel.h"
      |          ^~~~~~~~~~~~~~~~~
  • Loading branch information
fntlnz authored and leodido committed Nov 21, 2022
1 parent 48bccc5 commit c80b951
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
4 changes: 2 additions & 2 deletions api/xmake.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
set_xmakever("2.6.1") -- Minimum version to compile BPF source correctly

-- includes
includes("xmake/repos.lua")
includes("../xmake/repos.lua")

-- rules
add_rules("mode.release", "mode.debug")
Expand Down Expand Up @@ -30,4 +30,4 @@ target("api")

import("actions.config.configfiles", { alias = "gen_configfiles", rootdir = os.programdir() })
gen_configfiles()
end)
end)
2 changes: 2 additions & 0 deletions bpf/xmake.lua
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ rule("bpf")
target:add("includedirs", headerdir, { interface = true })
end)
before_buildcmd_file(function (target, batchcmds, sourcefile, opt)

local filecfg = target:fileconfig(sourcefile)
local bpftool = "bpftool"
if filecfg and filecfg.bpftool then
Expand All @@ -36,6 +37,7 @@ rule("bpf")
targetarch = "__TARGET_ARCH_powerpc"
end
target:add("includedirs", path.directory(headerfile), { interface = true })

target:set("optimize", "faster")
batchcmds:show_progress(opt.progress, "${color.build.object}compiling.bpf %s", sourcefile)
batchcmds:mkdir(path.directory(objectfile))
Expand Down
2 changes: 2 additions & 0 deletions xmake.lua
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ target("traffico")
set_default(true)
includes("api")
add_deps("api")
add_deps("bpf")
add_packages("libbpf")
add_files({ "traffico.c" }, { languages = { "c11" }})
target_end()
Expand All @@ -23,6 +24,7 @@ target("traffico-cni")
add_packages("cjson")
includes("api")
add_deps("api")
add_deps("bpf")
add_packages("libbpf")
add_files({ "traffico-cni.c" }, { languages = { "c11" }})
target_end()
Expand Down

0 comments on commit c80b951

Please sign in to comment.