报错明细
安装了Centos8.4 minimal版后对xmrig挖矿程序进行无抽水编译,执行:
make
进行编译后报错:
[root@MiWiFi-R4CM-srv build]# make
[ 2%] Built target xmrig-asm
[ 3%] Built target argon2-avx512f
[ 4%] Built target argon2-ssse3
[ 5%] Built target argon2-sse2
[ 6%] Built target argon2-xop
[ 7%] Built target argon2-avx2
[ 11%] Built target argon2
[ 11%] Linking CXX executable xmrig
/usr/bin/ld: 找不到 -lstdc++
collect2: 错误:ld 返回 1
make[2]: *** [CMakeFiles/xmrig.dir/build.make:2874:xmrig] 错误 1
make[1]: *** [CMakeFiles/Makefile2:160:CMakeFiles/xmrig.dir/all] 错误 2
make: *** [Makefile:103:all] 错误 2
问题分析
报错信息说的很清楚,找不到-lstdc++模块。
解决办法
解决办法很简单,就是安装-lstdc++模块。但是很可惜Centos8.4 minimal目前无法通过yum这样的安装方式直接安装,只能自己下载rpm包进行安装。
首先我们下载-lstdc++ rpm包(可以去http://mirror.centos.org/centos/寻找对应你的系统版本的安装包):
wget http://mirror.centos.org/centos/8/PowerTools/x86_64/os/Packages/libstdc++-static-8.4.1-1.el8.x86_64.rpm
然后进行安装:
rpm -ivh libstdc++-static-8.4.1-1.el8.x86_64.rpm
之后再执行make语句便能够顺利完成编译:
[ …… ] …………………………………………………………
[ 90%] Building CXX object CMakeFiles/xmrig.dir/src/crypto/rx/Rx.cpp.o
[ 90%] Building CXX object CMakeFiles/xmrig.dir/src/crypto/rx/RxAlgo.cpp.o
[ 91%] Building CXX object CMakeFiles/xmrig.dir/src/crypto/rx/RxBasicStorage.cpp.o
[ 91%] Building CXX object CMakeFiles/xmrig.dir/src/crypto/rx/RxCache.cpp.o
[ 92%] Building CXX object CMakeFiles/xmrig.dir/src/crypto/rx/RxConfig.cpp.o
[ 92%] Building CXX object CMakeFiles/xmrig.dir/src/crypto/rx/RxDataset.cpp.o
[ 93%] Building CXX object CMakeFiles/xmrig.dir/src/crypto/rx/RxQueue.cpp.o
[ 93%] Building CXX object CMakeFiles/xmrig.dir/src/crypto/rx/RxVm.cpp.o
[ 94%] Building C object CMakeFiles/xmrig.dir/src/crypto/randomx/jit_compiler_x86_static.S.o
[ 94%] Building CXX object CMakeFiles/xmrig.dir/src/crypto/randomx/jit_compiler_x86.cpp.o
[ 95%] Building CXX object CMakeFiles/xmrig.dir/src/crypto/rx/RxNUMAStorage.cpp.o
[ 95%] Building CXX object CMakeFiles/xmrig.dir/src/crypto/rx/Rx_linux.cpp.o
[ 96%] Building CXX object CMakeFiles/xmrig.dir/src/crypto/rx/msr/MsrItem.cpp.o
[ 96%] Building CXX object CMakeFiles/xmrig.dir/src/crypto/argon2/Impl.cpp.o
[ 97%] Building CXX object CMakeFiles/xmrig.dir/src/base/io/log/backends/SysLog.cpp.o
[ 97%] Building CXX object CMakeFiles/xmrig.dir/src/base/net/stratum/Tls.cpp.o
[ 98%] Building CXX object CMakeFiles/xmrig.dir/src/base/net/http/HttpsClient.cpp.o
[ 98%] Building CXX object CMakeFiles/xmrig.dir/src/crypto/common/Assembly.cpp.o
[ 99%] Building CXX object CMakeFiles/xmrig.dir/src/crypto/cn/r/CryptonightR_gen.cpp.o
[ 99%] Building CXX object CMakeFiles/xmrig.dir/src/crypto/cn/gpu/cn_gpu_avx.cpp.o
[100%] Building CXX object CMakeFiles/xmrig.dir/src/crypto/cn/gpu/cn_gpu_ssse3.cpp.o
[100%] Linking CXX executable xmrig
[100%] Built target xmrig
后记
大家有什么问题可下方留言交流。