CMake 3.2 or higher is required. You are running version 2.8.12.2
--
> install.packages("nloptr")
trying URL 'https://mirrors.tuna.tsinghua.edu.cn/CRAN/src/contrib/nloptr_2.0.3.tar.gz'
Content type 'application/octet-stream' length 2219877 bytes (2.1 MB)
==================================================
downloaded 2.1 MB
* installing *source* package ‘nloptr’ ...
** package ‘nloptr’ successfully unpacked and MD5 sums checked
** using staged installation
checking whether the C++ compiler works... yes
checking for C++ compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether the compiler supports GNU C++... yes
checking whether g++ -std=gnu++11 accepts -g... yes
checking for g++ -std=gnu++11 option to enable C++11 features... none needed
checking how to run the C++ preprocessor... g++ -std=gnu++11 -E
checking whether the compiler supports GNU C++... (cached) yes
checking whether g++ -std=gnu++11 accepts -g... (cached) yes
checking for g++ -std=gnu++11 option to enable C++11 features... (cached) none needed
checking for pkg-config... /usr/bin/pkg-config
checking if pkg-config knows NLopt... yes
checking for pkg-config checking NLopt version... insufficient: NLopt 2.7.0 or later is preferred.
checking for cmake... /usr/bin/cmake
using NLopt via local cmake build on x86_64
set CMAKE_BIN=/usr/bin/cmake
set CC=gcc -std=gnu99
set CFLAGS=-I/usr/local/include -fpic -g -O2
set CXX=g++
set CXXFLAGS=-std=gnu++11 -I/usr/local/include -fpic -g -O2
set LDFLAGS=-L/usr/local/lib64
CMake Error at CMakeLists.txt:15 (cmake_minimum_required):
CMake 3.2 or higher is required. You are running version 2.8.12.2
-- Configuring incomplete, errors occurred!
make: *** No targets specified and no makefile found. Stop.
make: *** No rule to make target `install'. Stop.
CMake 3.2 or higher is required. You are running version 2.8.12.2
更新cmake:
1.从Index of /files/v3.2 下载 cmake-3.2.0-Linux-x86_64.tar.gz, 这是已编译好的.
也可以下载cmake-3.2.0.tar.gz按下面方法自己编译:
解包后
./bootstrap
gmake
sudo make install
2. 备份旧cmake, 将cmake指向3.2.0版本
sudo ln -sf /opt/R/cmake-3.2.0-Linux-x86_64/bin/cmake /usr/bin/cmake
#最后目录里的cmake是这样的:
/usr/bin/cmake* -l
/usr/bin/cmake -> /opt/R/cmake-3.2.0-Linux-x86_64/bin/cmake
/usr/bin/cmake.2.8.12.2
/usr/bin/cmake.3.2.0 -> /opt/R/cmake-3.2.0/bin/cmake
然后就能正常编译R包了:
> install.packages("nloptr")
trying URL 'https://mirrors.tuna.tsinghua.edu.cn/CRAN/src/contrib/nloptr_2.0.3.tar.gz'
Content type 'application/octet-stream' length 2219877 bytes (2.1 MB)
==================================================
downloaded 2.1 MB
* installing *source* package ‘nloptr’ ...
** package ‘nloptr’ successfully unpacked and MD5 sums checked
** using staged installation
checking whether the C++ compiler works... yes
checking for C++ compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether the compiler supports GNU C++... yes
checking whether g++ -std=gnu++11 accepts -g... yes
checking for g++ -std=gnu++11 option to enable C++11 features... none needed
checking how to run the C++ preprocessor... g++ -std=gnu++11 -E
checking whether the compiler supports GNU C++... (cached) yes
checking whether g++ -std=gnu++11 accepts -g... (cached) yes
checking for g++ -std=gnu++11 option to enable C++11 features... (cached) none needed
checking for pkg-config... /usr/bin/pkg-config
checking if pkg-config knows NLopt... yes
checking for pkg-config checking NLopt version... insufficient: NLopt 2.7.0 or later is preferred.
checking for cmake... /usr/bin/cmake
using NLopt via local cmake build on x86_64
set CMAKE_BIN=/usr/bin/cmake
set CC=gcc -std=gnu99
set CFLAGS=-I/usr/local/include -fpic -g -O2
set CXX=g++
set CXXFLAGS=-std=gnu++11 -I/usr/local/include -fpic -g -O2
set LDFLAGS=-L/usr/local/lib64
-- The C compiler identification is GNU 4.8.5
-- The CXX compiler identification is GNU 4.8.5
-- Check for working C compiler: /usr/bin/gcc
-- Check for working C compiler: /usr/bin/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: /usr/bin/g++
-- Check for working CXX compiler: /usr/bin/g++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- NLopt version 2.7.1
-- Looking for getopt.h
-- Looking for getopt.h - found
-- Looking for unistd.h
-- Looking for unistd.h - found
...
installing to /opt/R/R-4.0.2/lib64/R/library/00LOCK-nloptr/00new/nloptr/libs
** R
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
*** copying figures
** building package indices
** installing vignettes
** testing if installed package can be loaded from temporary location
** checking absolute paths in shared objects and dynamic libraries
** testing if installed package can be loaded from final location
** testing if installed package keeps a record of temporary installation path
* DONE (nloptr)
ref:
centos6下为Rstudio安装多版本R_yummy2009的博客-CSDN博客
CMake 3.7.2 or higher is required. You are running version 2.8.12.2_柳鲲鹏的博客-CSDN博客