如何使用较旧的gcc glibc版本编译最新的源代码并运行它们?

时间:2016-06-03 23:51:02

标签: linux gcc glibc

我能够编译&运行最新的"鳕鱼国际象棋引擎"在Redhat EL 7.X上使用GCC 4.8或更高版本的资源。最新的源代码(以及README)可在https://github.com/mcostalba/Stockfish/tree/master

获得

编译的命令& build是:( goto" src"目录)

gmake build ARCH=x86-64
gmake install

但是我的要求是编译&在Redhat EL 6.7服务器上运行相同的,其中最新的GCC版本是4.4.7(& glibc 2.12),因为我无法在不实际迁移到RHEL 7.X的情况下升级GCC版本

是否可以修改最新的来源以使其变得更加完美?在旧版本的gcc / glibc上运行?如果是的话,是否有人能够为我修改源代码(也许只是Makefile?)?

我尝试过改变" C ++ 11"到" C ++ 0x"在" Makefile"但没有运气。当我尝试使用GCC 4.4.7编译最新的SF源时,请查看我遇到的错误:

[root@test-server src]#  ldd --version
ldd (GNU libc) 2.12
Copyright (C) 2010 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Written by Roland McGrath and Ulrich Drepper.
[root@test-server src]#  gcc --version
gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-16)
Copyright (C) 2010 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

[root@test-server src]#  cat /etc/redhat-release
Red Hat Enterprise Linux Server release 6.7 (Santiago)
[root@test-server src]#  uname -r
2.6.32-573.12.1.el6.x86_64
[root@test-server src]#  gmake build ARCH=x86-64
gmake ARCH=x86-64 COMP=gcc config-sanity
gmake[1]: Entering directory `/root/Stockfish-master/src'

Config:
debug: 'no'
optimize: 'yes'
arch: 'x86_64'
bits: '64'
prefetch: 'yes'
popcnt: 'no'
sse: 'yes'
pext: 'no'

Flags:
CXX: g++
CXXFLAGS: -Wall -Wcast-qual -fno-exceptions -fno-rtti -std=c++11  -pedantic -Wextra -Wshadow -m64 -DNDEBUG -O3 -DIS_64BIT -msse -flto
LDFLAGS:  -Wl,--no-as-needed -lpthread -Wall -Wcast-qual -fno-exceptions -fno-rtti -std=c++11  -pedantic -Wextra -Wshadow -m64 -DNDEBUG -O3 -DIS_64BIT -msse -flto

Testing config sanity. If this fails, try 'make help' ...

gmake[1]: Leaving directory `/root/Stockfish-master/src'
gmake ARCH=x86-64 COMP=gcc all
gmake[1]: Entering directory `/root/Stockfish-master/src'
g++ -Wall -Wcast-qual -fno-exceptions -fno-rtti -std=c++11  -pedantic -Wextra -Wshadow -m64 -DNDEBUG -O3 -DIS_64BIT -msse -flto   -c -o benchmark.o benchmark.cpp
cc1plus: error: unrecognized command line option "-std=c++11"
cc1plus: error: unrecognized command line option "-flto"
gmake[1]: * [benchmark.o] Error 1
gmake[1]: Leaving directory `/root/Stockfish-master/src'
gmake: * [build] Error 2
[root@test-server src]#

非常感谢提前!

2 个答案:

答案 0 :(得分:0)

  

是否可以修改最新的来源以使其变得更加完美?跑   在旧版本的gcc / glibc?如果是的话,任何人都可以修改   请给我一些来源(也许只是Makefile?)?

当然可以。但这需要时间和精力。

  

如果没有实际迁移到RHEL 7.X

,我无法升级GCC版本

您无法从RHEL安装GCC二进制文件。但如果你有一个编译器,你可以有另一个。

您有几个选项可以让您手动编译自己的GCC并将其安装到/opt/usr/local,而不会弄乱您的系统。

您可以手动执行或使用工具链,例如安装gentoo`s portage或引导pkgsrc,提供gcc-4.8

虽然我是狂热的gentoo用户,但我建议在外部架构上使用pkgsrc。它很容易上手,并拥有大量的软件包。

答案 1 :(得分:0)

二进制鳕鱼-2.1.1(Debian6版本)与CentOS 6.8 - 64一样工作:stockfish-2.1.1-deb6.el6.x86_64.tar.gz https://drive.google.com/file/d/0B7S255p3kFXNRmV1MVRlTWktRHM/view?usp=sharing

Stockfish-5.0.0可以在CentOS 6.8 - 64上构建:stockfish-5.0-el6.x86_64.tar.gz https://drive.google.com/file/d/0B7S255p3kFXNMjJjY1IxU2R6b3c/view?usp=sharing

Stockfish-7和git版本:到目前为止,CentOS 6.8 - 64没有运气。 你是如何设法用CentOS 7.2构建的?