![‘Make’ 命令编译错误](https://linux22.com/image/1081404/%E2%80%98Make%E2%80%99%20%E5%91%BD%E4%BB%A4%E7%BC%96%E8%AF%91%E9%94%99%E8%AF%AF.png)
我正在尝试本地安装一个用 C++ 编写的程序。我已经下载了该程序,并尝试使用“make”命令按照程序说明编译该程序。但是当我这样做时,我收到此错误:
/usr/include/stdc-predef.h:30:26: fatal error: bits/predefs.h: No such file or directory
compilation terminated.
在网上查看了一下,有些人似乎通过以下方式解决了这个问题
sudo apt-get install libc6-dev-i386
我检查了该软件包是否已安装,但未安装。当我尝试安装它时,我得到了
E: Unable to locate package libc6-dev-i386
我已经跑了
sudo apt get update
我确信这是一个新手问题,但任何帮助都会受到赞赏,我正在运行 32 位 13.10。
更新:我尝试了针对类似错误找到的其他建议。我遇到的都是不同但类似的错误。以下是我得到的结果。
Geoffrey@Geoffrey-Latitude-E6400:/usr/local/src/trinityrnaseq_r2013_08_14$ make
Using gnu compiler for Inchworm and Chrysalis
cd Inchworm && (test -e configure || autoreconf) \
&& ./configure --prefix=`pwd` && make install
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for gawk... no
checking for mawk... mawk
checking whether make sets $(MAKE)... yes
checking for g++... g++
checking for C++ compiler default output file name... a.out
checking whether the C++ compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking for style of include used by make... GNU
checking dependency style of g++... gcc3
checking for library containing cos... none required
configure: creating ./config.status
config.status: creating Makefile
config.status: creating src/Makefile
config.status: creating config.h
config.status: config.h is unchanged
config.status: executing depfiles commands
make[1]: Entering directory `/usr/local/src/trinityrnaseq_r2013_08_14/Inchworm'
Making install in src
make[2]: Entering directory `/usr/local/src/trinityrnaseq_r2013_08_14/Inchworm/src'
if g++ -DHAVE_CONFIG_H -I. -I. -I.. -pedantic -fopenmp -Wall -Wextra -Wno-long-long -Wno-deprecated -m64 -g -O2 -MT Fasta_entry.o -MD -MP -MF ".deps/Fasta_entry.Tpo" -c -o Fasta_entry.o Fasta_entry.cpp; \
then mv -f ".deps/Fasta_entry.Tpo" ".deps/Fasta_entry.Po"; else rm -f ".deps/Fasta_entry.Tpo"; exit 1; fi
In file included from Fasta_entry.hpp:4:0,
from Fasta_entry.cpp:1:
/usr/include/c++/4.8/string:38:28: fatal error: bits/c++config.h: No such file or directory
#include <bits/c++config.h>
^
compilation terminated.
make[2]: *** [Fasta_entry.o] Error 1
make[2]: Leaving directory `/usr/local/src/trinityrnaseq_r2013_08_14/Inchworm/src'
make[1]: *** [install-recursive] Error 1
make[1]: Leaving directory `/usr/local/src/trinityrnaseq_r2013_08_14/Inchworm'
make: *** [inchworm] Error 2
答案1
和Ubuntu 13.10 amd64,
问题/usr/include/stdc-predef.h:30:26: fatal error: bits/predefs.h: No such file or directory compilation terminated.
之后已经解决:
$ sudo apt-get install build-essential
$ sudo apt-get install libc6-dev-i386
$ sudo apt-get install g++-4.8-multilib
答案2
我通过更改构建目标架构解决了这个问题。G++ 4.8.0 及更高版本似乎破坏了其多库支持,如其邮件列表中所述。我有一台 64 位本机计算机,尝试在 32 位中编译会导致错误。但是,在 64 位中编译可以正常工作。稍后我将检查我的笔记本电脑,看看我安装了哪些软件包来解决这个问题。