首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何使C++编译器支持STLin命令模板来安装hpctoolkit?

如何使C++编译器支持STLin命令模板来安装hpctoolkit?
EN

Ask Ubuntu用户
提问于 2021-06-10 09:44:20
回答 1查看 385关注 0票数 1

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

代码语言:javascript
复制
git clone https://github.com/spack/spack.git
cd spack/share/spack
source setup-env.sh 
spack fetch -D hpctoolkit
spack install hpctoolkit 

我无法执行最后一个命令,因为我得到了以下错误:

代码语言:javascript
复制
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'

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

代码语言:javascript
复制
See build log for details:
  /tmp/hakim/spack-stage/spack-stage-boost-1.76.0-oc2u6jxritfsbci4xkhr5lov3i4o4riq/spack-build-out.txt

而上一个文件包含:

代码语言:javascript
复制
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 'gcc@9.3.0' does not support compiling C++ programs.

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

代码语言:javascript
复制
spack compiler list 

结果是:

代码语言:javascript
复制
==> Available compilers
-- clang ubuntu20.04-x86_64 -------------------------------------
clang@10.0.0  clang@7.0.1

-- gcc ubuntu20.04-x86_64 ---------------------------------------
gcc@9.3.0  gcc@7.5.0

为了摆脱'gcc@9.3.0‘版本,我修改了compilers.yaml,它是一个单独的文件,用于存储有关可用编译器的信息。

就我而言,我做到了:

代码语言:javascript
复制
cd ~/.spack/linux
emacs compilers.yaml & 

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

代码语言:javascript
复制
compilers:
- compiler:
        spec: gcc@7.5.0
        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: gcc@9.3.0
    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: []

为了摆脱gcc@9.3.0,我刚刚删除了它的部分。我现在核实了编译器的列表,我应该可以找到:

代码语言:javascript
复制
-- clang ubuntu20.04-x86_64 -------------------------------------
clang@10.0.0  clang@7.0.1

-- gcc ubuntu20.04-x86_64 ---------------------------------------
gcc@7.5.0

现在,当我执行命令时:

代码语言:javascript
复制
spack install hpctoolkit 

错误是不同的。我得到:

代码语言:javascript
复制
=> Error: CompilerAccessError: Compiler 'gcc@7.5.0' 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).

我认为gcc@7.5.0编译器安装错误,因为他告诉我,它有丢失或不可执行的可执行文件。

我曾试过gcc@7.5.0、gcc@9.3.0和vain @10.2.0,但都没有成功。(我想提到的是,所有编译器都安装在/usr/bin中)

有什么帮助吗?

EN

回答 1

Ask Ubuntu用户

发布于 2021-06-10 11:45:51

为了修复这个错误,您应该精确地确定到g++的路径。在我的例子中,下面是我的compilers.yaml文件的更新内容:

代码语言:javascript
复制
compilers:
- compiler:
        spec: gcc@7.5.0
        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: gcc@9.3.0
    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: []

现在,它应该工作得很好。

票数 0
EN
页面原文内容由Ask Ubuntu提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://askubuntu.com/questions/1344957

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档