falcosecurity / libs

libsinsp, libscap, the kernel module driver, and the eBPF driver sources
https://falcosecurity.github.io/libs/
Apache License 2.0
233 stars 165 forks source link

[-DBUILD_SHARED_LIBS=ON] "error: driver/syscall_compat_x86_64.h: No such file or directory" at build time #1820

Open Apteryks opened 7 months ago

Apteryks commented 7 months ago

Describe the bug

Hi! I'm trying to build from the latest 0.15.1 git tag on my Guix System machine, and I'm getting this build failure:

[...]
starting phase `configure'
source directory: "/tmp/guix-build-falcosecurity-libs-0.15.1.drv-0/source" (relative from build: "../source")
build directory: "/tmp/guix-build-falcosecurity-libs-0.15.1.drv-0/build"
running 'cmake' with arguments ("../source" "-DCMAKE_BUILD_TYPE=RelWithDebInfo" "-DCMAKE_INSTALL_PREFIX=/gnu/store/qvsb1bb8q71xgm1x93p6dwpm7phmcppj-falcosecurity-libs-0.15.1" "-DCMAKE_INSTALL_LIBDIR=lib" "-DCMAKE_INSTALL_RPATH_USE_LINK_PATH=TRUE" "-DCMAKE_INSTALL_RPATH=/gnu/store/qvsb1bb8q71xgm1x93p6dwpm7phmcppj-falcosecurity-libs-0.15.1/lib" "-DCMAKE_VERBOSE_MAKEFILE=ON" "-DUSE_BUNDLED_DEPS=OFF" "-DBUILD_DRIVER=OFF" "-DBUILD_LIBSINSP_EXAMPLES=OFF" "-DBUILD_LIBSCAP_EXAMPLES=OFF" "-DBUILD_SHARED_LIBS=ON" "-DENABLE_LIBSCAP_TESTS=ON" "-DFALCOSECURITY_LIBS_VERSION=0.15.1")
-- The C compiler identification is GNU 11.3.0
-- The CXX compiler identification is GNU 11.3.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /gnu/store/5lqhcv91ijy82p92ac6g5xw48l0lwwz4-gcc-11.3.0/bin/gcc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /gnu/store/5lqhcv91ijy82p92ac6g5xw48l0lwwz4-gcc-11.3.0/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Libs version: 0.15.1
-- Driver version: 0.0.0
-- Kernel version: 5.15.147-gnu
-- Driver API version 8.0.2
-- Driver schema version 2.18.2
-- Found gtest: include: /gnu/store/l2iwk7p08lpb0hhcp2jnlkqs06520441-googletest-1.12.1/include/gtest, lib: /gnu/store/l2iwk7p08lpb0hhcp2jnlkqs06520441-googletest-1.12.1/lib/libgtest.so, main lib: /gnu/store/l2iwk7p08lpb0hhcp2jnlkqs06520441-googletest-1.12.1/lib/libgtest_main.so
-- Shared library version: 0.15.1
-- Shared library soversion: 0
-- Found uthash: include: /gnu/store/2irnv5mrdpb0vljyzww1z98sw8ll6wms-uthash-2.1.0/include
-- Looking for strlcpy
-- Looking for strlcpy - not found
-- Looking for strlcat
-- Looking for strlcat - not found
-- No strlcpy found, will use local definition
-- No strlcat found, will use local definition
-- Found zlib: include: /gnu/store/slzq3zqwj75lbrg4ly51hfhbv2vhryv5-zlib-1.2.13/include, lib: /gnu/store/slzq3zqwj75lbrg4ly51hfhbv2vhryv5-zlib-1.2.13/lib/libz.so
-- Looking for sys/mkdev.h
-- Looking for sys/mkdev.h - not found
-- Looking for sys/sysmacros.h
-- Looking for sys/sysmacros.h - found
-- Found LIBELF: include: /gnu/store/gsjczqir1wbz8p770zndrpw4rnppmxi3-glibc-2.35/include, lib: /gnu/store/0l2r86s9fhfc4ahfdjl6782kv3glxrjs-libelf-0.8.13/lib/libelf.so
-- Found protobuf: compiler: /gnu/store/riffwbjglccjwnnwqzlfdsrg8f6i8phs-protobuf-3.21.9/bin/protoc, include: /gnu/store/riffwbjglccjwnnwqzlfdsrg8f6i8phs-protobuf-3.21.9/include, lib: /gnu/store/riffwbjglccjwnnwqzlfdsrg8f6i8phs-protobuf-3.21.9/lib/libprotobuf.so
-- Found jsoncpp: include: /gnu/store/9jkzwa8j0ag4n0bwmdwn9k313ilwgywf-jsoncpp-1.9.5/include, lib: /gnu/store/9jkzwa8j0ag4n0bwmdwn9k313ilwgywf-jsoncpp-1.9.5/lib/libjsoncpp.so
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE  
-- Found tbb: include: /gnu/store/vbb4mazz64v6gy10nzz1dp1ixk690fav-tbb-2021.6.0/include/tbb, lib: /gnu/store/vbb4mazz64v6gy10nzz1dp1ixk690fav-tbb-2021.6.0/lib/libtbb.so
-- Found c-ares: include: /gnu/store/0kzjzrgsn7k1clc6mxk5ndfmsikwm7wz-c-ares-1.18.1/include, lib: /gnu/store/0kzjzrgsn7k1clc6mxk5ndfmsikwm7wz-c-ares-1.18.1/lib/libcares.so
-- Found OpenSSL: /gnu/store/69wd3pd1hd3j84xr965jj2fk2qmxn0hl-openssl-3.0.8/lib/libcrypto.so (found version "3.0.8")  
-- Found OpenSSL: include: /gnu/store/69wd3pd1hd3j84xr965jj2fk2qmxn0hl-openssl-3.0.8/include, lib: /gnu/store/69wd3pd1hd3j84xr965jj2fk2qmxn0hl-openssl-3.0.8/lib/libssl.so;/gnu/store/69wd3pd1hd3j84xr965jj2fk2qmxn0hl-openssl-3.0.8/lib/libcrypto.so
-- Found CURL: /gnu/store/54cqjg46c15qsx75b63rfbmvshw8w5nd-curl-8.5.0/lib/libcurl.so (found version "8.5.0")  
-- Found CURL: include: /gnu/store/54cqjg46c15qsx75b63rfbmvshw8w5nd-curl-8.5.0/include, lib: /gnu/store/54cqjg46c15qsx75b63rfbmvshw8w5nd-curl-8.5.0/lib/libcurl.so
-- Using jsoncpp: include: /gnu/store/9jkzwa8j0ag4n0bwmdwn9k313ilwgywf-jsoncpp-1.9.5/include, lib: /gnu/store/9jkzwa8j0ag4n0bwmdwn9k313ilwgywf-jsoncpp-1.9.5/lib/libjsoncpp.so
-- Found valijson: include: /gnu/store/m57i4jra2yg42sz886qyz6x5qz2bxiai-valijson-1.0.2/include.
-- Found re2: include: /gnu/store/4w850l8yy5lj5mvrfq253bcs8axhnizc-re2-2022-12-01/include, lib: /gnu/store/4w850l8yy5lj5mvrfq253bcs8axhnizc-re2-2022-12-01/lib/libre2.so
-- Using jsoncpp: include: /gnu/store/9jkzwa8j0ag4n0bwmdwn9k313ilwgywf-jsoncpp-1.9.5/include, lib: /gnu/store/9jkzwa8j0ag4n0bwmdwn9k313ilwgywf-jsoncpp-1.9.5/lib/libjsoncpp.so
-- Found ZLIB: /gnu/store/slzq3zqwj75lbrg4ly51hfhbv2vhryv5-zlib-1.2.13/lib/libz.so (found version "1.2.13") 
-- Found Protobuf: /gnu/store/riffwbjglccjwnnwqzlfdsrg8f6i8phs-protobuf-3.21.9/lib/libprotobuf.so (found version "3.21.9") 
-- Could NOT find c-ares (missing: c-ares_DIR)
-- Found c-ares: /gnu/store/0kzjzrgsn7k1clc6mxk5ndfmsikwm7wz-c-ares-1.18.1/include (found version "1.18.1") 
-- Found PkgConfig: /gnu/store/jz5dwdxq4di29cd0rjjzkw356dhkzjil-pkg-config-0.29.2/bin/pkg-config (found version "0.29.2") 
-- Found RE2 via pkg-config.
-- Using gRPC 1.34.0
-- Using jsoncpp: include: /gnu/store/9jkzwa8j0ag4n0bwmdwn9k313ilwgywf-jsoncpp-1.9.5/include, lib: /gnu/store/9jkzwa8j0ag4n0bwmdwn9k313ilwgywf-jsoncpp-1.9.5/lib/libjsoncpp.so
-- Download all scap-files from: https://download.falco.org/fixtures/libs/scap_files
-- Downloading scap-file: https://download.falco.org/fixtures/libs/scap_files/kexec_arm64.scap
-- Downloading scap-file: https://download.falco.org/fixtures/libs/scap_files/kexec_x86.scap
CMake Warning at test/e2e/CMakeLists.txt:7 (message):
  e2e tests can only be run with the eBPF probe

-- Libscap unit tests build enabled
-- [LIBSCAP UNIT TESTS] LIBSCAP_TESTS_SOURCES: /tmp/guix-build-falcosecurity-libs-0.15.1.drv-0/source/test/libscap/test_suites/userspace/common_strl.cpp;/tmp/guix-build-falcosecurity-libs-0.15.1.drv-0/source/test/libscap/test_suites/userspace/event_table.cpp;/tmp/guix-build-falcosecurity-libs-0.15.1.drv-0/source/test/libscap/test_suites/userspace/linux/scap_cgroup.cpp;/tmp/guix-build-falcosecurity-libs-0.15.1.drv-0/source/test/libscap/test_suites/userspace/ppm_sc_names_table.cpp;/tmp/guix-build-falcosecurity-libs-0.15.1.drv-0/source/test/libscap/test_suites/userspace/scap_event.cpp;/tmp/guix-build-falcosecurity-libs-0.15.1.drv-0/source/test/libscap/test_suites/userspace/scap_ppm_sc.cpp;/tmp/guix-build-falcosecurity-libs-0.15.1.drv-0/source/test/libscap/test_suites/userspace/syscall_table.cpp;/tmp/guix-build-falcosecurity-libs-0.15.1.drv-0/source/test/libscap/helpers/engines.cpp;/tmp/guix-build-falcosecurity-libs-0.15.1.drv-0/source/test/libscap/test_suites/engines/gvisor/gvisor_parsers.cpp;/tmp/guix-build-falcosecurity-libs-0.15.1.drv-0/source/test/libscap/test_suites/engines/gvisor/gvisor_platform.cpp
-- [LIBSCAP UNIT TESTS] LIBSCAP_TESTS_INCLUDE: PRIVATE;;/tmp/guix-build-falcosecurity-libs-0.15.1.drv-0/source/test/libscap;/tmp/guix-build-falcosecurity-libs-0.15.1.drv-0/source;/tmp/guix-build-falcosecurity-libs-0.15.1.drv-0/source/userspace;/tmp/guix-build-falcosecurity-libs-0.15.1.drv-0/build;/tmp/guix-build-falcosecurity-libs-0.15.1.drv-0/build/test/libscap;/tmp/guix-build-falcosecurity-libs-0.15.1.drv-0/build/libscap/engine/gvisor
-- [LIBSCAP UNIT TESTS] LIBSCAP_TESTS_LIBRARIES: /gnu/store/l2iwk7p08lpb0hhcp2jnlkqs06520441-googletest-1.12.1/lib/libgtest.so;/gnu/store/l2iwk7p08lpb0hhcp2jnlkqs06520441-googletest-1.12.1/lib/libgtest_main.so;;scap;scap_engine_util
-- [LIBSCAP UNIT TESTS] LIBSCAP_TESTS_DEPENDENCIES: gtest;scap
-- Configuring done
-- Generating done
-- Build files have been written to: /tmp/guix-build-falcosecurity-libs-0.15.1.drv-0/build
phase `configure' succeeded after 3.6 seconds
starting phase `patch-generated-file-shebangs'
phase `patch-generated-file-shebangs' succeeded after 0.2 seconds
starting phase `build'
/gnu/store/gl26kr5v6ch5lc3ignly61kb224drijc-cmake-minimal-3.24.2/bin/cmake -S/tmp/guix-build-falcosecurity-libs-0.15.1.drv-0/source -B/tmp/guix-build-falcosecurity-libs-0.15.1.drv-0/build --check-build-system CMakeFiles/Makefile.cmake 0
/gnu/store/gl26kr5v6ch5lc3ignly61kb224drijc-cmake-minimal-3.24.2/bin/cmake -E cmake_progress_start /tmp/guix-build-falcosecurity-libs-0.15.1.drv-0/build/CMakeFiles /tmp/guix-build-falcosecurity-libs-0.15.1.drv-0/build//CMakeFiles/progress.marks
make  -f CMakeFiles/Makefile2 all
make[1]: Entering directory '/tmp/guix-build-falcosecurity-libs-0.15.1.drv-0/build'
make  -f libscap/CMakeFiles/scap_error.dir/build.make libscap/CMakeFiles/scap_error.dir/depend
make[2]: Entering directory '/tmp/guix-build-falcosecurity-libs-0.15.1.drv-0/build'
cd /tmp/guix-build-falcosecurity-libs-0.15.1.drv-0/build && /gnu/store/gl26kr5v6ch5lc3ignly61kb224drijc-cmake-minimal-3.24.2/bin/cmake -E cmake_depends "Unix Makefiles" /tmp/guix-build-falcosecurity-libs-0.15.1.drv-0/source /tmp/guix-build-falcosecurity-libs-0.15.1.drv-0/source/userspace/libscap /tmp/guix-build-falcosecurity-libs-0.15.1.drv-0/build /tmp/guix-build-falcosecurity-libs-0.15.1.drv-0/build/libscap /tmp/guix-build-falcosecurity-libs-0.15.1.drv-0/build/libscap/CMakeFiles/scap_error.dir/DependInfo.cmake --color=
make[2]: Leaving directory '/tmp/guix-build-falcosecurity-libs-0.15.1.drv-0/build'
make  -f libscap/CMakeFiles/scap_error.dir/build.make libscap/CMakeFiles/scap_error.dir/build
make[2]: Entering directory '/tmp/guix-build-falcosecurity-libs-0.15.1.drv-0/build'
[  0%] Building C object libscap/CMakeFiles/scap_error.dir/strerror.c.o
cd /tmp/guix-build-falcosecurity-libs-0.15.1.drv-0/build/libscap && /gnu/store/5lqhcv91ijy82p92ac6g5xw48l0lwwz4-gcc-11.3.0/bin/gcc -DHAVE_SYS_SYSMACROS_H -DPLATFORM_NAME=\"Linux\" -DSCAP_HOSTNAME_ENV_VAR=\"SCAP_HOSTNAME\" -DSCAP_HOST_ROOT_ENV_VAR_NAME=\"HOST_ROOT\" -DSCAP_KERNEL_MODULE_NAME=\"scap\" -D__STDC_FORMAT_MACROS -I/gnu/store/l2iwk7p08lpb0hhcp2jnlkqs06520441-googletest-1.12.1/include/gtest -I/tmp/guix-build-falcosecurity-libs-0.15.1.drv-0/source/userspace -Wall -ggdb -O2 -g -DNDEBUG -fPIC -MD -MT libscap/CMakeFiles/scap_error.dir/strerror.c.o -MF CMakeFiles/scap_error.dir/strerror.c.o.d -o CMakeFiles/scap_error.dir/strerror.c.o -c /tmp/guix-build-falcosecurity-libs-0.15.1.drv-0/source/userspace/libscap/strerror.c
[  1%] Linking C static library libscap_error.a
cd /tmp/guix-build-falcosecurity-libs-0.15.1.drv-0/build/libscap && /gnu/store/gl26kr5v6ch5lc3ignly61kb224drijc-cmake-minimal-3.24.2/bin/cmake -P CMakeFiles/scap_error.dir/cmake_clean_target.cmake
cd /tmp/guix-build-falcosecurity-libs-0.15.1.drv-0/build/libscap && /gnu/store/gl26kr5v6ch5lc3ignly61kb224drijc-cmake-minimal-3.24.2/bin/cmake -E cmake_link_script CMakeFiles/scap_error.dir/link.txt --verbose=1
/gnu/store/zh4x65snfis7svs6906gj1z8i7dx2j3m-binutils-2.38/bin/ar qc libscap_error.a CMakeFiles/scap_error.dir/strerror.c.o
/gnu/store/zh4x65snfis7svs6906gj1z8i7dx2j3m-binutils-2.38/bin/ranlib libscap_error.a
make[2]: Leaving directory '/tmp/guix-build-falcosecurity-libs-0.15.1.drv-0/build'
[  1%] Built target scap_error
make  -f libscap/engine/gvisor/CMakeFiles/protobuf.dir/build.make libscap/engine/gvisor/CMakeFiles/protobuf.dir/depend
make[2]: Entering directory '/tmp/guix-build-falcosecurity-libs-0.15.1.drv-0/build'
cd /tmp/guix-build-falcosecurity-libs-0.15.1.drv-0/build && /gnu/store/gl26kr5v6ch5lc3ignly61kb224drijc-cmake-minimal-3.24.2/bin/cmake -E cmake_depends "Unix Makefiles" /tmp/guix-build-falcosecurity-libs-0.15.1.drv-0/source /tmp/guix-build-falcosecurity-libs-0.15.1.drv-0/source/userspace/libscap/engine/gvisor /tmp/guix-build-falcosecurity-libs-0.15.1.drv-0/build /tmp/guix-build-falcosecurity-libs-0.15.1.drv-0/build/libscap/engine/gvisor /tmp/guix-build-falcosecurity-libs-0.15.1.drv-0/build/libscap/engine/gvisor/CMakeFiles/protobuf.dir/DependInfo.cmake --color=
make[2]: Leaving directory '/tmp/guix-build-falcosecurity-libs-0.15.1.drv-0/build'
make  -f libscap/engine/gvisor/CMakeFiles/protobuf.dir/build.make libscap/engine/gvisor/CMakeFiles/protobuf.dir/build
make[2]: Entering directory '/tmp/guix-build-falcosecurity-libs-0.15.1.drv-0/build'
make[2]: Nothing to be done for 'libscap/engine/gvisor/CMakeFiles/protobuf.dir/build'.
make[2]: Leaving directory '/tmp/guix-build-falcosecurity-libs-0.15.1.drv-0/build'
[  1%] Built target protobuf
make  -f CMakeFiles/uthash.dir/build.make CMakeFiles/uthash.dir/depend
make[2]: Entering directory '/tmp/guix-build-falcosecurity-libs-0.15.1.drv-0/build'
cd /tmp/guix-build-falcosecurity-libs-0.15.1.drv-0/build && /gnu/store/gl26kr5v6ch5lc3ignly61kb224drijc-cmake-minimal-3.24.2/bin/cmake -E cmake_depends "Unix Makefiles" /tmp/guix-build-falcosecurity-libs-0.15.1.drv-0/source /tmp/guix-build-falcosecurity-libs-0.15.1.drv-0/source /tmp/guix-build-falcosecurity-libs-0.15.1.drv-0/build /tmp/guix-build-falcosecurity-libs-0.15.1.drv-0/build /tmp/guix-build-falcosecurity-libs-0.15.1.drv-0/build/CMakeFiles/uthash.dir/DependInfo.cmake --color=
make[2]: Leaving directory '/tmp/guix-build-falcosecurity-libs-0.15.1.drv-0/build'
make  -f CMakeFiles/uthash.dir/build.make CMakeFiles/uthash.dir/build
make[2]: Entering directory '/tmp/guix-build-falcosecurity-libs-0.15.1.drv-0/build'
make[2]: Nothing to be done for 'CMakeFiles/uthash.dir/build'.
make[2]: Leaving directory '/tmp/guix-build-falcosecurity-libs-0.15.1.drv-0/build'
[  1%] Built target uthash
make  -f libscap/engine/gvisor/CMakeFiles/scap_engine_gvisor_o.dir/build.make libscap/engine/gvisor/CMakeFiles/scap_engine_gvisor_o.dir/depend
make[2]: Entering directory '/tmp/guix-build-falcosecurity-libs-0.15.1.drv-0/build'
[  1%] Generate gVisor protobuf definitions
cd /tmp/guix-build-falcosecurity-libs-0.15.1.drv-0/build/libscap/engine/gvisor && /gnu/store/riffwbjglccjwnnwqzlfdsrg8f6i8phs-protobuf-3.21.9/bin/protoc -I /tmp/guix-build-falcosecurity-libs-0.15.1.drv-0/source/userspace/libscap/engine/gvisor/proto --cpp_out=. /tmp/guix-build-falcosecurity-libs-0.15.1.drv-0/source/userspace/libscap/engine/gvisor/proto/pkg/sentry/seccheck/points/common.proto
cd /tmp/guix-build-falcosecurity-libs-0.15.1.drv-0/build/libscap/engine/gvisor && /gnu/store/riffwbjglccjwnnwqzlfdsrg8f6i8phs-protobuf-3.21.9/bin/protoc -I /tmp/guix-build-falcosecurity-libs-0.15.1.drv-0/source/userspace/libscap/engine/gvisor/proto --cpp_out=. /tmp/guix-build-falcosecurity-libs-0.15.1.drv-0/source/userspace/libscap/engine/gvisor/proto/pkg/sentry/seccheck/points/container.proto
cd /tmp/guix-build-falcosecurity-libs-0.15.1.drv-0/build/libscap/engine/gvisor && /gnu/store/riffwbjglccjwnnwqzlfdsrg8f6i8phs-protobuf-3.21.9/bin/protoc -I /tmp/guix-build-falcosecurity-libs-0.15.1.drv-0/source/userspace/libscap/engine/gvisor/proto --cpp_out=. /tmp/guix-build-falcosecurity-libs-0.15.1.drv-0/source/userspace/libscap/engine/gvisor/proto/pkg/sentry/seccheck/points/sentry.proto
cd /tmp/guix-build-falcosecurity-libs-0.15.1.drv-0/build/libscap/engine/gvisor && /gnu/store/riffwbjglccjwnnwqzlfdsrg8f6i8phs-protobuf-3.21.9/bin/protoc -I /tmp/guix-build-falcosecurity-libs-0.15.1.drv-0/source/userspace/libscap/engine/gvisor/proto --cpp_out=. /tmp/guix-build-falcosecurity-libs-0.15.1.drv-0/source/userspace/libscap/engine/gvisor/proto/pkg/sentry/seccheck/points/syscall.proto
cd /tmp/guix-build-falcosecurity-libs-0.15.1.drv-0/build && /gnu/store/gl26kr5v6ch5lc3ignly61kb224drijc-cmake-minimal-3.24.2/bin/cmake -E cmake_depends "Unix Makefiles" /tmp/guix-build-falcosecurity-libs-0.15.1.drv-0/source /tmp/guix-build-falcosecurity-libs-0.15.1.drv-0/source/userspace/libscap/engine/gvisor /tmp/guix-build-falcosecurity-libs-0.15.1.drv-0/build /tmp/guix-build-falcosecurity-libs-0.15.1.drv-0/build/libscap/engine/gvisor /tmp/guix-build-falcosecurity-libs-0.15.1.drv-0/build/libscap/engine/gvisor/CMakeFiles/scap_engine_gvisor_o.dir/DependInfo.cmake --color=
make[2]: Leaving directory '/tmp/guix-build-falcosecurity-libs-0.15.1.drv-0/build'
make  -f libscap/engine/gvisor/CMakeFiles/scap_engine_gvisor_o.dir/build.make libscap/engine/gvisor/CMakeFiles/scap_engine_gvisor_o.dir/build
make[2]: Entering directory '/tmp/guix-build-falcosecurity-libs-0.15.1.drv-0/build'
[  2%] Building CXX object libscap/engine/gvisor/CMakeFiles/scap_engine_gvisor_o.dir/parsers.cpp.o
cd /tmp/guix-build-falcosecurity-libs-0.15.1.drv-0/build/libscap/engine/gvisor && /gnu/store/5lqhcv91ijy82p92ac6g5xw48l0lwwz4-gcc-11.3.0/bin/c++ -DHAVE_SYS_SYSMACROS_H -DPLATFORM_NAME=\"Linux\" -DSCAP_HOSTNAME_ENV_VAR=\"SCAP_HOSTNAME\" -DSCAP_HOST_ROOT_ENV_VAR_NAME=\"HOST_ROOT\" -DSCAP_KERNEL_MODULE_NAME=\"scap\" -D__STDC_FORMAT_MACROS -I/gnu/store/l2iwk7p08lpb0hhcp2jnlkqs06520441-googletest-1.12.1/include/gtest -Wall -ggdb -std=c++17 -O2 -g -DNDEBUG -fPIC -std=c++17 -MD -MT libscap/engine/gvisor/CMakeFiles/scap_engine_gvisor_o.dir/parsers.cpp.o -MF CMakeFiles/scap_engine_gvisor_o.dir/parsers.cpp.o.d -o CMakeFiles/scap_engine_gvisor_o.dir/parsers.cpp.o -c /tmp/guix-build-falcosecurity-libs-0.15.1.drv-0/source/userspace/libscap/engine/gvisor/parsers.cpp
/tmp/guix-build-falcosecurity-libs-0.15.1.drv-0/source/userspace/libscap/engine/gvisor/parsers.cpp:31:10: fatal error: driver/syscall_compat_x86_64.h: No such file or directory
   31 | #include <driver/syscall_compat_x86_64.h>
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
make[2]: *** [libscap/engine/gvisor/CMakeFiles/scap_engine_gvisor_o.dir/build.make:110: libscap/engine/gvisor/CMakeFiles/scap_engine_gvisor_o.dir/parsers.cpp.o] Error 1
make[2]: Leaving directory '/tmp/guix-build-falcosecurity-libs-0.15.1.drv-0/build'
make[1]: *** [CMakeFiles/Makefile2:1183: libscap/engine/gvisor/CMakeFiles/scap_engine_gvisor_o.dir/all] Error 2
make[1]: Leaving directory '/tmp/guix-build-falcosecurity-libs-0.15.1.drv-0/build'
make: *** [Makefile:139: all] Error 2
error: in phase 'build': uncaught exception:
%exception #<&invoke-error program: "make" arguments: ("-j" "1") exit-status: 2 term-signal: #f stop-signal: #f> 
phase `build' failed after 0.8 seconds
command "make" "-j" "1" failed with status 2

