gpt4 book ai didi

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

转载 作者:塔克拉玛干 更新时间:2023-11-03 01:24:26 25 4
gpt4 key购买 nike

我能够在 Redhat EL 7.X 上使用 GCC 4.8 或更高版本编译和运行最新的“stockfish chess engine”源代码。最新的源代码(连同 README)位于 https://github.com/mcostalba/Stockfish/tree/master

编译和构建的命令是:(转到“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 吗?)?

我尝试在“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]#

非常感谢!

最佳答案

Is it possible to modify the latest source to get it compliled & run on old version of gcc/glibc? if yes, would anyone be able to modify the sources (perhaps just Makefile?) for me please?

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

I can NOT upgrade GCC version without actually migrating to RHEL 7.X

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

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

您可以手动完成或使用工具链,例如安装 gentoo`s portage或自举 pkgsrc提供gcc-4.8

虽然我是一个狂热的gentoo用户,但我还是建议在国外架构上使用pkgsrc。它非常容易上手,并且拥有大量的软件包。

关于linux - 如何使用较旧的 gcc glibc 版本编译最新的源代码并运行它们?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37629709/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com