• pahole编译过程libbpf: failed to find valid kernel BTF


    下载源码:

    git clone https://kernel.googlesource.com/pub/scm/devel/pahole/pahole

    下载libbpf源码:

    git clone https://github.com/libbpf/libbpf

    屏蔽pahole下CMakeLists.txt相关代码

    +++ b/CMakeLists.txt
    @@ -35,26 +35,6 @@ find_package(DWARF REQUIRED)
     find_package(ZLIB REQUIRED)
    
     # make sure git submodule(s) are checked out
    -find_package(Git QUIET)
    -if(GIT_FOUND AND EXISTS "${PROJECT_SOURCE_DIR}/.git")
    -       # Update submodules as needed
    -       option(GIT_SUBMODULE "Check submodules during build" ON)
    -       if(GIT_SUBMODULE)
    -               message(STATUS "Submodule update")
    -               execute_process(COMMAND ${GIT_EXECUTABLE} submodule update --init --recursive
    -                               WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
    -                               RESULT_VARIABLE GIT_SUBMOD_RESULT)
    -               if(NOT GIT_SUBMOD_RESULT EQUAL "0")
    -                       message(FATAL_ERROR "git submodule update --init failed with ${GIT_SUBMOD_RESULT}, please checkout submodules")
    -               else()
    -                       message(STATUS "Submodule update - done")
    -               endif()
    -       endif()
    -endif()
    -if(NOT EXISTS "${PROJECT_SOURCE_DIR}/lib/bpf/src/btf.h")
    -       message(FATAL_ERROR "The submodules were not downloaded! GIT_SUBMODULE was turned off or failed. Please update submodules and try again.")
    -endif()
    -
    

      

    创建mkdir lib/bpf目录,将libbpf源码拷贝到该目录下

    编译:

        mkdir build
        cd build
        cmake -D__LIB=lib .. 
        make 
        make install    
  • 相关阅读:
    c++ primer 中讲的顶层const 和 底层 const 理解
    github 0 学习
    MySQL 0 学习
    c++11 move构造函数和move operator 函数 学习
    c++11 多线程 1
    c++ 多线程 0
    学习 emplace_back() 和 push_back 的区别 emplace_back效率高
    crontab执行脚本失败问题
    lucene 排序
    maven 内置变量
  • 原文地址:https://www.cnblogs.com/haoxing990/p/13683839.html
Copyright © 2020-2023  润新知