make for linux下载,CMakeLists.txt

cmake_minimum_required (VERSION 3.14)

project (procmon)

# Set the project version number.

set (procmon_VERSION_MAJOR 1)

set (procmon_VERSION_MINOR 0)

set (procmon_VERSION_PATCH 1)

# make ncurses a requirement

find_package(Curses REQUIRED)

# Configure version header file to pass CMake settings to source code.

configure_file (

"${PROJECT_SOURCE_DIR}/src/version.h.in"

"${PROJECT_BINARY_DIR}/src/version.h"

)

include(FetchContent)

# Fetch bcc.

# TODO: Consider maybe making this a CMake script to be called.

FetchContent_Declare(

bcc

GIT_REPOSITORY https://github.com/iovisor/bcc.git

GIT_TAG v0.19.0

)

FetchContent_GetProperties(bcc)

if(NOT bcc_POPULATED)

FetchContent_Populate(bcc)

add_subdirectory(${bcc_SOURCE_DIR} ${bcc_BINARY_DIR} EXCLUDE_FROM_ALL)

endif()

# Include Sqlite3 amalgamation.

add_library(sqlite3-static STATIC

"${CMAKE_SOURCE_DIR}/vendor/sqlite3/sqlite3.c"

)

set_target_properties(sqlite3-static

PROPERTIES

INTERFACE_LINK_LIBRARIES "dl;pthread"

)

# Fetch Catch2 testing framework.

FetchContent_Declare(

Catch2

GIT_REPOSITORY https://github.com/catchorg/Catch2.git

GIT_TAG v2.7.2

)

FetchContent_MakeAvailable(Catch2)

# Set compiler flags.

set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -fno-omit-frame-pointer -DELPP_THREAD_SAFE -D ELPP_DEFAULT_LOG_FILE='\"/var/log/procmon.log\"'")

set (CMAKE_CXX_STANDARD 17)

set (CMAKE_CXX_STANDARD_REQUIRED True)

# Include required versioning, bcc, logging and sqlite3 header files.

include_directories(

"${PROJECT_BINARY_DIR}/src/"

"/usr/include/bcc/compat"

"${bcc_SOURCE_DIR}/src/cc/api"

"${bcc_SOURCE_DIR}/src/cc"

"${CMAKE_SOURCE_DIR}/vendor/sqlite3"

${CURSES_INCLUDE_DIR}

)

enable_testing()

# Create a static library target for each subdirectory.

add_subdirectory(src/common)

add_subdirectory(src/configuration)

add_subdirectory(src/storage)

add_subdirectory(src/tracer)

add_subdirectory(src/display)

add_subdirectory(src/logging)

# Add exectable and link all static libraries.

#add_executable(procmon src/procmon.cpp)

add_executable(

procmon

src/procmon.cpp

)

# Why does the order which these static libraries are listed matter here??

target_link_libraries(

procmon

configuration-static

tracer-static

storage-static

display-static

common-static

bcc-static

${CURSES_LIBRARIES}

-lpanel

logging-static

stdc++fs

)

# setup general packing Variables

set(CPACK_STRIP_FILES ON)

set(CPACK_PACKAGE_NAME ${PROJECT_NAME} )

set(CPACK_PACKAGE_VENDOR "Microsoft")

set(CPACK_PACKAGE_CONTACT "OSS Tooling Dev Team OSSToolingDevTeam@service.microsoft.com")

set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Procmon for Linux")

set(CPACK_PACKAGE_DESCRIPTION "Procmon is a Linux reimagining of the classic Procmon tool from the Sysinternals suite of tools for Windows. Procmon provides a convenient and efficient way for Linux developers to trace the syscall activity on the system.")

set(CPACK_PACKAGE_VERSION_MAJOR "${procmon_VERSION_MAJOR}")

set(CPACK_PACKAGE_VERSION_MINOR "${procmon_VERSION_MINOR}")

set(CPACK_PACKAGE_VERSION_PATCH "${procmon_VERSION_PATCH}")

set(AZDO_BUILD_ID "999999")

# setup license and readme for package

SET(CPACK_RESOURCE_FILE_LICENSE ${PROJECT_SOURCE_DIR}/LICENSE)

SET(CPACK_RESOURCE_FILE_README ${PROJECT_SOURCE_DIR}/README.md)

