![配置:错误:C++ 编译器无法创建可执行文件](https://linux22.com/image/1147024/%E9%85%8D%E7%BD%AE%EF%BC%9A%E9%94%99%E8%AF%AF%EF%BC%9AC%2B%2B%20%E7%BC%96%E8%AF%91%E5%99%A8%E6%97%A0%E6%B3%95%E5%88%9B%E5%BB%BA%E5%8F%AF%E6%89%A7%E8%A1%8C%E6%96%87%E4%BB%B6.png)
我正在尝试安装 Robocup 模拟器这里。正如文件夹中的 README 文件中所述,我必须执行它才能构建它,/.configure
但我收到此错误。它是config.log
文件
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by agent2d configure 3.1.1, which was
generated by GNU Autoconf 2.68. Invocation command line was
$ ./configure
## --------- ##
## Platform. ##
## --------- ##
hostname = saurabh-GL502VM
uname -m = x86_64
uname -r = 4.4.0-72-generic
uname -s = Linux
uname -v = #93-Ubuntu SMP Fri Mar 31 14:07:41 UTC 2017
/usr/bin/uname -p = unknown
/bin/uname -X = unknown
/bin/arch = unknown
/usr/bin/arch -k = unknown
/usr/convex/getsysinfo = unknown
/usr/bin/hostinfo = unknown
/bin/machine = unknown
/usr/bin/oslevel = unknown
/bin/universe = unknown
PATH: /home/saurabh/code/env/bin
PATH: /usr/local/cuda-8.0/bin
PATH: /usr/local/cuda-8.0/bin
PATH: /usr/local/sbin
PATH: /usr/local/bin
PATH: /usr/sbin
PATH: /usr/bin
PATH: /sbin
PATH: /bin
PATH: /usr/games
PATH: /usr/local/games
PATH: /snap/bin
## ----------- ##
## Core tests. ##
## ----------- ##
configure:2293: checking for a BSD-compatible install
configure:2361: result: /usr/bin/install -c
configure:2372: checking whether build environment is sane
configure:2422: result: yes
configure:2563: checking for a thread-safe mkdir -p
configure:2602: result: /bin/mkdir -p
configure:2615: checking for gawk
configure:2645: result: no
configure:2615: checking for mawk
configure:2631: found /usr/bin/mawk
configure:2642: result: mawk
configure:2653: checking whether make sets $(MAKE)
configure:2675: result: yes
configure:2823: checking for g++
configure:2853: result: no
configure:2823: checking for c++
configure:2853: result: no
configure:2823: checking for gpp
configure:2853: result: no
configure:2823: checking for aCC
configure:2853: result: no
configure:2823: checking for CC
configure:2853: result: no
configure:2823: checking for cxx
configure:2853: result: no
configure:2823: checking for cc++
configure:2853: result: no
configure:2823: checking for cl.exe
configure:2853: result: no
configure:2823: checking for FCC
configure:2853: result: no
configure:2823: checking for KCC
configure:2853: result: no
configure:2823: checking for RCC
configure:2853: result: no
configure:2823: checking for xlC_r
configure:2853: result: no
configure:2823: checking for xlC
configure:2853: result: no
configure:2877: checking for C++ compiler version
configure:2886: g++ --version >&5
./configure: line 2888: g++: command not found
configure:2897: $? = 127
configure:2886: g++ -v >&5
./configure: line 2888: g++: command not found
configure:2897: $? = 127
configure:2886: g++ -V >&5
./configure: line 2888: g++: command not found
configure:2897: $? = 127
configure:2886: g++ -qversion >&5
./configure: line 2888: g++: command not found
configure:2897: $? = 127
configure:2917: checking whether the C++ compiler works
configure:2939: g++ conftest.cpp >&5
./configure: line 2941: g++: command not found
configure:2943: $? = 127
configure:2981: result: no
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME "agent2d"
| #define PACKAGE_TARNAME "agent2d"
| #define PACKAGE_VERSION "3.1.1"
| #define PACKAGE_STRING "agent2d 3.1.1"
| #define PACKAGE_BUGREPORT "[email protected]"
| #define PACKAGE_URL ""
| #define PACKAGE "agent2d"
| #define VERSION "3.1.1"
| /* end confdefs.h. */
|
| int
| main ()
| {
|
| ;
| return 0;
| }
configure:2986: error: in `/home/saurabh/intelligent_systems/project/agent2d-3.1.1':
configure:2988: error: C++ compiler cannot create executables
See `config.log' for more details
## ---------------- ##
## Cache variables. ##
## ---------------- ##
ac_cv_env_CCC_set=
ac_cv_env_CCC_value=
ac_cv_env_CC_set=
ac_cv_env_CC_value=
ac_cv_env_CFLAGS_set=
ac_cv_env_CFLAGS_value=
ac_cv_env_CPPFLAGS_set=
ac_cv_env_CPPFLAGS_value=
ac_cv_env_CXXCPP_set=
ac_cv_env_CXXCPP_value=
ac_cv_env_CXXFLAGS_set=
ac_cv_env_CXXFLAGS_value=
ac_cv_env_CXX_set=
ac_cv_env_CXX_value=
ac_cv_env_LDFLAGS_set=
ac_cv_env_LDFLAGS_value=
ac_cv_env_LIBS_set=
ac_cv_env_LIBS_value=
ac_cv_env_build_alias_set=
ac_cv_env_build_alias_value=
ac_cv_env_host_alias_set=
ac_cv_env_host_alias_value=
ac_cv_env_target_alias_set=
ac_cv_env_target_alias_value=
ac_cv_path_install='/usr/bin/install -c'
ac_cv_path_mkdir=/bin/mkdir
ac_cv_prog_AWK=mawk
ac_cv_prog_make_make_set=yes
## ----------------- ##
## Output variables. ##
## ----------------- ##
ACLOCAL='${SHELL} /home/saurabh/intelligent_systems/project/agent2d-3.1.1/config/missing --run aclocal-1.11'
AMDEPBACKSLASH=''
AMDEP_FALSE=''
AMDEP_TRUE=''
AMTAR='${SHELL} /home/saurabh/intelligent_systems/project/agent2d-3.1.1/config/missing --run tar'
AUTOCONF='${SHELL} /home/saurabh/intelligent_systems/project/agent2d-3.1.1/config/missing --run autoconf'
AUTOHEADER='${SHELL} /home/saurabh/intelligent_systems/project/agent2d-3.1.1/config/missing --run autoheader'
AUTOMAKE='${SHELL} /home/saurabh/intelligent_systems/project/agent2d-3.1.1/config/missing --run automake-1.11'
AWK='mawk'
BOOST_CPPFLAGS=''
BOOST_LDFLAGS=''
CC=''
CCDEPMODE=''
CFLAGS=''
CPPFLAGS=''
CXX='g++'
CXXCPP=''
CXXDEPMODE=''
CXXFLAGS=''
CYGPATH_W='echo'
DEFS=''
DEPDIR=''
ECHO_C=''
ECHO_N='-n'
ECHO_T=''
EGREP=''
EXEEXT=''
GREP=''
INSTALL_DATA='${INSTALL} -m 644'
INSTALL_PROGRAM='${INSTALL}'
INSTALL_SCRIPT='${INSTALL}'
INSTALL_STRIP_PROGRAM='$(install_sh) -c -s'
LDFLAGS=''
LIBOBJS=''
LIBRCSCLIB=''
LIBS=''
LN_S=''
LTLIBOBJS=''
MAKEINFO='${SHELL} /home/saurabh/intelligent_systems/project/agent2d-3.1.1/config/missing --run makeinfo'
MKDIR_P='/bin/mkdir -p'
OBJEXT=''
PACKAGE='agent2d'
PACKAGE_BUGREPORT='[email protected]'
PACKAGE_NAME='agent2d'
PACKAGE_STRING='agent2d 3.1.1'
PACKAGE_TARNAME='agent2d'
PACKAGE_URL=''
PACKAGE_VERSION='3.1.1'
PATH_SEPARATOR=':'
RANLIB=''
SET_MAKE=''
SHELL='/bin/bash'
STRIP=''
VERSION='3.1.1'
ac_ct_CC=''
ac_ct_CXX=''
am__EXEEXT_FALSE=''
am__EXEEXT_TRUE=''
am__fastdepCC_FALSE=''
am__fastdepCC_TRUE=''
am__fastdepCXX_FALSE=''
am__fastdepCXX_TRUE=''
am__include=''
am__isrc=''
am__leading_dot='.'
am__quote=''
am__tar='${AMTAR} chof - "$$tardir"'
am__untar='${AMTAR} xf -'
bindir='${exec_prefix}/bin'
build_alias=''
datadir='${datarootdir}'
datarootdir='${prefix}/share'
docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
dvidir='${docdir}'
exec_prefix='NONE'
host_alias=''
htmldir='${docdir}'
includedir='${prefix}/include'
infodir='${datarootdir}/info'
install_sh='${SHELL} /home/saurabh/intelligent_systems/project/agent2d-3.1.1/config/install-sh'
libdir='${exec_prefix}/lib'
libexecdir='${exec_prefix}/libexec'
localedir='${datarootdir}/locale'
localstatedir='${prefix}/var'
mandir='${datarootdir}/man'
mkdir_p='/bin/mkdir -p'
oldincludedir='/usr/include'
pdfdir='${docdir}'
prefix='NONE'
program_transform_name='s,x,x,'
psdir='${docdir}'
sbindir='${exec_prefix}/sbin'
sharedstatedir='${prefix}/com'
sysconfdir='${prefix}/etc'
target_alias=''
## ----------- ##
## confdefs.h. ##
## ----------- ##
/* confdefs.h */
#define PACKAGE_NAME "agent2d"
#define PACKAGE_TARNAME "agent2d"
#define PACKAGE_VERSION "3.1.1"
#define PACKAGE_STRING "agent2d 3.1.1"
#define PACKAGE_BUGREPORT "[email protected]"
#define PACKAGE_URL ""
#define PACKAGE "agent2d"
#define VERSION "3.1.1"
configure: exit 77
我该怎么办?g++ 已经安装,我的路径变量如下所示
/usr/bin:/home/saurabh/code/env/bin:/usr/bin/x86_64-linux-gnu-g++:/usr/bin/g++:/usr/bin:/usr/local/cuda-8.0/bin:/usr/local/cuda-8.0/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
输出apt-缓存策略 g++
g++:
Installed: 4:5.3.1-1ubuntu1
Candidate: 4:5.3.1-1ubuntu1
Version table:
*** 4:5.3.1-1ubuntu1 500
500 http://us.archive.ubuntu.com/ubuntu xenial/main amd64 Packages
100 /var/lib/dpkg/status
输出namei -lx /usr/bin/g++*:
f: /usr/bin/g++
Drwxr-xr-x root root /
drwxr-xr-x root root usr
drwxr-xr-x root root bin
lrwxrwxrwx root root g++ -> /etc/alternatives/g++
Drwxr-xr-x root root /
drwxr-xr-x root root etc
drwxr-xr-x root root alternatives
lrwxrwxrwx root root g++ -> /usr/bin/g++-4.8
Drwxr-xr-x root root /
drwxr-xr-x root root usr
drwxr-xr-x root root bin
g++-4.8 - No such file or directory
f: /usr/bin/g++-5
Drwxr-xr-x root root /
drwxr-xr-x root root usr
drwxr-xr-x root root bin
-rwxr-xr-x root root g++-5
答案1
如果要保留 g++-5 作为默认值,因为您已经配置了替代方案,请添加g++-5
替代方案:
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-5 80 --slave /usr/bin/g++ g++ /usr/bin/g++-5
这应该切换gcc
回g++
GCC5。