如何制作 STLin 的 C++ 编译器支持模板以便安装 hpctoolkit?

如何制作 STLin 的 C++ 编译器支持模板以便安装 hpctoolkit?

我正在尝试hpctoolkit使用 进行安装Spack。为了做到这一点,我执行了:

git clone https://github.com/spack/spack.git
cd spack/share/spack
source setup-env.sh 
spack fetch -D hpctoolkit
spack install hpctoolkit 

我无法执行最后一条命令,因为出现以下错误:

Error: ProcessError: Command exited with status 1:
    './bootstrap.sh' '--prefix=/home/hakim/spack/opt/spack/linux-ubuntu20.04-haswell/gcc-10.2.0/boost-1.76.0-oc2u6jxritfsbci4xkhr5lov3i4o4riq' '--with-toolset=gcc' '--with-libraries=serialization,atomic,log,exception,regex,math,random,program_options,wave,iostreams,chrono,system,test,graph,locale,timer,filesystem,date_time,thread' '--without-icu'

它通过显示以下消息建议我查看构建日志:

See build log for details:
  /tmp/hakim/spack-stage/spack-stage-boost-1.76.0-oc2u6jxritfsbci4xkhr5lov3i4o4riq/spack-build-out.txt

前一个文件包含:

A C++11 capable compiler is required for building the B2 engine.
Toolset 'gcc' does not appear to support C++11.

> g++ -x c++ -std=c++11  check_cxx11.cpp
ERROR: Compiler '[email protected]' does not support compiling C++ programs.

为了显示编译器,我使用了以下命令:

spack compiler list 

结果是:

==> Available compilers
-- clang ubuntu20.04-x86_64 -------------------------------------
[email protected]  [email protected]

-- gcc ubuntu20.04-x86_64 ---------------------------------------
[email protected]  [email protected]

为了摆脱版本'[电子邮件保护]',我修改了compilers.yaml,它是一个单独的文件,用于存储有关可用编译器的信息。

就我而言,我这样做了:

cd ~/.spack/linux
emacs compilers.yaml & 

并发现(我只显示与 gcc 编译器相关的部分):

compilers:
- compiler:
        spec: [email protected]
        paths:
          cc: /usr/bin/gcc-7
          cxx: null
          f77: /usr/bin/gfortran-7
          fc: /usr/bin/gfortran-7
        flags: {}
        operating_system: ubuntu20.04
        target: x86_64
        modules: []
        environment: {}
        extra_rpaths: []

- compiler:
    spec: [email protected]
    paths:
      cc: /usr/bin/gcc-9
      cxx: null
      f77: /usr/bin/gfortran-9
      fc: /usr/bin/gfortran-9
    flags: {}
    operating_system: ubuntu20.04
    target: x86_64
    modules: []
    environment: {}
    extra_rpaths: []

为了摆脱[电子邮件保护],我只是删除了它的部分。我现在验证编译器列表,我应该找到:

-- clang ubuntu20.04-x86_64 -------------------------------------
[email protected]  [email protected]

-- gcc ubuntu20.04-x86_64 ---------------------------------------
[email protected]

现在,当我执行命令时:

spack install hpctoolkit 

错误不同。我得到:

=> Error: CompilerAccessError: Compiler '[email protected]' has executables that are missing or are not executable: ['/usr/bin/gfortran-7', '/usr/bin/gfortran-7']

/home/hakim/spack/lib/spack/spack/build_environment.py:937, in _setup_pkg_and_run:
        934        tb_string = traceback.format_exc()
        935
        936        # build up some context from the offending package so we can
  >>    937        # show that, too.
        938        package_context = get_package_context(tb)
        939
        940        logfile = None


==> Error: hpctoolkit-2021.05.15-jkofhcw73pap6ciacwcv2mtcv6uf3n2e: Package was not installed
==> Error: Installation request failed.  Refer to reported errors for failing package(s).

我觉得[电子邮件保护]编译器安装错误,因为他告诉我它缺少或不可执行可执行文件。

我尝试过[电子邮件保护][电子邮件保护][电子邮件保护]但徒劳无功..(我想提一下,所有的编译器都安装在/usr/bin

请问有什么帮助吗?

答案1

为了修复此错误,您应该精确指定 g++ 的路径。就我而言,这是我的 compilations.yaml 文件的更新内容:

compilers:
- compiler:
        spec: [email protected]
        paths:
          cc: /usr/bin/gcc-7
          cxx: null
          f77: /usr/bin/gfortran-7
          fc: /usr/bin/gfortran-7
        flags: {}
        operating_system: ubuntu20.04
        target: x86_64
        modules: []
        environment: {}
        extra_rpaths: []

- compiler:
    spec: [email protected]
    paths:
      cc: /usr/bin/gcc-9
      cxx: /usr/bin/g++-9
      f77: /usr/bin/gfortran-9
      fc: /usr/bin/gfortran-9
    flags: {}
    operating_system: ubuntu20.04
    target: x86_64
    modules: []
    environment: {}
    extra_rpaths: []

现在,它应该可以完美运行了。

相关内容