# setup CPACK RPM Variables

set(CPACK_RPM_PACKAGE_DESCRIPTION ${CPACK_PACKAGE_DESCRIPTION})

set(CPACK_RPM_PACKAGE_LICENSE "MIT")

set(CPACK_RPM_PACKAGE_URL "https://github.com/Microsoft/Procmon-for-Linux")

set(CPACK_RPM_PACKAGE_GROUP "Development/Tools")

# setup CPACK DEB Variables

set(CPACK_DEBIAN_PACKAGE_DESCRIPTION ${CPACK_PACKAGE_DESCRIPTION})

set(CPACK_DEBIAN_PACKAGE_SECTION "devel")

set(CPACK_DEBIAN_PACKAGE_HOMEPAGE "https://github.com/Microsoft/Procmon-for-Linux")

set(CPACK_DEBIAN_PACKAGE_MAINTAINER "OSS Tooling Dev Team OSSToolingDevTeam@service.microsoft.com")

# setup install

INSTALL(TARGETS procmon DESTINATION /usr/bin)

# are we running on centos or ubuntu build agent?

execute_process(COMMAND lsb_release -si OUTPUT_VARIABLE distro OUTPUT_STRIP_TRAILING_WHITESPACE)

if(distro STREQUAL "CentOS")

set(CPACK_GENERATOR "RPM")

execute_process(COMMAND uname -m OUTPUT_VARIABLE CPACK_RPM_PACKAGE_ARCHITECTURE OUTPUT_STRIP_TRAILING_WHITESPACE)

set(CPACK_PACKAGE_FILE_NAME ${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}-${AZDO_BUILD_ID}.${CPACK_RPM_PACKAGE_ARCHITECTURE})

elseif(distro STREQUAL "Ubuntu")

# get distro name

execute_process(COMMAND lsb_release -sc OUTPUT_VARIABLE distro_name OUTPUT_STRIP_TRAILING_WHITESPACE)

# we are building a debian package

set(CPACK_GENERATOR "DEB")

# install manpage file

INSTALL(FILES procmon.1 DESTINATION /usr/share/man/man1/)

# check what version of Ubuntu we are working with

if(distro_name STREQUAL "bionic") # 18.04

set(CPACK_DEBIAN_PACKAGE_DEPENDS "libc6 (>= 2.26), libstdc++6 (>= 8.4), libzstd1 (>= 1.3), libelf1 (>= 0.170), libncurses5 (>= 5.0), libtinfo5 (>= 6)")

elseif(distro_name STREQUAL "focal") # 20.04

set(CPACK_DEBIAN_PACKAGE_DEPENDS "libc6 (>= 2.31), libstdc++6 (>= 10.2), libzstd1 (>= 1.4), libelf1 (>= 0.176), libncurses6 (>= 6.2), libtinfo6 (>= 6)")

endif()

execute_process(COMMAND dpkg --print-architecture OUTPUT_VARIABLE CPACK_DEBIAN_PACKAGE_ARCHITECTURE OUTPUT_STRIP_TRAILING_WHITESPACE)

set(CPACK_PACKAGE_FILE_NAME ${CPACK_PACKAGE_NAME}_${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}-${AZDO_BUILD_ID}_${CPACK_DEBIAN_PACKAGE_ARCHITECTURE})

endif()

include(CPack)

一键复制

编辑

Web IDE

原始数据

按行查看

