【发布时间】:2013-10-04 15:07:28
【问题描述】:
我正在尝试在我的 x86_64 RHEL 机器 (CentOS 6.4) 上编译带有 Intel CilkPlus (v4.9) 模块的 GCC 编译器,用于编译面向并行多核平台的应用程序。
我正在关注GNU GCC Doc 进行安装,这与带有 CilkPlus 扩展的 GCC 非常相似。我特别关注前面提到的文档的Prerequisites 和Configuration 部分。
1) 下载
我确实按照Instructions page 中的说明使用this snapshot 下载了我需要的所有内容。下载成功,也解压了。我确实将文件夹重命名为cilkplus-gcc 并将其放在我的$HOME 目录下。
我还创建了另一个目录:$HOME/b-gcc,我打算从该目录运行configure 命令,然后运行make 命令。这将防止安装到同一目录中(此过程不希望将所有内容构建在不同的目录中)。
2) 初始配置
按照文档中的说明,为了构建安装过程需要的三个最重要的库(即:编译GCC),我搬进了$HOME/cilkplus-gcc/contrib目录:
- GMP:位于
$HOME/cilkplus-gcc/contrib/gmp-4.3.2目录中。 - MPFR:位于
$HOME/cilkplus-gcc/contrib/mpfr-2.4.2目录中。 - MPC:位于
$HOME/cilkplus-gcc/contrib/mpc-0.8.1目录中。
我按照出现的顺序构建它们,因为 MPFR 依赖于 GMP,而 MPC 依赖于 GMP 和 MPFR。我想将所有需要的文件放入$HOME/cilkplus-gcc 目录,因此我指示这些库的安装程序将所有内容放入$HOME/cilkplus-gcc/contrib/tmp 目录。所以:
sudo $HOME/cilkplus-gcc/contrib/gmp-4.3.2/configure --enable-shared --enable-static --prefix=$HOME/cilkplus-gcc/contrib/tmp
sudo $HOME/cilkplus-gcc/contrib/mpfr-2.4.2/configure --enable-shared --enable-static --prefix=$HOME/cilkplus-gcc/contrib/tmp --with-gmp=$HOME/cilkplus-gcc/contrib/tmp
sudo $HOME/cilkplus-gcc/contrib/mpc-0.8.1/configure --enable-shared --enable-static --prefix=$HOME/cilkplus-gcc/contrib/tmp --with-gmp=$HOME/cilkplus-gcc/contrib/tmp --with-mpfr=$HOME/cilkplus-gcc/contrib/tmp
作为直接结果,我的$HOME/cilkplus-gcc/contrib/tmp 目录中充满了目录lib、include、share 和bin,其中包含这三个库。
3) 安装
是时候忙于编译所有内容了。我进入$HOME/b-gcc 目录并从那里发出以下命令:
sudo $HOME/cilkplus-gcc/configure --prefix=$HOME/cilkplus-install --enable-languages="c,c++" --with-gmp=$HOME/cilkplus-gcc/contrib/tmp/ --with-mpfr=$HOME/cilkplus-gcc/contrib/tmp/ --with-mpc=$HOME/cilkplus-gcc/contrib/tmp/
配置进行得很顺利,并在我当前的文件夹 ($HOME/b-gcc) 中创建了一些东西。制作时间,我发出:sudo make。
两分钟后我得到了这个错误
g++ -c -g -DIN_GCC -fno-exceptions -fno-rtti -fasynchronous-unwind-tables -W -Wall -Wwrite-strings -Wcast-qual -fno-common -DHAVE_CONFIG_H -I。 -Ic-family -I/home/andry/cilkplus-gcc/gcc -I/home/andry/cilkplus-gcc/gcc/c-family -I/home/andry/cilkplus-gcc/gcc/../include -我/home/andry/cilkplus-gcc/gcc/../libcpp/include -I/home/andry/cilkplus-gcc/contrib/tmp//include -I/home/andry/cilkplus-gcc/contrib/tmp/ /include -I/home/andry/cilkplus-gcc/contrib/tmp//include -I/home/andry/cilkplus-gcc/gcc/../libdecnumber -I/home/andry/cilkplus-gcc/gcc/。 ./libdecnumber/bid -I../libdecnumber -I/home/andry/cilkplus-gcc/gcc/../libbacktrace /home/andry/cilkplus-gcc/gcc/c-family/cppspec.c -o c-family/cppspec.o g++ -g -DIN_GCC -fno-exceptions -fno-rtti -fasynchronous-unwind-tables -W -Wall -Wwrite-strings -Wcast-qual -Wmissing-format-attribute -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -fno-common -DHAVE_CONFIG_H -o cpp gcc.o ggc-none.o \ c-family/cppspec.o driver-i386.o libcommon-target.a \ libcommon.a ../libcpp/libcpp.a -liconv ../libbacktrace/.libs/libbacktrace.a ../libiberty/libiberty.a ../libdecnumber/libdecnumber.a /home/andry/b-gcc/./gcc/xgcc -B/home/andry/b-gcc/./gcc/ -dumpspecs > tmp-specs /home/andry/b-gcc/./gcc/xgcc:加载共享库时出错: libiconv.so.2:无法打开共享对象文件:没有这样的文件或 目录 make3: * [specs] 错误 127 make3: 离开目录
/home/andry/b-gcc/gcc' make[2]: *** [all-stage1-gcc] Error 2 make[2]: Leaving directory/home/andry/b-gcc' make1: * [stage1-bubble] 错误 2 make1: 离开目录 `/home/andry/b-gcc'
但是我检查了我的/usr/local/lib 文件夹,我可以清楚地看到libiconv.so.2 在那里!所以我了解安装过程(即 GCC 自身编译)找不到库(明确引用,因为我可以看到 -liconv 标志)。所以我删除了$HOME/b-gcc 中的所有内容并发出修改后的configure 命令:
sudo $HOME/cilkplus-gcc/configure --prefix=$HOME/cilkplus-install --enable-languages="c,c++" --with-gmp=$HOME/cilkplus-gcc/contrib/tmp/ --with-mpfr=$HOME/cilkplus-gcc/contrib/tmp/ --with-mpc=$HOME/cilkplus-gcc/contrib/tmp/ --with-stage1-ldflags=-L/usr/local/lib
当我再次发出sudo make 时,不再遇到以前的错误并且时间过去了。 5/6 分钟后,我收到此错误:
检查 x86_64-unknown-linux-gnu-ar... ar 检查 x86_64-unknown-linux-gnu-lipo... lipo 检查 x86_64-unknown-linux-gnu-nm... /home/andry/b-gcc/./gcc/nm 检查 对于 x86_64-unknown-linux-gnu-ranlib... ranlib 检查 x86_64-unknown-linux-gnu-strip... 剥离检查是否 ln -s 有效...是的,正在检查 x86_64-unknown-linux-gnu-gcc ... /home/andry/b-gcc/./gcc/xgcc -B/home/andry/b-gcc/./gcc/ -B/home/andry/cilkplus-install/x86_64-unknown-linux-gnu/bin/ -B/home/andry/cilkplus-install/x86_64-unknown-linux-gnu/lib/ -isystem /home/andry/cilkplus -install/x86_64-unknown-linux-gnu/include -isystem /home/andry/cilkplus-install/x86_64-unknown-linux-gnu/sys-include
检查目标文件的后缀...配置:错误:在/home/andry/b-gcc/x86_64-unknown-linux-gnu/libgcc': configure: error: cannot compute suffix of object files: cannot compile Seeconfig.log' 了解更多详情。 make2: * [configure-stage1-target-libgcc] 错误 1 make2: 离开目录/home/andry/b-gcc' make[1]: *** [stage1-bubble] Error 2 make[1]: Leaving directory/home/andry/b-gcc'
嗯,很奇怪的东西...所以我检查了$HOME/b-gcc/x86_64-unknown-linux-gnu/libgcc/config.log(将显示相关摘录):
-isystem /home/andry/cilkplus-install/x86_64-unknown-linux-gnu/sys-include
-c -g -O2 conftest.c >&5 /home/andry/b-gcc/./gcc/cc1:加载共享库时出错:libmpc.so.2:无法打开共享对象文件: 没有这样的文件或目录 configure:3593: $? = 1 配置:失败 程序是:| /* confdefs.h */ | #define PACKAGE_NAME "GNU C 运行时 库" | #define PACKAGE_TARNAME "libgcc" | #define PACKAGE_VERSION "1.0" | #define PACKAGE_STRING "GNU C 运行时库 1.0" | #定义 PACKAGE_BUGREPORT "" | #define PACKAGE_URL "http://www.gnu.org/software/libgcc/" | /* 结束 confdefs.h。 */ | | 整数 |主要 () | { | | ; |返回0; | } 配置:3607:错误:在/home/andry/b-gcc/x86_64-unknown-linux-gnu/libgcc': configure:3610: error: cannot compute suffix of object files: cannot compile Seeconfig.log' 了解更多详情。
说错误基本如下:
/home/andry/b-gcc/./gcc/cc1:加载共享库时出错: libmpc.so.2:无法打开共享对象文件:没有这样的文件或目录
但我不是已经告诉它(在配置期间)去搜索libmpc.so.2 到$HOME/cilkplus-gcc/contrib/tmp吗???
我怎样才能把事情做好?
我该如何度过这个难关?谢谢你
【问题讨论】:
标签: unix gcc makefile cilk-plus