How to reproduce it

I'm building using system libraries only and with the following CMake flags: "../source" "-DCMAKE_BUILD_TYPE=RelWithDebInfo" "-DCMAKE_INSTALL_PREFIX=/gnu/store/qvsb1bb8q71xgm1x93p6dwpm7phmcppj-falcosecurity-libs-0.15.1" "-DCMAKE_INSTALL_LIBDIR=lib" "-DCMAKE_INSTALL_RPATH_USE_LINK_PATH=TRUE" "-DCMAKE_INSTALL_RPATH=/gnu/store/qvsb1bb8q71xgm1x93p6dwpm7phmcppj-falcosecurity-libs-0.15.1/lib" "-DCMAKE_VERBOSE_MAKEFILE=ON" "-DUSE_BUNDLED_DEPS=OFF" "-DBUILD_DRIVER=OFF" "-DBUILD_LIBSINSP_EXAMPLES=OFF" "-DBUILD_LIBSCAP_EXAMPLES=OFF" "-DBUILD_SHARED_LIBS=ON" "-DENABLE_LIBSCAP_TESTS=ON" "-DFALCOSECURITY_LIBS_VERSION=0.15.1"

Expected behaviour

Build should succeed.

Apteryks commented 7 months ago

The same happens when attempting to build from the latest commit: b3734896de3fa23a78003a0d203d6a3aae896339.

