centos 7.6编译安装cmake3.9

运行./configure 报错

[root@localhost cmake-3.9.0]# ./configure
---------------------------------------------
CMake 3.9.0, Copyright 2000-2017 Kitware, Inc. and Contributors
Found GNU toolchain
C compiler on this system is: gcc  -std=gnu11
C++ compiler on this system is: g++  -std=gnu++1y
Makefile processor on this system is: gmake
g++ is GNU compiler
g++ has setenv
g++ has unsetenv
g++ does not have environ in stdlib.h
g++ has stl wstring
g++ has <ext/stdio_filebuf.h>
---------------------------------------------
g++  -std=gnu++1y     -I/data/cmake-3.9.0/Bootstrap.cmk   -I/data/cmake-3.9.0/Source   -I/data/cmake-3.9.0/Source/LexerParser   -I/data/cmake-3.9.0/Utilities  -c /data/cmake-3.9.0/Source/cmSystemTools.cxx -o cmSystemTools.o
/data/cmake-3.9.0/Source/cmSystemTools.cxx: In static member function ‘static void cmSystemTools::FindCMakeResources(const char*)’:
/data/cmake-3.9.0/Source/cmSystemTools.cxx:2061:13: error: ‘CMAKE_BOOTSTRAP_BINARY_DIR’ was not declared in this scope
   exe_dir = CMAKE_BOOTSTRAP_BINARY_DIR "/bin";
             ^
/data/cmake-3.9.0/Source/cmSystemTools.cxx:2061:40: error: expected ‘;’ before string constant
   exe_dir = CMAKE_BOOTSTRAP_BINARY_DIR "/bin";
                                        ^
/data/cmake-3.9.0/Source/cmSystemTools.cxx:2121:28: error: ‘CMAKE_BOOTSTRAP_SOURCE_DIR’ was not declared in this scope
   cmSystemToolsCMakeRoot = CMAKE_BOOTSTRAP_SOURCE_DIR;
                            ^
gmake: *** [cmSystemTools.o] Error 1
---------------------------------------------
Error when bootstrapping CMake:
Problem while running gmake
---------------------------------------------
Log of errors: /data/cmake-3.9.0/Bootstrap.cmk/cmake_bootstrap.log
---------------------------------------------


cmake3.9不需要用./configure 配置,而是使用./bootstrap 进行引导

[root@localhost cmake-3.9.0]# ./bootstrap && make && make install
---------------------------------------------
CMake 3.9.0, Copyright 2000-2017 Kitware, Inc. and Contributors
Found GNU toolchain
C compiler on this system is: gcc  -std=gnu11
C++ compiler on this system is: g++  -std=gnu++1y
Makefile processor on this system is: gmake
g++ is GNU compiler
g++ has setenv
g++ has unsetenv
g++ does not have environ in stdlib.h
g++ has stl wstring
g++ has <ext/stdio_filebuf.h>
---------------------------------------------
g++  -std=gnu++1y     -I/data/cmake-3.9.0/Bootstrap.cmk   -I/data/cmake-3.9.0/Source   -I/data/cmake-3.9.0/Source/LexerParser   -I/data/cmake-3.9.0/Utilities  -c /data/cmake-3.9.0/Source/cmSystemTools.cxx -o cmSystemTools.o
/data/cmake-3.9.0/Source/cmSystemTools.cxx: In static member function ‘static void cmSystemTools::FindCMakeResources(const char*)’:
/data/cmake-3.9.0/Source/cmSystemTools.cxx:2061:13: error: ‘CMAKE_BOOTSTRAP_BINARY_DIR’ was not declared in this scope
   exe_dir = CMAKE_BOOTSTRAP_BINARY_DIR "/bin";
             ^
/data/cmake-3.9.0/Source/cmSystemTools.cxx:2061:40: error: expected ‘;’ before string constant
   exe_dir = CMAKE_BOOTSTRAP_BINARY_DIR "/bin";
                                        ^
/data/cmake-3.9.0/Source/cmSystemTools.cxx:2121:28: error: ‘CMAKE_BOOTSTRAP_SOURCE_DIR’ was not declared in this scope
   cmSystemToolsCMakeRoot = CMAKE_BOOTSTRAP_SOURCE_DIR;
                            ^
gmake: *** [cmSystemTools.o] Error 1
---------------------------------------------
Error when bootstrapping CMake:
Problem while running gmake
---------------------------------------------
Log of errors: /data/cmake-3.9.0/Bootstrap.cmk/cmake_bootstrap.log
---------------------------------------------
trap.log
---------------------------------------------

