CMake:“错误:包 [...] 构建失败”,m4 build() 方法中出现错误

CMake:“错误:包 [...] 构建失败”,m4 build() 方法中出现错误

我正在尝试为我的工作安装一个自定义软件。我下载了源代码,进入文件夹并输入$ cmake ..。阅读后AskUbuntu 答案,我推断问题出在我的 m4 安装上。我刚刚安装了 m4,但没有任何变化。当我运行 CMake 时,我得到了以下信息:

$ cmake ..
-- Conan: Automatic detection of conan settings from cmake
-- Conan: Settings= -pr;default
-- Conan executing: conan install /home/user/app/conanfile.txt -pr default -g=cmake --build=outdated --no-imports

-- Configuration:
[settings]
arch=x86_64
arch_build=x86_64
build_type=Release
compiler=gcc
compiler.libcxx=libstdc++11
compiler.version=9.4
os=Linux
os_build=Linux
[options]
[build_requires]
[env]

asio/1.16.0: Package is up to date

[...]

  CC       freadahead.o
  CC       fseek.o
  CC       fseeko.o
  CC       mbrtowc.o
  CC       obstack.o
freadahead.c: In function 'freadahead':
freadahead.c:92:3: error: #error "Please port gnulib freadahead.c to your platform! Look at the definition of fflush, fread, ungetc on your system, then report this to bug-gnulib."
   92 |  #error "Please port gnulib freadahead.c to your platform! Look at the definition of fflush, fread, ungetc on your system, then report this to bug-gnulib."
      |   ^~~~~
make[3]: *** [Makefile:1910: freadahead.o] Error 1
make[3]: *** Waiting for unfinished jobs....
fseeko.c: In function 'rpl_fseeko':
fseeko.c:110:4: error: #error "Please port gnulib fseeko.c to your platform! Look at the code in fseeko.c, then report this to bug-gnulib."
  110 |   #error "Please port gnulib fseeko.c to your platform! Look at the code in fseeko.c, then report this to bug-gnulib."
      |    ^~~~~
make[3]: *** [Makefile:1910: fseeko.o] Error 1
make[3]: Leaving directory '/home/user/.conan/data/m4_installer/1.4.18/bincrafters/stable/build/44fcf6b9a7fb86b2586303e3db40189d3b511830/source_subfolder/lib'
make[2]: *** [Makefile:1674: all] Error 2
make[2]: Leaving directory '/home/user/.conan/data/m4_installer/1.4.18/bincrafters/stable/build/44fcf6b9a7fb86b2586303e3db40189d3b511830/source_subfolder/lib'
make[1]: *** [Makefile:1572: all-recursive] Error 1
make[1]: Leaving directory '/home/user/.conan/data/m4_installer/1.4.18/bincrafters/stable/build/44fcf6b9a7fb86b2586303e3db40189d3b511830/source_subfolder'
make: *** [Makefile:1528: all] Error 2
m4_installer/1.4.18@bincrafters/stable:
jsonformoderncpp/3.7.0: WARN: Recipe 'jsonformoderncpp/3.7.0' is deprecated in favor of 'nlohmann_json'. Please, consider changing your requirements.
m4_installer/1.4.18@bincrafters/stable: WARN: Package binary is corrupted, removing: 44fcf6b9a7fb86b2586303e3db40189d3b511830
m4_installer/1.4.18@bincrafters/stable: WARN: Build folder is dirty, removing it: /home/user/.conan/data/m4_installer/1.4.18/bincrafters/stable/build/44fcf6b9a7fb86b2586303e3db40189d3b511830
m4_installer/1.4.18@bincrafters/stable: ERROR: Package '44fcf6b9a7fb86b2586303e3db40189d3b511830' build failed
m4_installer/1.4.18@bincrafters/stable: WARN: Build folder /home/user/.conan/data/m4_installer/1.4.18/bincrafters/stable/build/44fcf6b9a7fb86b2586303e3db40189d3b511830
ERROR: m4_installer/1.4.18@bincrafters/stable: Error in build() method, line 41
        env_build.make()
        ConanException: Error 2 while executing make -j8

CMake Error at cmake/modules/conan.cmake:371 (message):
  Conan install failed='1'
Call Stack (most recent call first):
  cmake/modules/conan.cmake:451 (conan_cmake_install)
  CMakeLists.txt:26 (conan_cmake_run)


-- Configuring incomplete, errors occurred!
See also "/home/user/app/build/CMakeFiles/CMakeOutput.log".

这让我抓狂了。我花了好几个小时四处寻找,重新安装 m4 等等,但我仍然无法构建这个软件。

CMakeOutput.log文件很长,我把它这里

如果有人有解决方案或指点,我会采纳!提前致谢。我应该补充一下,我在 Windows 11 上使用 WSL2,Ubuntu 20

答案1

经过一番努力,我终于让它工作了。我联系了开发我试图安装的应用程序的人。他们告诉我更新以下要求CMakeLists.txt

set(CMAKE_CXX_STANDARD 17)

conanfile.txt

[requires] fmt/7.1.0 
nlohmann_json/3.9.1 
libpcap/1.10.1 

相关内容