![](/img/trans.png)
[英]How can you do C++ when your embedded compiler doesn't have operator new or STL support?
[英]How can I make the C++ compiler support template for STL?
我正在嘗試使用Spack
安裝hpctoolkit
。 為了做到這一點,我執行了:
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 'gcc@9.3.0' does not support compiling C++ programs.
為了顯示編譯器,我使用了以下命令:
spack compiler list
結果是:
==> 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 ,這是一個單獨的文件,用於存儲有關可用編譯器的信息。
就我而言,我做了:
cd ~/.spack/linux
emacs compilers.yaml &
並找到(我只顯示與 gcc 編譯器相關的部分):
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,我只是刪除了它的一部分。 我現在驗證編譯器列表,我應該找到:
-- clang ubuntu20.04-x86_64 -------------------------------------
clang@10.0.0 clang@7.0.1
-- gcc ubuntu20.04-x86_64 ---------------------------------------
gcc@7.5.0
現在,當我執行命令時:
spack install hpctoolkit
錯誤是不同的。 我得到:
=> 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 和 gcc@10.2.0 但徒勞無功..(我想提一下所有編譯器都安裝在/usr/bin
中)
請問有什么幫助嗎?
為了修復此錯誤,您應該精確到 g++ 的路徑。 就我而言,這是我的 compilers.yaml 文件的更新內容:
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: []
現在,它應該可以完美運行。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.