历史

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Log data follows: | DEBUG: Executing shell function do_configure | CMake Warning at CMakeLists.txt:7 (message): | Build type not set, falling back to Release mode. | | To specify build type use: | -DCMAKE_BUILD_TYPE=<mode> where <mode> is Debug or Release. | | | -- Building without demo. To enable demo build use: -DWITH_DEMO=True | -- The C compiler identification is GNU 7.3.0 | -- The CXX compiler identification is GNU 7.3.0 | -- Check for working C compiler: /home/wu/test_D9/D9_PTG1.5/build-d9/tmp/work/aarch64-niic-linux/antlr4/4.7.2-r0/recipe-sysroot-native/usr/bin/aarch64-niic-linux/aarch64-niic-linux-gcc | -- Check for working C compiler: /home/wu/test_D9/D9_PTG1.5/build-d9/tmp/work/aarch64-niic-linux/antlr4/4.7.2-r0/recipe-sysroot-native/usr/bin/aarch64-niic-linux/aarch64-niic-linux-gcc -- works | -- Detecting C compiler ABI info | -- Detecting C compiler ABI info - done | -- Detecting C compile features | -- Detecting C compile features - done | -- Check for working CXX compiler: /home/wu/test_D9/D9_PTG1.5/build-d9/tmp/work/aarch64-niic-linux/antlr4/4.7.2-r0/recipe-sysroot-native/usr/bin/aarch64-niic-linux/aarch64-niic-linux-g++ | -- Check for working CXX compiler: /home/wu/test_D9/D9_PTG1.5/build-d9/tmp/work/aarch64-niic-linux/antlr4/4.7.2-r0/recipe-sysroot-native/usr/bin/aarch64-niic-linux/aarch64-niic-linux-g++ -- works | -- Detecting CXX compiler ABI info | -- Detecting CXX compiler ABI info - done | -- Detecting CXX compile features | -- Detecting CXX compile features - done | -- Found PkgConfig: /home/wu/test_D9/D9_PTG1.5/build-d9/tmp/work/aarch64-niic-linux/antlr4/4.7.2-r0/recipe-sysroot-native/usr/bin/pkg-config (found version "0.29.2") | -- Checking for module 'uuid' | -- Found uuid, version 2.32.1 | -- Output libraries to /home/wu/test_D9/D9_PTG1.5/build-d9/tmp/work/aarch64-niic-linux/antlr4/4.7.2-r0/git/runtime/Cpp/dist | CMake Error at runtime/CMakeLists.txt:104 (install): | install TARGETS given no LIBRARY DESTINATION for shared library target | "antlr4_shared". | | | CMake Error at runtime/CMakeLists.txt:107 (install): | install TARGETS given no ARCHIVE DESTINATION for static library target | "antlr4_static". | | | -- Configuring incomplete, errors occurred! | See also "/home/wu/test_D9/D9_PTG1.5/build-d9/tmp/work/aarch64-niic-linux/antlr4/4.7.2-r0/build/CMakeFiles/CMakeOutput.log".这是报错的log,如何解决这个问题
07-11
根据提供的日志,可以看出在CMake配置过程中出现了两个错误。错误信息分别是: 1. CMake Error at runtime/CMakeLists.txt:104 (install): install TARGETS given no LIBRARY DESTINATION for shared library target "antlr4_shared". 2. CMake Error at runtime/CMakeLists.txt:107 (install): install TARGETS given no ARCHIVE DESTINATION for static library target "antlr4_static". 这些错误表明在配置期间,对于共享库目标 "antlr4_shared" 没有给出 LIBRARY DESTINATION,对于静态库目标 "antlr4_static" 没有给出 ARCHIVE DESTINATION。 要解决这个问题,你可以尝试以下方法: 1. 检查CMakeLists.txt文件:打开 "/home/wu/test_D9/D9_PTG1.5/build-d9/tmp/work/aarch64-niic-linux/antlr4/4.7.2-r0/git/runtime/CMakeLists.txt" 文件,并查找与 "antlr4_shared" 和 "antlr4_static" 相关的安装指令。 2. 添加正确的目标安装路径:在对应的安装指令中,确保给出了正确的目标安装路径。例如,对于共享库目标 "antlr4_shared",应该设置 LIBRARY DESTINATION,而对于静态库目标 "antlr4_static",应该设置 ARCHIVE DESTINATION。 3. 重新运行CMake配置:保存文件,并重新运行CMake配置命令以重新生成项目。可以尝试使用以下命令:`cmake /path/to/source`。 4. 编译和安装:如果配置成功,继续进行编译和安装。使用 `make` 命令编译项目,并使用 `make install` 命令安装项目。 如果问题仍然存在,可能需要进一步检查CMakeLists.txt文件中的其他配置,以及确保所有依赖项都正确安装。在解决问题时,可以查看 "/home/wu/test_D9/D9_PTG1.5/build-d9/tmp/work/aarch64-niic-linux/antlr4/4.7.2-r0/build/CMakeFiles/CMakeOutput.log" 文件,以获取更多有关配置错误的详细信息。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值