在 RHEL6 上构建 GCC 5.2
Building GCC 5.2 on RHEL6
因为我的一个项目需要 C++14 支持,所以我尝试使用 http://en.librehat.com/blog/build-gcc-5-dot-2-on-rhel-6/ 中描述的步骤在我的 RHEL6 实例上构建 GCC5.2。但是,尽管这些步骤在 RHEL5 实例上运行良好,但在构建 libgomp 的步骤中,我在 AmazonLinux 上遇到以下错误:
configure:3688: checking for C compiler default output file name
configure:3710: /home/samudra/gcc/./gcc/xgcc -B/home/samudra/gcc/./gcc/ -B/home/samudra/gcc5/x86_64-redhat-linux/bin/ -B/home/samudra/gcc5/x86_64-redhat-linux/lib/ -isystem /home/samudra/gcc5/x86_64-redhat-linux/include -isystem /home/samudra/gcc5/x86_64-redhat-linux/sys-include -g -O2 conftest.c >&5
/usr/lib/../lib64/crt1.o: In function `_start':
(.text+0x12): undefined reference to `__libc_csu_fini'
/usr/lib/../lib64/crt1.o: In function `_start':
(.text+0x19): undefined reference to `__libc_csu_init'
collect2: error: ld returned 1 exit status
configure:3714: $? = 1
configure:3751: result:
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME "GNU Offloading and Multi Processing Runtime Library"
| #define PACKAGE_TARNAME "libgomp"
| #define PACKAGE_VERSION "1.0"
| #define PACKAGE_STRING "GNU Offloading and Multi Processing Runtime Library 1.0"
| #define PACKAGE_BUGREPORT ""
| #define PACKAGE_URL "http://www.gnu.org/software/libgomp/"
| #define PACKAGE "libgomp"
| #define VERSION "1.0"
| /* end confdefs.h. */
|
| int
| main ()
| {
|
| ;
| return 0;
| }
configure:3757: error: in `/home/samudra/gcc/x86_64-redhat-linux/libgomp':
configure:3761: error: C compiler cannot create executables
一些搜索 (http://gcc.1065356.n5.nabble.com/Build-gcc-4-8-2-error-gcc-4-8-1-x86-64-unknown-linux-gnu-libgomp-td977436.html) 表明编译器无法找到 libc 库。但是我无法找到修复它的方法。有没有人之前遇到过类似的问题?知道发生了什么事吗?
另一种方法是使用 RH 开发人员工具集 - 您订阅的一部分。它现在支持 RHEL 6 和 7 上的 GCC 5.2:http://developerblog.redhat.com/2015/11/17/gcc-5-developer-toolset-4-generally-available/
还有更多关于它的内容:http://developerblog.redhat.com/2015/10/16/5-things-need-know-gcc-5-developer-toolset-beta/
HTH
因为我的一个项目需要 C++14 支持,所以我尝试使用 http://en.librehat.com/blog/build-gcc-5-dot-2-on-rhel-6/ 中描述的步骤在我的 RHEL6 实例上构建 GCC5.2。但是,尽管这些步骤在 RHEL5 实例上运行良好,但在构建 libgomp 的步骤中,我在 AmazonLinux 上遇到以下错误:
configure:3688: checking for C compiler default output file name
configure:3710: /home/samudra/gcc/./gcc/xgcc -B/home/samudra/gcc/./gcc/ -B/home/samudra/gcc5/x86_64-redhat-linux/bin/ -B/home/samudra/gcc5/x86_64-redhat-linux/lib/ -isystem /home/samudra/gcc5/x86_64-redhat-linux/include -isystem /home/samudra/gcc5/x86_64-redhat-linux/sys-include -g -O2 conftest.c >&5
/usr/lib/../lib64/crt1.o: In function `_start':
(.text+0x12): undefined reference to `__libc_csu_fini'
/usr/lib/../lib64/crt1.o: In function `_start':
(.text+0x19): undefined reference to `__libc_csu_init'
collect2: error: ld returned 1 exit status
configure:3714: $? = 1
configure:3751: result:
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME "GNU Offloading and Multi Processing Runtime Library"
| #define PACKAGE_TARNAME "libgomp"
| #define PACKAGE_VERSION "1.0"
| #define PACKAGE_STRING "GNU Offloading and Multi Processing Runtime Library 1.0"
| #define PACKAGE_BUGREPORT ""
| #define PACKAGE_URL "http://www.gnu.org/software/libgomp/"
| #define PACKAGE "libgomp"
| #define VERSION "1.0"
| /* end confdefs.h. */
|
| int
| main ()
| {
|
| ;
| return 0;
| }
configure:3757: error: in `/home/samudra/gcc/x86_64-redhat-linux/libgomp':
configure:3761: error: C compiler cannot create executables
一些搜索 (http://gcc.1065356.n5.nabble.com/Build-gcc-4-8-2-error-gcc-4-8-1-x86-64-unknown-linux-gnu-libgomp-td977436.html) 表明编译器无法找到 libc 库。但是我无法找到修复它的方法。有没有人之前遇到过类似的问题?知道发生了什么事吗?
另一种方法是使用 RH 开发人员工具集 - 您订阅的一部分。它现在支持 RHEL 6 和 7 上的 GCC 5.2:http://developerblog.redhat.com/2015/11/17/gcc-5-developer-toolset-4-generally-available/
还有更多关于它的内容:http://developerblog.redhat.com/2015/10/16/5-things-need-know-gcc-5-developer-toolset-beta/
HTH