gpt4 book ai didi

c++ - 用cmake构建比特币

转载 作者:行者123 更新时间:2023-12-03 07:16:27 28 4
gpt4 key购买 nike

我试图用cmake编译比特币,但出现以下错误。

系统信息:

4.4.0-116-generic
cmake version 3.5.1
gcc version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.10)

CMakeLists.txt(演示)
cmake_minimum_required(VERSION 2.8.12.2)

project(Bitcoin)

#set(CMAKE_CXX_STANDARD 11)

add_definitions(-std=c++11)

......


get_property(dirs DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY INCLUDE_DIRECTORIES)
foreach(dir ${dirs})
message(STATUS "dir='${dir}'")
endforeach()

aux_source_directory(./src/ DIR_SRCS)

add_executable(bitcoin ${DIR_SRCS})
cmake .

-- Configuring done

-- Generating done

-- Build files have been written to: /home/fyn/bitcoin


make
    In file included from /usr/include/stdlib.h:42:0,
from /usr/include/c++/5/cstdlib:72,
from /usr/include/c++/5/ext/string_conversions.h:41,
from /usr/include/c++/5/bits/basic_string.h:5249,
from /usr/include/c++/5/string:52,
from /home/youwei/bitcoin/src/fs.h:9,
from /home/youwei/bitcoin/src/fs.cpp:1:
/usr/include/x86_64-linux-gnu/bits/waitstatus.h:79:27: error: redeclaration of ‘unsigned int wait::<anonymous struct>::__w_retcode’
unsigned int __w_retcode:8;
^
/usr/include/x86_64-linux-gnu/bits/waitstatus.h:74:27: note: previous declaration ‘unsigned int wait::<anonymous struct>::__w_retcode’
unsigned int __w_retcode:8; /* Return code if exited normally. */
^
/usr/include/x86_64-linux-gnu/bits/waitstatus.h:80:28: error: redeclaration of ‘unsigned int wait::<anonymous struct>::__w_coredump’
unsigned int __w_coredump:1;

CMakeFiles/bitcoin.dir/build.make:86: recipe for target 'CMakeFiles/bitcoin.dir/src/fs.cpp.o' failed
make[2]: *** [CMakeFiles/bitcoin.dir/src/fs.cpp.o] Error 1
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/bitcoin.dir/all' failed
make[1]: *** [CMakeFiles/bitcoin.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2

最佳答案

您显然缺少某些库。跑

./autogen.sh
./configure --with-gui=no --disable-wallet

并检查日志(它将告诉您缺少哪些库)

编辑:如果您想了解完全的兼容性,建议删除 --with-gui=no --disable-wallet

关于c++ - 用cmake构建比特币,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52178438/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com