SPEC2006软件编译安装
IOS软件解压
在win操作系统用winRAR软件对ISO文件进行直接解压,不可将ISO文件用刻盘软件进行刻盘,会丢失文件。本次解压到/home/speccpu/目录下
替换config.guesssub文件
然后将拷贝出来tools里的config.guess和config.sub替换,一共7处12个文件替换
find /home/speccpu/ -name *.guess/sub
cp 本机config.sub/guess 到对应目录下替换。
修改spec2006内文件
cd /home/speccpu/tools/ 目录下
修改 make-3.82/glob/glob.c
把 # if _GNU_GLOB_INTERFACE_VERSION == GLOB_INTERFACE_VERSION 改成 # if _GNU_GLOB_INTERFACE_VERSION >= GLOB_INTERFACE_VERSION,禁用 make 自带的 glob 实现,解决 alloca 和 stat 的问题
@@ -52,7 52,7 @@
#define GLOB_INTERFACE_VERSION 1
#if !defined _LIBC && defined __GNU_LIBRARY__ && __GNU_LIBRARY__ > 1
# include <gnu-versions.h>
-# if _GNU_GLOB_INTERFACE_VERSION == GLOB_INTERFACE_VERSION
# if _GNU_GLOB_INTERFACE_VERSION >= GLOB_INTERFACE_VERSION
# define ELIDE_CODE
# endif
#endif
修改 make-3.82/make.h
在 struct rlimit stack_limit; 前面添加 extern,解决 -fno-common 的问题
@@ -344,7 344,7 @@
#endif
#ifdef SET_STACK_SIZE
# include <sys/resource.h>
-struct rlimit stack_limit;
extern struct rlimit stack_limit;
#endif
struct floc
修改 make-3.82/dir.c
在 dir_setup_glob 函数里添加一句 gl->gl_lstat = lstat;,解决 make: ./file.c:158: enter_file: Assertion strcache_iscached (name) failed. 的问题(参考了 [PATCH v2] make: 4.2.1 -> 4.3)
@@ -1213,6 1213,7 @@
gl->gl_readdir = read_dirstream;
gl->gl_closedir = ansi_free;
gl->gl_stat = local_stat;
gl->gl_lstat = lstat;
/* We don't bother setting gl_lstat, since glob never calls it.
The slot is only there for compatibility with 4.4 BSD. */
}
修改tar-1.25/gnu/stdio.in.h 和 specsum/gnulib/stdio.in.h
找到 _GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead"); 一句,注释掉,解决 gets undefined 的问题(参考了 CentOS 下 Git 升级)
@@ -159,7 159,7 @@
so any use of gets warrants an unconditional warning. Assume it is
always declared, since it is required by C89. */
#undef gets
-_GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead");
// _GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead");
#if @GNULIB_FOPEN@
# if @REPLACE_FOPEN@
修改 buildtools
在 perl 的 configure 命令中的 -A ldflags 附近,把 -A libs=-lm -A ccflags=-fwrapv 添加到命令中,解决找不到 math 函数的问题和 numconvert.t 测试失败的问题(参考 https://serverfault.com/a/801997/323597 和 如何在 Hifive Unmatched 开发板上安装 SPEC CPU 2006):
@@ -355,7 355,7 @@
LD_LIBRARY_PATH=`pwd`
DYLD_LIBRARY_PATH=`pwd`
export LD_LIBRARY_PATH DYLD_LIBRARY_PATH
- ./Configure -dOes -Ud_flock $PERLFLAGS -Ddosuid=undef -Dprefix=$INSTALLDIR -Dd_bincompat3=undef -A ldflags=-L${INSTALLDIR}/lib -A ccflags=-I${INSTALLDIR}/include -Ui_db -Ui_gdbm -Ui_ndbm -Ui_dbm -Uuse5005threads ; testordie "error configuring perl"
./Configure -dOes -Ud_flock $PERLFLAGS -Ddosuid=undef -Dprefix=$INSTALLDIR -Dd_bincompat3=undef -A libs=-lm -A ccflags=-fwrapv -A ldflags="-L${INSTALLDIR}/lib" -A ccflags="-I${INSTALLDIR}/include -g" -Ui_db -Ui_gdbm -Ui_ndbm -Ui_dbm -Uuse5005threads ; testordie "error configuring perl"
$MYMAKE; testordie "error building Perl"
./perl installperl; testordie "error installing Perl"
Setspecperllib
修改 perl-5.12.3/Configure
把判断 GCC 版本的 1* 都改成 1.*,解决 miniperl Segmentation fault 的问题(参考 unmatched(riscv64) 上编译,安装和移植 SPEC CPU 2006)
@@ -4536,7 4536,7 @@
fi
$rm -f try try.*
case "$gccversion" in
-1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
1.*) cpp=`./loc gcc-cpp $cpp $pth` ;;
esac
case "$gccversion" in
'') gccosandvers='' ;;
@@ -5128,7 5140,7 @@
case "$hint" in
default|recommended)
case "$gccversion" in
- 1*) dflt="$dflt -fpcc-struct-return" ;;
1.*) dflt="$dflt -fpcc-struct-return" ;;
esac
case "$optimize:$DEBUGGING" in
*-g*:old) dflt="$dflt -DDEBUGGING";;
@@ -5143,7 5155,7 @@
;;
esac
case "$gccversion" in
- 1*) ;;
1.*) ;;
2.[0-8]*) ;;
?*) set strict-aliasing -fno-strict-aliasing
eval $checkccflag
@@ -5245,7 5257,7 @@
*) cppflags="$cppflags $ccflags" ;;
esac
case "$gccversion" in
-1*) cppflags="$cppflags -D__GNUC__"
1.*) cppflags="$cppflags -D__GNUC__"
esac
case "$mips_type" in
'');;
修改 perl-5.12.3/Configure
在 if $ok; then 后面加上如下代码,解决 magic.t 测试失败的问题(参考 如何在 Hifive Unmatched 开发板上安装 SPEC CPU 2006 和 Tests fail with GCC 5.0 because Errno cannot obtain errno constants):
elif echo 'Maybe "'"$cc"' -E -ftrack-macro-expansion=0" will work...';
$cc -E -ftrack-macro-expansion=0 <testcpp.c >testcpp.out 2>&1;
$contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
echo "Yup, it does."
x_cpp="$cc $cppflags -E -ftrack-macro-expansion=0"
x_minus='';
elif echo 'Maybe "'"$cc"' -E -ftrack-macro-expansion=0 -" will work...';
$cc -E -ftrack-macro-expansion=0 - <testcpp.c >testcpp.out 2>&1;
$contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
echo "Yup, it does."
x_cpp="$cc $cppflags -E -ftrack-macro-expansion=0"
x_minus='-';
@@ -4688,6 4688,18 @@
if $ok; then
: nothing
elif echo 'Maybe "'"$cc"' -E -ftrack-macro-expansion=0" will work...';
$cc -E -ftrack-macro-expansion=0 <testcpp.c >testcpp.out 2>&1;
$contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
echo "Yup, it does."
x_cpp="$cc $cppflags -E -ftrack-macro-expansion=0"
x_minus='';
elif echo 'Maybe "'"$cc"' -E -ftrack-macro-expansion=0 -" will work...';
$cc -E -ftrack-macro-expansion=0 - <testcpp.c >testcpp.out 2>&1;
$contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
echo "Yup, it does."
x_cpp="$cc $cppflags -E -ftrack-macro-expansion=0"
x_minus='-';
elif echo 'Maybe "'"$cc"' -E" will work...';
$cc -E <testcpp.c >testcpp.out 2>&1;
$contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
修改 TimeDate-1.20/t/getdate.t
修改 TimeDate-1.20/t/getdate.t 的 my $offset = Time::Local::timegm(0,0,0,1,0,70); 为 my $offset = Time::Local::timegm(0,0,0,1,0,1970);,解决 error running TimeDate-1.20 test suite 报错(参考 unmatched(riscv64) 上编译,安装和移植 SPEC CPU 2006):
@@ -156,7 156,7 @@
!;
require Time::Local;
-my $offset = Time::Local::timegm(0,0,0,1,0,70);
my $offset = Time::Local::timegm(0,0,0,1,0,1970);
@data = split(/n/, $data);
开始编译
这样就可以正常完成 ./buildtools 了,中间 perl 测试出错,按 y 忽略即可。
编译报错及解决
编译过程中出现“you should not run configure as root (set FORCE_UNSAFE_CONFIGURE=1 in environment)错误
输入:echo "export set FORCE_UNSAFE_CONFIGURE=1" >> /etc/profile
source /etc/profile
安装spec2006
source shrc
packagetools linux-sw64
export SPEC_INSTALL_NOCHECK=1
./install.sh -d /home/spec2006-install
注意编译目录和安装目录目标目录不可以是同一目录
系统环境设置
建立软连接
ln -s /usr/lib/libcrypt.so /usr/lib/libcrypt.so.1.1
安装依赖:
yum install llvm-devel llvm libgfortran libgfortran-static libstdc -static
运行程序
运行gcc及对应配置文件
本次运行采用10.3.0 sw1.0.1(ID:652e27fed3)版本运行
运行命令
整机命令:
. ./shrc
runspec -c 配置文件名称.cfg -a scrub all
runspec -c 配置文件名称.cfg -n 1 -r 64 –noreportable all
单核命令:
. ./shrc
runspec -c 配置文件名称.cfg -a scrub all
runspec -c 配置文件名称.cfg -n 1 -r 1 –noreportable a
其他
跑一遍出结果方式:
在配置文件加命令:mean_anyway = 1