Skip to contentSkip to conversation

libbpf: if LIBBPF_EMBEDDED=OFF and libbpf-dev/pkgconfig is not available, fail the build

PATCH In review Luca Boccassi 2 participants 3 messages Jun 13, 2021 – Jun 14, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 libbpf: if LIBBPF_EMBEDDED=OFF and libbpf-dev/pkgconfig is not available, fail the build

If using the system library was explicitly requested, ensure it is present and fail the build if it is not, rather than falling back to the embedded version (same for pkg-config).

---
 CMakeLists.txt | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
CMakeLists.txt +2 -2
index 669ea59..0f967d1 100644
@@ -4,9 +4,9 @@ cmake_policy(SET CMP0005 NEW)
 
 option(LIBBPF_EMBEDDED "Use the embedded version of libbpf instead of searching it via pkg-config" ON)
 if (NOT LIBBPF_EMBEDDED)
-	find_package(PkgConfig)
+	find_package(PkgConfig REQUIRED)
 	if(PKGCONFIG_FOUND)
-		pkg_check_modules(LIBBPF libbpf>=0.3.0)
+		pkg_check_modules(LIBBPF REQUIRED libbpf>=0.3.0)
 	endif()
 endif()
 
Signature · 1 line
2.30.2
#1 lore raw

PATCH 2/2 libbpf: bump dependency to >= 0.4.0

Required for the new API btf__add_float()

---
 CMakeLists.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
CMakeLists.txt +1 -1
index 0f967d1..a8c0af8 100644
@@ -6,7 +6,7 @@ option(LIBBPF_EMBEDDED "Use the embedded version of libbpf instead of searching
 if (NOT LIBBPF_EMBEDDED)
 	find_package(PkgConfig REQUIRED)
 	if(PKGCONFIG_FOUND)
-		pkg_check_modules(LIBBPF REQUIRED libbpf>=0.3.0)
+		pkg_check_modules(LIBBPF REQUIRED libbpf>=0.4.0)
 	endif()
 endif()
 
Signature · 1 line
2.30.2
#2 lore raw
In reply to Luca Boccassi

Em Sun, Jun 13, 2021 at 02:47:05PM +0100, Luca Boccassi escreveu:

Quoted 3 lines

If using the system library was explicitly requested, ensure it is present and fail the build if it is not, rather than falling back to the embedded version (same for pkg-config).

Thanks, applied and tested both patches,

- Arnaldo

Quoted 24 lines
---
 CMakeLists.txt | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
CMakeLists.txt +2 -2
index 669ea59..0f967d1 100644
@@ -4,9 +4,9 @@ cmake_policy(SET CMP0005 NEW)
 
 option(LIBBPF_EMBEDDED "Use the embedded version of libbpf instead of searching it via pkg-config" ON)
 if (NOT LIBBPF_EMBEDDED)
-	find_package(PkgConfig)
+	find_package(PkgConfig REQUIRED)
 	if(PKGCONFIG_FOUND)
-		pkg_check_modules(LIBBPF libbpf>=0.3.0)
+		pkg_check_modules(LIBBPF REQUIRED libbpf>=0.3.0)
 	endif()
 endif()
 
Signature · 1 line
2.30.2
Signature · 1 line
- Arnaldo