Apteryks commented 7 months ago

Seems related to the use of "-DBUILD_SHARED_LIBS=ON". When switching this to OFF, it proceeds further, but eventually fails with:

[ 70%] Building C object libscap/engine/bpf/CMakeFiles/scap_engine_bpf.dir/scap_bpf.c.o
cd /tmp/guix-build-falcosecurity-libs-0.15.1.drv-0/build/libscap/engine/bpf && /gnu/store/5lqhcv91ijy82p92ac6g5xw48l0lwwz4-gcc-11.3.0/bin/gcc -DHAVE_SYS_SYSMACROS_H -DPLATFORM_NAME=\"Linux\" -DSCAP_HOSTNAME_ENV_VAR=\"SCAP_HOSTNAME\" -DSCAP_HOST_ROOT_ENV_VAR_NAME=\"HOST_ROOT\" -DSCAP_KERNEL_MODULE_NAME=\"scap\" -D__STDC_FORMAT_MACROS -I/gnu/store/l2iwk7p08lpb0hhcp2jnlkqs06520441-googletest-1.12.1/include/gtest -I/tmp/guix-build-falcosecurity-libs-0.15.1.drv-0/build/driver/src -I/tmp/guix-build-falcosecurity-libs-0.15.1.drv-0/source -I/tmp/guix-build-falcosecurity-libs-0.15.1.drv-0/source/userspace -I/tmp/guix-build-falcosecurity-libs-0.15.1.drv-0/build -I/tmp/guix-build-falcosecurity-libs-0.15.1.drv-0/source/userspace/libscap/linux -Wall -ggdb -O2 -g -DNDEBUG -MD -MT libscap/engine/bpf/CMakeFiles/scap_engine_bpf.dir/scap_bpf.c.o -MF CMakeFiles/scap_engine_bpf.dir/scap_bpf.c.o.d -o CMakeFiles/scap_engine_bpf.dir/scap_bpf.c.o -c /tmp/guix-build-falcosecurity-libs-0.15.1.drv-0/source/userspace/libscap/engine/bpf/scap_bpf.c
/tmp/guix-build-falcosecurity-libs-0.15.1.drv-0/source/userspace/libscap/engine/bpf/scap_bpf.c: In function ‘load_bpf_file’:
/tmp/guix-build-falcosecurity-libs-0.15.1.drv-0/source/userspace/libscap/engine/bpf/scap_bpf.c:717:61: error: ‘ELF_C_READ_MMAP_PRIVATE’ undeclared (first use in this function)
  717 |                 handle->elf = elf_begin(handle->program_fd, ELF_C_READ_MMAP_PRIVATE, NULL);
      |                                                             ^~~~~~~~~~~~~~~~~~~~~~~