删除目录重新解压编译即可

rm -fr cmake-3.9.0 && tar xf cmake-3.9.0.tar.gz
cd cmake-3.9.0 &&  ./bootstrap && make && make install

make时报错:

[ 23%] Linking C executable LIBCURL
lib/libcmcurl.a(openssl.c.o): In function `sk_X509_EXTENSION_num':
openssl.c:(.text+0xb6): undefined reference to `OPENSSL_sk_num'
lib/libcmcurl.a(openssl.c.o): In function `sk_X509_EXTENSION_value':
openssl.c:(.text+0xd8): undefined reference to `OPENSSL_sk_value'
lib/libcmcurl.a(openssl.c.o): In function `sk_X509_num':
openssl.c:(.text+0xf2): undefined reference to `OPENSSL_sk_num'
lib/libcmcurl.a(openssl.c.o): In function `sk_X509_value':
openssl.c:(.text+0x114): undefined reference to `OPENSSL_sk_value'
lib/libcmcurl.a(openssl.c.o): In function `sk_X509_pop':
openssl.c:(.text+0x12e): undefined reference to `OPENSSL_sk_pop'
lib/libcmcurl.a(openssl.c.o): In function `sk_X509_pop_free':
openssl.c:(.text+0x153): undefined reference to `OPENSSL_sk_pop_free'
lib/libcmcurl.a(openssl.c.o): In function `sk_GENERAL_NAME_num':
openssl.c:(.text+0x16d): undefined reference to `OPENSSL_sk_num'
lib/libcmcurl.a(openssl.c.o): In function `sk_GENERAL_NAME_value':
openssl.c:(.text+0x18f): undefined reference to `OPENSSL_sk_value'
lib/libcmcurl.a(openssl.c.o): In function `verifyhost':
openssl.c:(.text+0x193c): undefined reference to `ASN1_STRING_get0_data'
openssl.c:(.text+0x1ba0): undefined reference to `ASN1_STRING_get0_data'
lib/libcmcurl.a(openssl.c.o): In function `ossl_connect_step1':
openssl.c:(.text+0x2cc9): undefined reference to `TLS_client_method'
openssl.c:(.text+0x3024): undefined reference to `SSL_CTX_set_options'
lib/libcmcurl.a(openssl.c.o): In function `get_cert_chain':
openssl.c:(.text+0x4362): undefined reference to `X509_get_version'
openssl.c:(.text+0x45c3): undefined reference to `X509_get0_extensions'
openssl.c:(.text+0x45e3): undefined reference to `X509_get0_notBefore'
openssl.c:(.text+0x466b): undefined reference to `X509_get0_notAfter'
openssl.c:(.text+0x4758): undefined reference to `EVP_PKEY_get0_RSA'
openssl.c:(.text+0x4781): undefined reference to `RSA_get0_key'
openssl.c:(.text+0x4868): undefined reference to `EVP_PKEY_get0_DSA'
openssl.c:(.text+0x4893): undefined reference to `DSA_get0_pqg'
openssl.c:(.text+0x48b1): undefined reference to `DSA_get0_key'
openssl.c:(.text+0x4962): undefined reference to `EVP_PKEY_get0_DH'
openssl.c:(.text+0x498d): undefined reference to `DH_get0_pqg'
openssl.c:(.text+0x49ab): undefined reference to `DH_get0_key'
lib/libcmcurl.a(openssl.c.o): In function `pkp_pin_peer_pubkey':
openssl.c:(.text+0x4c2d): undefined reference to `X509_get_X509_PUBKEY'
openssl.c:(.text+0x4c7b): undefined reference to `X509_get_X509_PUBKEY'
lib/libcmcurl.a(openssl.c.o): In function `servercert':
openssl.c:(.text+0x4f1e): undefined reference to `X509_get0_notBefore'
openssl.c:(.text+0x4fa6): undefined reference to `X509_get0_notAfter'
lib/libcmcurl.a(openssl.c.o): In function `Curl_ossl_version':
openssl.c:(.text+0x643e): undefined reference to `OpenSSL_version_num'
collect2: error: ld returned 1 exit status
make[2]: *** [Utilities/cmcurl/LIBCURL] Error 1
make[1]: *** [Utilities/cmcurl/CMakeFiles/LIBCURL.dir/all] Error 2
make: *** [all] Error 2

原因:
openssl版本过低或者不兼容,由于我系统上装了两个版本的openssl 编译时自动找的是低版本的openssl-1.0.2k
在这里插入图片描述
解决:
在/usr/lib64/ 重新添加软连接到新版本的openssl-1.1.1li

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值