GithubHelp home page GithubHelp logo

Comments (14)

adamjstewart avatar adamjstewart commented on September 7, 2024 2

I think the cause of the problem is that either Spack was broken when you first checked it out and it has been fixed since then, or you didn't have a C++ compiler when you first checked Spack out and have installed one since then. Spack isn't yet smart enough to look for missing compilers after the fact.

from spack.

weijianwen avatar weijianwen commented on September 7, 2024 1

Thank you, @adamjstewart . Readding compiler via spack compiler find after removing ~/.spack/compilers.yaml and ~/.spack/<OS>/compilers.yaml works for me!

# rm -rf ~/.spack/compilers.yaml; rm -rf ~/.spack/linux/compilers.yaml; bin/spack compiler find
==> Added 1 new compiler to /root/.spack/linux/compilers.yaml
    [email protected]

# bin/spack compiler info [email protected]
[email protected]:
        paths:
                cc = /usr/bin/gcc
                cxx = /usr/bin/g++
                f77 = /usr/bin/gfortran
                fc = /usr/bin/gfortran
        modules  = []
        operating system  = centos7

from spack.

tgamblin avatar tgamblin commented on September 7, 2024

The links point at cc because that's the compiler wrapper that inserts RPATHs:
http://scalability-llnl.github.io/spack/packaging_guide.html#the-install-environment

lib/spack/env is put first in your path during a build to control the environment, but the error messages aren't that great, and I have not tested much on ubuntu (though apparently I should -- maybe travis is a good place to do this).

Have you looked at ~/.spackconfig to see whether your compilers are set up correctly? By default Spack will use the latest gcc to build, so if that is not set properly (e.g. if it has "None" for cc or c++) things will break.

from spack.

chvillanuevap avatar chvillanuevap commented on September 7, 2024

I have the following in my .spackconfig file:

[compiler "[email protected]"]
    cc = /usr/bin/gcc
    cxx = None
    f77 = /usr/bin/gfortran
    fc = /usr/bin/gfortran

It seems Ubuntu sets the variables g++, c++, and cpp, but not cxx.

from spack.

tgamblin avatar tgamblin commented on September 7, 2024

Is there a /usr/bin/g++? If so can you send the output of gcc -dumpversion AND g++ -dumpversion?

The autodetection in Spack is done via per-compiler classes. Look at lib/spack/spack/compilers/.py, each of which extends Compiler in lib/spack/spack/compiler.py. Compiler detection is done by searching your PATH in parallel and locating all the executables with names like gcc, g++*. It then detects the version of each and groups them by version -- it looks like there was something wrong when it ran g++, OR it didn't match the others.

from spack.

chvillanuevap avatar chvillanuevap commented on September 7, 2024

Yes, there is:

ls /usr/bin/g++
lrwxrwxrwx 1 root root 7 Apr  7  2014 /usr/bin/g++ -> g++-4.8

Both gcc -dumpversion and g++ -dumpversion return 4.8. cc, gfortran, cpp, and c++ also return 4.8.

from spack.

tgamblin avatar tgamblin commented on September 7, 2024

I'll have to find an ubuntu machine to test on sometime soon. In the meantime, if you add back /usr/bin/g++ for cxx, then things should work better for you. Spack should really warn if it doesn't find some of the compilers.

from spack.

chvillanuevap avatar chvillanuevap commented on September 7, 2024

In lib/spack/spack/compilers/__init__.py, in line 181, there is a check:

        if not all(n in items for n in _required_instance_vars):
            raise InvalidCompilerConfigurationError(cspec)

Even though cxx is set to None, this check does not raise an exception because items does have cxx as a key. _required_instance_vars is a list with ['cc','cxx','f77','fc'], while items is a dictionary.

from spack.

tgamblin avatar tgamblin commented on September 7, 2024

Does that fix it for you? If so can you send a PR? I can put the change in as well but I cannot verify it right now.

from spack.

chvillanuevap avatar chvillanuevap commented on September 7, 2024

My first fix was to create a symbolic link /usr/bin/cxx -> /usr/bin/cpp in the command line. It seems Ubuntu does not have a cxx symbolic link by default.

My second fix (and the more generic one) was to modify _required_instance_vars (in lib/spack/spack/compilers/__init__.py) to include cpp rather than cxx, and to change the Compiler attribute self.cxx to self.cpp to match the variable in _required_instance_vars.

I do not know if you wish to change the cxx variable to cpp, but if you do, I can send a PR.

from spack.

adamjstewart avatar adamjstewart commented on September 7, 2024

Does this bug still occur? Specifically, the part about Spack not picking up g++ on Ubuntu. It seems like all of the other bugs mentioned in this issue stem from that fact.

from spack.

tgamblin avatar tgamblin commented on September 7, 2024

I added some compiler checks to the Travis CI output, and indeed at least on the Travis Ubuntu distro, cxx is found properly. Closing for now -- please reopen if this happens again.

from spack.

weijianwen avatar weijianwen commented on September 7, 2024

Hi. This happens agin on Cent OS 7. spack fails to identify g++ shipped with the OS, which leads to configuration failure during [email protected] installation.

bin/spack compiler info [email protected]
[email protected]:
        paths:
                cc = /usr/bin/gcc
                cxx = None
                f77 = /usr/bin/gfortran
                fc = /usr/bin/gfortran
        modules  = []
        operating system  = centos7

ls /usr/bin/g++
/usr/bin/g++

from spack.

adamjstewart avatar adamjstewart commented on September 7, 2024

@weijianwen Do you have a /usr/bin/g++? If you delete ~/.spack/compilers.yaml and/or ~/.spack/<OS>/compilers.yaml and run spack compiler find, does it pick it up the second time?

from spack.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.