/tmp/guix-build-falcosecurity-libs-0.15.1.drv-0/source/userspace/libscap/engine/bpf/scap_bpf.c:717:61: note: each undeclared identifier is reported only once for each function it appears in
make[3]: *** [libscap/engine/bpf/CMakeFiles/scap_engine_bpf.dir/build.make:79: libscap/engine/bpf/CMakeFiles/scap_engine_bpf.dir/scap_bpf.c.o] Error 1
make[3]: Leaving directory '/tmp/guix-build-falcosecurity-libs-0.15.1.drv-0/build'
make[2]: *** [CMakeFiles/Makefile2:1163: libscap/engine/bpf/CMakeFiles/scap_engine_bpf.dir/all] Error 2
make[2]: Leaving directory '/tmp/guix-build-falcosecurity-libs-0.15.1.drv-0/build'
make[1]: *** [CMakeFiles/Makefile2:814: libscap/CMakeFiles/scap.dir/rule] Error 2
make[1]: Leaving directory '/tmp/guix-build-falcosecurity-libs-0.15.1.drv-0/build'
make: *** [Makefile:341: scap] Error 2
error: in phase 'build': uncaught exception:
%exception #<&invoke-error program: "make" arguments: ("-j" "1" "scap") exit-status: 2 term-signal: #f stop-signal: #f> 
phase `build' failed after 13.9 seconds
Apteryks commented 7 months ago

/tmp/guix-build-falcosecurity-libs-0.15.1.drv-0/source/userspace/libscap/engine/bpf/scap_bpf.c: In function ‘load_bpf_file’: /tmp/guix-build-falcosecurity-libs-0.15.1.drv-0/source/userspace/libscap/engine/bpf/scap_bpf.c:717:61: error: ‘ELF_C_READ_MMAP_PRIVATE’ undeclared (first use in this function) 717 | handle->elf = elf_begin(handle->program_fd, ELF_C_READ_MMAP_PRIVATE, NULL);

This was resolved by adding elfutils to the build environment. Ideally CMake should check for it.

Apteryks commented 6 months ago

I've made some progress on this. I'm now encountering:

[ 98%] Linking CXX executable libscap_test
cd /home/maxim/src/falcosecurity-libs/build4/test/libscap && /gnu/store/jg0xx3g6ac56mfs7646qln18z4y9fpj0-cmake-minimal-3.24.2/bin/cmake -E cmake_link_script CMakeFiles/libscap_test.dir/link.txt --verbose=1
/gnu/store/zkzvc2b0xggy6ah9xxyar1i1z9dj185i-profile/bin/c++  -Wall -ggdb -std=c++17 -O3 -fno-strict-aliasing -DNDEBUG CMakeFiles/libscap_test.dir/test_suites/userspace/common_strl.cpp.o CMakeFiles/libscap_test.dir/test_suites/userspace/event_table.cpp.o CMakeFiles/libscap_test.dir/test_suites/userspace/linux/scap_cgroup.cpp.o CMakeFiles/libscap_test.dir/test_suites/userspace/ppm_sc_names_table.cpp.o CMakeFiles/libscap_test.dir/test_suites/userspace/scap_event.cpp.o CMakeFiles/libscap_test.dir/test_suites/userspace/scap_ppm_sc.cpp.o CMakeFiles/libscap_test.dir/test_suites/userspace/syscall_table.cpp.o CMakeFiles/libscap_test.dir/helpers/engines.cpp.o CMakeFiles/libscap_test.dir/test_suites/engines/modern_bpf/modern_bpf.cpp.o CMakeFiles/libscap_test.dir/test_suites/engines/gvisor/gvisor_parsers.cpp.o CMakeFiles/libscap_test.dir/test_suites/engines/gvisor/gvisor_platform.cpp.o -o libscap_test  -Wl,-rpath,/home/maxim/src/falcosecurity-libs/build4/libscap:/home/maxim/src/falcosecurity-libs/build4/libscap/engine/nodriver:/home/maxim/src/falcosecurity-libs/build4/libscap/engine/test_input:/home/maxim/src/falcosecurity-libs/build4/libscap/engine/source_plugin:/home/maxim/src/falcosecurity-libs/build4/libscap/engine/kmod:/home/maxim/src/falcosecurity-libs/build4/libscap/engine/bpf:/home/maxim/src/falcosecurity-libs/build4/libscap/engine/modern_bpf:/home/maxim/src/falcosecurity-libs/build4/libpman /gnu/store/zkzvc2b0xggy6ah9xxyar1i1z9dj185i-profile/lib/libgtest.so /gnu/store/zkzvc2b0xggy6ah9xxyar1i1z9dj185i-profile/lib/libgtest_main.so ../../libscap/libscap.so.0.0.0 ../../libscap/libscap_engine_util.a ../../libscap/engine/nodriver/libscap_engine_nodriver.so.0.0.0 ../../libscap/engine/test_input/libscap_engine_test_input.so.0.0.0 ../../libscap/engine/savefile/libscap_engine_savefile.a ../../libscap/engine/noop/libscap_engine_noop.a ../../libscap/engine/source_plugin/libscap_engine_source_plugin.so.0.0.0 ../../libscap/engine/kmod/libscap_engine_kmod.so.0.0.0 ../../libscap/engine/bpf/libscap_engine_bpf.so.0.0.0 ../../libscap/engine/modern_bpf/libscap_engine_modern_bpf.so.0.0.0 ../../libscap/libscap_event_schema.a ../../libscap/libdriver_event_schema.a ../../libscap/linux/libscap_platform.a ../../libscap/libscap_error.a ../../libscap/libscap_platform_util.a /gnu/store/zkzvc2b0xggy6ah9xxyar1i1z9dj185i-profile/lib/libz.so -Wl,-rpath-link,/home/maxim/src/falcosecurity-libs/build4/libpman 
ld: CMakeFiles/libscap_test.dir/test_suites/engines/gvisor/gvisor_parsers.cpp.o: undefined reference to symbol '_ZN6google8protobuf8internal14ArenaStringPtr3SetERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPNS0_5ArenaE'
ld: /gnu/store/zkzvc2b0xggy6ah9xxyar1i1z9dj185i-profile/lib/libprotobuf.so.32: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
make[2]: *** [test/libscap/CMakeFiles/libscap_test.dir/build.make:275: test/libscap/libscap_test] Error 1
make[2]: Leaving directory '/home/maxim/src/falcosecurity-libs/build4'
poiana commented 3 months ago

Issues go stale after 90d of inactivity.

Mark the issue as fresh with /remove-lifecycle stale.

Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

Provide feedback via https://github.com/falcosecurity/community.

/lifecycle stale

poiana commented 2 months ago

Stale issues rot after 30d of inactivity.

Mark the issue as fresh with /remove-lifecycle rotten.

Rotten issues close after an additional 30d of inactivity.

If this issue is safe to close now please do so with /close.

Provide feedback via https://github.com/falcosecurity/community.

/lifecycle rotten

Apteryks commented 2 months ago

/remove-lifecycle rotten