0

I am trying to install hpctoolkit using spack. In order to do that, I executed :

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

I can't execute the last command because I get the following error:

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'

It recommended me to take a look at build log by displaying the following message:

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

and the previous file contains:

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@10.2.0' does not support compiling C++ programs.

While reading a little bit the Spack notation, I learned that ’@’ specifies the package version so I guess that the version of gcc I'm using does not support compiling C++ programs.

How should I do to make it support compiling C++ programs ? Any help, please ?

Matteo Ragni
  • 2,837
  • 1
  • 20
  • 34
hakimo2
  • 143
  • 12
  • GCC have supported the C++11 standard (at least partially) since the 4 release series. Version 10 have full support for the C++11 and newer standard. If the correct GCC is used then it should work. Do you have multiple instances of GCC installed in your system? Perhaps the one first in the path is an older installation? – Some programmer dude Jun 09 '21 at 08:04
  • Have you installed `g++`? If you are on an ubuntu based, install `build-essential` – Matteo Ragni Jun 09 '21 at 08:08
  • What does `g++ --version` say? What platform are you on? – molbdnilo Jun 09 '21 at 08:10
  • @MatteoRagni I have already installed it. I have a `g++ 9.3.0 version`. – hakimo2 Jun 09 '21 at 08:11
  • @molbdnilo I have a `g++ 9.3.0 version`. – hakimo2 Jun 09 '21 at 08:12
  • @Someprogrammerdude by executing the command `dpkg --list | grep compiler`, I find `gcc`, `gcc-9`, `gcc-10`. How can I check if the one first in the path is an older installation,pls ? – hakimo2 Jun 09 '21 at 08:14
  • 3
    As I said, GCC have supported C++11 since long before release 9, so both your installations should work. The problem is something else. – Some programmer dude Jun 09 '21 at 08:14
  • @Someprogrammerdude and why he's telling me that the compiler `gcc 10.2.0` does not support compiling C++ programs ? – hakimo2 Jun 09 '21 at 08:17
  • 1
    I wasn't asking what version you (think you) have installed, I was wondering exactly what the output of `g++ --version` is. – molbdnilo Jun 09 '21 at 08:17
  • @molbdnilo output : g++ (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0 Copyright (C) 2019 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. – hakimo2 Jun 09 '21 at 08:18
  • Look in `check_cxx11.cpp` for the C++11 check and see if it needs to be fixed. – Richard Critten Jun 09 '21 at 08:20
  • Read the error message. It says it didn't support C++11, not C++ in general. Be accyrate. – user207421 Jun 09 '21 at 08:24
  • You need to check the build-log `/tmp/hakim/spack-stage/spack-stage-boost-1.76.0-oc2u6jxritfsbci4xkhr5lov3i4o4riq/spack-build-out.txt` to figure out what the problem is. – Some programmer dude Jun 09 '21 at 08:30
  • @RichardCritten I looked for the `check_cxx11.cpp` file and didn't find it. Is it normal ? – hakimo2 Jun 09 '21 at 08:45
  • Locate the root of spack's boost package (called "path_to_boost" in this comment), then try `g++ -std=c++11 path_to_boost/build/src/engine/check_cxx11.cpp` and see what the actual error is. (The error message from the setup seems to be quite misleading.) – molbdnilo Jun 09 '21 at 08:45
  • It might be a temporary file that only exists for the purpose of the check. As @Someprogrammerdude said you need to check the log(s). – Richard Critten Jun 09 '21 at 08:48
  • @RichardCritten In my question, I posted the error that I found in the `spack-build-out.txt`. `I also found You can specify the toolset as the argument, i.e.: ./build.sh [options] gcc` but I don't know how to use it to finish the installation. – hakimo2 Jun 09 '21 at 09:28
  • @molbdnilo there is absolutely no `check_cxx11.cpp` in the `boost` folder. – hakimo2 Jun 09 '21 at 10:14
  • In chapter 8 at [this page](http://hpctoolkit.org/software-instructions.html) says: "First, set up your config.yaml, packages.yaml and compilers.yaml files as above and edit them for your system.". There is a ch.7 completely dedicated at gcc setup. Have you done it? – Matteo Ragni Jun 09 '21 at 10:59
  • @MatteoRagni Thanks a lot ! you gave me the right path to fix the error. Spack was considering 2 versions of gcc. So I retired the recent version (`gcc@10.2.0`) from the `compilers.yaml` and let only the version `gcc@9.3.0`. Now it works ! – hakimo2 Jun 09 '21 at 12:21
  • 1
    You are welcome. Take some time to write down an answer with the exact procedure please. Also, consider update the title to better reflect the issue. – Matteo Ragni Jun 09 '21 at 12:25
  • @MatteoRagni It's okay for the answer ! I don't know if it is okay for the question too. I did my best. – hakimo2 Jun 09 '21 at 12:39

1 Answers1

1

As you can see in the error, compiler 'gcc@10.2.0' does not support compiling C++ programs.

In order to display the compilers, use the command:

spack compiler list 

Before retiring the misleading version, I had the following result for the previous command:

-- clang ubuntu20.04-x86_64 -------------------------------------
clang@10.0.0  clang@7.0.1

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

In order to get rid of the version 'gcc@10.2.0', I modified compilers.yaml which is a separate file to store information about available compilers. This file is normally in your home directory at ~/.spack/platform where ‘platform’ is normally ‘linux’ (or else ‘cray’ or ‘bgq’).

In my case, I did:

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

and found (I'm displaying only the part related to the gcc compiler):

    compilers:
    - compiler:
            spec: gcc@10.2.0
            paths:
              cc: /usr/bin/gcc-10
              cxx: null
              f77: /usr/bin/gfortran-10
              fc: /usr/bin/gfortran-10
            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: []

In order to get rid of gcc@10.2.0, just delete its part. Verify now the list of compilers and you should find:

-- clang ubuntu20.04-x86_64 -------------------------------------
clang@10.0.0  clang@7.0.1

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

Last step:

spack install hpctoolkit 

Now, Everything is OK.

hakimo2
  • 143
  • 12