【问题标题】:configure: error: C++ compiler cannot create executables配置:错误:C++ 编译器无法创建可执行文件
【发布时间】:2017-04-12 03:41:17
【问题描述】:

我正在尝试从 https://sourceforge.net/projects/sserver/?source=typ_redirect 安装 Robocup 模拟器。如要构建它的文件夹中的 README 文件中所述,我必须执行 /.configure 但我收到此错误。

saurabh@saurabh-GL502VM:~/intelligent_systems/project/rcssserver-15.3.0$ ./configure 
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... no
checking for mawk... mawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking for g++... no
checking for c++... no
checking for gpp... no
checking for aCC... no
checking for CC... no
checking for cxx... no
checking for cc++... no
checking for cl.exe... no
checking for FCC... no
checking for KCC... no
checking for RCC... no
checking for xlC_r... no
checking for xlC... no
checking whether the C++ compiler works... no
configure: error: in `/home/saurabh/intelligent_systems/project/rcssserver-15.3.0':
configure: error: C++ compiler cannot create ex

现在当我检查我的 g++ 编译器时。

saurabh@saurabh-GL502VM:~/intelligent_systems/project/rcssserver-15.3.0$ g++ -v
The program 'g++' is currently not installed. You can install it by typing:
sudo apt install g++

但是当我尝试安装 g++ 编译器时,我得到了这个:

saurabh@saurabh-GL502VM:~/intelligent_systems/project/rcssserver-15.3.0$ sudo apt install g++
Reading package lists... Done
Building dependency tree       
Reading state information... Done
g++ is already the newest version (4:5.3.1-1ubuntu1).
The following packages were automatically installed and are no longer required:
  cpp-4.8 libcloog-isl4 xserver-xorg-legacy
Use 'sudo apt autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 7 not upgraded.

现在,我应该怎么做才能安装模拟器?谢谢!

【问题讨论】:

    标签: c++ g++ robocup


    【解决方案1】:

    apt-get可以找到多个版本的g++,甚至可以并排安装。但显然命令行上的“g++”必须是其中一个的快捷方式。您可以使用sudo update-alternatives --config g++ 更改该快捷方式。

    【讨论】:

    • 嘿!是的,这将起作用,但无论如何它删除了其中一个 g++ 版本。现在,一切正常。
    【解决方案2】:

    首先确保 g++ 在您的 PATH 变量中。 echo $PATH 看看是否至少包含/bin:/usr/bin

    然后尝试find / -name g++,如果找到了,请将包含的文件夹添加到PATH。

    如果没有帮助,请尝试重新安装 g++ apt-get remove g++; apt-get install g++

    【讨论】:

    • 我重新安装了 g++,由于安装了两个版本的 g++,系统发生冲突。所以,我删除了其中一个,现在一切都很好。谢谢!
    【解决方案3】:

    检查配置命令中使用的编译器版本。我通过命令 g++ --version 检查了 g++ 版本。它显示 4.9.2。所以我将编译器指定为 g++-4.9.2。但是命令 g++-4.9.2 没有别名。唯一可用的编译器是 g++-4.9。因此它通过在命令行上手动键入来检查可用的 g++ 版本确切命令。

    【讨论】:

      【解决方案4】:

      列出所有 gcc 安装和链接

      ls -la /usr/bin | grep gcc
      

      首先尝试ls /usr/lib/gcc,如果存在,尝试ln -s /usr/lib/gcc /usr/bin/gcc PATH=$PATH:/usr/lib/gcc 并执行./configure(如果已安装它肯定会工作!)

      不同的linux发行版有一个值得注意的问题,首先删除并重新安装g++

      $: apt remove g++
      $: apt install g++
      

      搜索 gcc 并添加它,如果没有输出任何东西尝试添加它

      $: which gcc  
      

      如果找到将其添加到 PATH(如果软链接建立,则 /usr/bin/gcc 或 /usr/lib/gcc 直接),

      $: PATH=$PATH:/usr/lib/gcc
      

      如果结果什么都没有(可能需要一段时间)尝试,(这里尝试构建你自己的,也许可行。否则)

      $:find / -name gcc
      

      通常,它将是 /usr/lib/gcc,如果可用,将软链接指向 /usr/bin/gcc 的位置

      ln -s /**/*/gcc /usr/bin/gcc
      

      运行./configure

      它应该可以工作。

      【讨论】:

        【解决方案5】:

        当我尝试使用 clanglibc++ 构建项目时,我也遇到了同样的错误。经过config.log 文件的一些探索后,我发现我的系统中缺少libc++abi-9-dev 包(基于rpm,deb 包的名称可能略有不同)。安装完上面的包后错误消失了

        【讨论】:

          猜你喜欢
          • 2013-09-24
          • 2012-05-08
          • 2021-04-23
          • 2019-02-03
          • 1970-01-01
          • 2020-01-21
          • 2018-08-02
          • 2014-04-12
          • 2018-06-08
          相关资源
          最近更新 更多