簡體   English   中英

配置:錯誤:C++ 編譯器無法創建可執行文件

[英]configure: error: C++ compiler cannot create executables

我正在嘗試從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.

現在,我應該怎么做才能安裝模擬器? 謝謝!

apt-get可以找到多個版本的 g++,甚至可以並排安裝。 但顯然命令行上的“g++”必須是其中之一的快捷方式。 您可以使用sudo update-alternatives --config g++更改該快捷方式。

首先確保 g++ 在您的 PATH 變量中。 echo $PATH以查看它是否至少包含/bin:/usr/bin

然后嘗試find / -name g++ ,如果找到,請將包含文件夾添加到 PATH。

如果這沒有幫助,請嘗試重新安裝 g++ apt-get remove g++; apt-get install g++ apt-get remove g++; apt-get install g++

檢查配置命令中使用的編譯器版本。 我通過命令 g++ --version 檢查了 g++ 版本。 它顯示的是 4.9.2。 所以我將編譯器指定為 g++-4.9.2。 但是命令 g++-4.9.2 沒有別名。 唯一可用的編譯器是 g++-4.9。 所以它通過在命令行上手動輸入來檢查可用的 g++ 版本精確命令。

列出所有 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

它應該工作。

當我嘗試使用libc++使用clang構建項目時,我也遇到了同樣的錯誤。 在通過config.log文件進行一些探索后,我發現需要libc++abi-9-dev包,而我的系統中缺少該包(基於 rpm 的 deb 包的名稱可能略有不同)。 安裝上面的包后,錯誤消失了

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM