Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/meteor/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Linux 如何使用较旧的gcc glibc版本编译最新的源代码并运行它们?_Linux_Gcc_Glibc - Fatal编程技术网

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

Linux 如何使用较旧的gcc glibc版本编译最新的源代码并运行它们?,linux,gcc,glibc,Linux,Gcc,Glibc,我能够使用GCC4.8或更高版本在RedhatEL7.X上编译并运行最新的“stockfish象棋引擎”源代码。最新的源代码(以及自述文件)可在 编译和编译的命令是:(转到“src”目录) 但是,我的要求是在Redhat EL 6.7服务器上编译并运行相同的版本,其中最新的GCC版本是4.4.7(&glibc 2.12),因为如果不实际迁移到RHEL 7.X,我无法升级GCC版本 是否可以修改最新的源代码,使其在旧版本的gcc/glibc上编译和运行?如果是的话,有人能为我修改源代码(也许只是M

我能够使用GCC4.8或更高版本在RedhatEL7.X上编译并运行最新的“stockfish象棋引擎”源代码。最新的源代码(以及自述文件)可在

编译和编译的命令是:(转到“src”目录)

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

是否可以修改最新的源代码,使其在旧版本的gcc/glibc上编译和运行?如果是的话,有人能为我修改源代码(也许只是Makefile?)吗

我尝试在“Makefile”中将“C++11”更改为“C++0x”,但没有成功。请查看我尝试使用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]#
非常感谢

是否可以修改最新的源代码以使其编译并运行 在旧版本的gcc/glibc上?如果是,是否有人可以修改 来源(也许只是Makefile?)给我好吗

当然有可能。但这需要时间和努力

如果不迁移到RHEL 7.X,我就无法升级GCC版本

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

您可以使用一些选项手动编译自己的GCC,并将其安装到
/opt
/usr/local
,而不会影响系统

您可以手动完成,也可以使用工具链(如安装或引导),它提供

虽然我是gentoo的热心用户,但我建议在国外的架构上使用pkgsrc。它很容易入门,并且有大量的软件包

是否可以修改最新的源代码以使其编译并运行 在旧版本的gcc/glibc上?如果是,是否有人可以修改 来源(也许只是Makefile?)给我好吗

当然有可能。但这需要时间和努力

如果不迁移到RHEL 7.X,我就无法升级GCC版本

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

您可以使用一些选项手动编译自己的GCC,并将其安装到
/opt
/usr/local
,而不会影响系统

您可以手动完成,也可以使用工具链(如安装或引导),它提供

虽然我是gentoo的热心用户,但我建议在国外的架构上使用pkgsrc。它很容易入门,并且有大量的软件包

[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]#