配置:错误:使用 Spack 安装 HPCToolkit 时无法运行 C 编译程序

问题描述

我正在尝试按照本教程安装 HPCToolkit: http://hpctoolkit.org/software-instructions.html#Prerequisites

并且,在输入“Spack install hpctoolkit”后,我收到了一些错误消息

2 errors found in build log:
     10    checking whether make supports nested variables... yes
     11    checking whether make sets $(MAKE)... (cached) yes
     12    checking for x86_64-conda-linux-gnu-gcc... /home/ncaa/spack/lib/spack/env/gcc/gcc
     13    checking whether the C compiler works... yes
     14    checking for C compiler default output file name... a.out
     15    checking for suffix of executables...
  >> 16    checking whether we are cross compiling... configure: error: in `/tmp/ncaa/spack-stage/spack-stage-libiconv-1.16-e7emipnlb4kfxggwdzwb7fgpbu5hpupy/spack-src':
  >> 17    configure: error: cannot run C compiled programs.
     18    If you meant to cross compile,use `--host'.
     19    See `config.log' for more details

See build log for details:
  /tmp/ncaa/spack-stage/spack-stage-libiconv-1.16-e7emipnlb4kfxggwdzwb7fgpbu5hpupy/spack-build-out.txt

spack-build-out.txt:

==> libiconv: Executing phase: 'autoreconf'
==> libiconv: Executing phase: 'configure'
==> [2021-03-13-20:45:16.501013] copying ./build-aux/config.guess to libcharset/build-aux/config.guess
==> [2021-03-13-20:45:16.510159] '/tmp/ncaa/spack-stage/spack-stage-libiconv-1.16-e7emipnlb4kfxggwdzwb7fgpbu5hpupy/spack-src/configure' '--prefix=/home/ncaa/spack/opt/spack/linux-centos7-x86_64/gcc-8.4.0/libiconv-1.16-e7emipnlb4kfxggwdzwb7fgpbu5hpupy' '--enable-extra-encodings'
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /usr/bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking whether make sets $(MAKE)... (cached) yes
checking for x86_64-conda-linux-gnu-gcc... /home/ncaa/spack/lib/spack/env/gcc/gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... configure: error: in `/tmp/ncaa/spack-stage/spack-stage-libiconv-1.16-e7emipnlb4kfxggwdzwb7fgpbu5hpupy/spack-src':
configure: error: cannot run C compiled programs.
If you meant to cross compile,use `--host'.
See `config.log' for more details

config.log(在 OneDrive 上):https://1drv.ms/u/s!Ah8JdDB38REth3K7XSgq6TZQ46eV?e=4z2bQI

我的平台和用户环境

(env0) [ncaa@localhost ~]$ uname -a
Linux localhost.localdomain 3.10.0-229.el7.x86_64 #1 SMP Fri Mar 6 11:36:42 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
(env0) [ncaa@localhost ~]$ cat /etc/redhat-release
CentOS Linux release 7.1.1503 (Core) 
(env0) [ncaa@localhost ~]$ gcc --version
gcc (crosstool-ng 1.24.0.133_b0863d8_dirty) 8.4.0
copyright (C) 2018 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.
(env0) [ncaa@localhost ~]$ rpm -qa | grep glibc
glibc-2.17-157.el7_3.2.i686
compat-glibc-headers-2.12-4.el7.centos.x86_64
glibc-common-2.17-157.el7_3.2.x86_64
glibc-devel-2.17-157.el7_3.2.i686
compat-glibc-2.12-4.el7.centos.x86_64
glibc-2.17-157.el7_3.2.x86_64
glibc-devel-2.17-157.el7_3.2.x86_64
glibc-headers-2.17-157.el7_3.2.x86_64

(env0) [ncaa@localhost ~]$ spack config get compilers
compilers:
- compiler:
    spec: gcc@8.4.0
    paths:
      cc: /home/ncaa/anaconda3/envs/env0/bin/gcc
      cxx: /home/ncaa/anaconda3/envs/env0/bin/g++
      f77:
      fc:
    flags: {}
    operating_system: centos7
    target: x86_64
    modules: []
    environment: {}
    extra_rpaths: []

config.yaml(在 OneDrive 上):https://1drv.ms/u/s!Ah8JdDB38REth3P-jV-PP9P-bSjS?e=6ucN9e package.yaml(在 OneDrive 上):https://1drv.ms/u/s!Ah8JdDB38REth3RTTTJGckufGQVT?e=fFs2YH

解决方法

运行“spack install xz”给出:

(env0) [ncaa@localhost ~]$ spack install xz
==> Installing xz-5.2.5-ilny777kxpjghq6abvl7hv5skt5sxo3k
==> No binary for xz-5.2.5-ilny777kxpjghq6abvl7hv5skt5sxo3k found: installing from source
==> Using cached archive: /home/ncaa/spack/var/spack/cache/_source-cache/archive/51/5117f930900b341493827d63aa910ff5e011e0b994197c3b71c08a20228a42df.tar.bz2
==> No patches needed for xz
==> xz: Executing phase: 'autoreconf'
==> xz: Executing phase: 'configure'
==> Error: ProcessError: Command exited with status 1:
    '/tmp/ncaa/spack-stage/spack-stage-xz-5.2.5-ilny777kxpjghq6abvl7hv5skt5sxo3k/spack-src/configure' '--prefix=/home/ncaa/spack/opt/spack/linux-centos7-x86_64/gcc-8.4.0/xz-5.2.5-ilny777kxpjghq6abvl7hv5skt5sxo3k'

2 errors found in build log:
     34    checking whether ln -s works... yes
     35    checking whether make supports the include directive... yes (GNU style)
     36    checking for x86_64-conda-linux-gnu-gcc... /home/ncaa/spack/lib/spack/env/gcc/gcc
     37    checking whether the C compiler works... yes
     38    checking for C compiler default output file name... a.out
     39    checking for suffix of executables...
  >> 40    checking whether we are cross compiling... configure: error: in `/tmp/ncaa/spack-stage/spack-stage-xz-5.2.5-ilny777kxpjghq6abvl7hv5skt5sxo3k/spack-src':
  >> 41    configure: error: cannot run C compiled programs.
     42    If you meant to cross compile,use `--host'.
     43    See `config.log' for more details

See build log for details:
  /tmp/ncaa/spack-stage/spack-stage-xz-5.2.5-ilny777kxpjghq6abvl7hv5skt5sxo3k/spack-build-out.txt

问题似乎与交叉编译检查有关

,

将 gcc 版本切换到 7.3.0 解决了这个问题。交叉编译检查现在得到结果“否”。