spack: Clingo fails on Cray
Steps to reproduce the issue
This is after merging PR#22460 https://github.com/spack/spack/pull/22460
I’ve left some comments in that PR that are PR specific.
Effectively, the patch requires that GCC have static libraries (which isn’t always true).
- I swapped to a GCC that does have static libs (but it’s provided by a module)
- My new GCC (9.2.0) seemed to fail the Spack C++14 flag test - I commented this out in clingo-bootstrap since I know it will succeed (clingo or clingo-bootstrap will now configure and attempt to compile most things)
- I discovered my python3.7’s static lib appears to depend on OpenSSL (I got missing symbols that belong to
libsslwhen it linked the final clingo binaries) - I got
clingo-bootstrap@spackto compile - I cleaned, editted the config and added the concretizer as clingo
spack spec zlibthrows an error about Clingo- I pushed through a build of plain
clingo@spack(adding openssl) - Regular clingo gives the same problem Build ENV is Python3.7 (via a module), GCC 9.2.0 (module), Cmake 3.19.6, build machine is a cray that doesn’t have static libs
The verbose version of that list follows (written as I tried things)
Use a GCC with static libs (hurray) - not detected as having C++14 though (boo)
I swapped to a GCC 9.2.0 build (which does have static libraries). This will pass through CMake… but oddly it’s failing in the spack package for clingo, because spack thinks self.compiler.cxx14_flag is non existent for this compiler.
C++14 check that fails for GCC 9.2.0
I’m sure Cmake/spack is actually compiling with GCC 9.2.0, because CMake’s compiler detection reports GCC 9.2.0.
I commented out the c++14 check in clingo’s package, and Cmake configures/compiles (mostly)
Onwards to glory
Cmake gets all the way to to nearly the end and is building bin/gring and it dies in a link error. (missing symbols that look like openssl)
If I edit clingo-bootstrap and add a depends_on(openssl) and tack on spec['openssl'].libs.joined() to the ldflags at line 49 (referenced above). I can get clingo installed.
I’m assuming there’s something in my python (or perhaps an undocumented clingo dependence on SSL).
Enable the clingo concretizer
spack load clingo-boostrap
[coe0201@node003 ~]$ clingo --version
clingo version 5.5.0
Address model: 64-bit
libclingo version 5.5.0
Configuration: with Python 3.7.5, without Lua
libclasp version 3.3.5 (libpotassco version 1.1.0)
Configuration: WITH_THREADS=1
Copyright (C) Benjamin Kaufmann
License: The MIT License <https://opensource.org/licenses/MIT>
I then spack config edit config adding
config:
concretizer: clingo
I found I really need to spack clean -all after this.
Next,
[coe0201@node003 ~]$ spack clean --all
==> Removing all temporary build stages
==> Removing cached downloads
==> Removing install failure marks
==> Removing cached information on repositories
==> Removing python cache files
==> Removing software in "/home/users/coe0201/.spack/bootstrap/store"
[coe0201@node003 ~]$ spack spec zlib
Input spec
--------------------------------
zlib
Concretized
--------------------------------
==> Error: module 'clingo' has no attribute 'Symbol'
try using plain old clingo
make sure spack unload clingo-bootstrap and spack uninstall clingo-bootstrap
spack edit clingo- add
depends_on(openssl)and add'-DCMAKE_EXE_LINKER_FLAGS={}'.format(spec[openssl].libs.joined()) - could add static gcc/c++ stuff (like in bootstrap) - but didn’t to keep it simple
- clingo will now build/install
spack -d --verbose install -j60 clingo@spack %gcc@9.2.0
[coe0201@node003 ~]$ spack load clingo
[coe0201@node003 ~]$ clingo --version
clingo version 5.5.0
Address model: 64-bit
libclingo version 5.5.0
Configuration: with Python 3.7.5, without Lua
libclasp version 3.3.5 (libpotassco version 1.1.0)
Configuration: WITH_THREADS=1
Copyright (C) Benjamin Kaufmann
License: The MIT License <https://opensource.org/licenses/MIT>
spack clean --all
[coe0201@node003 ~]$ spack spec zlib %gcc@9.2.0
Input spec
--------------------------------
zlib%gcc@9.2.0
Concretized
--------------------------------
==> Error: module 'clingo' has no attribute 'Symbol'
commands
Input spec
--------------------------------
zlib%gcc@9.2.0
Concretized
--------------------------------
==> [2021-03-23-01:40:25.637746, 3585632] Reading config file /home/users/coe0201/src/spack/etc/spack/defaults/config.yaml
==> [2021-03-23-01:40:25.671790, 3585632] Reading config file /home/users/coe0201/.spack/config.yaml
Traceback (most recent call last):
File "/home/users/coe0201/src/spack/bin/spack", line 76, in <module>
sys.exit(spack.main.main())
File "/home/users/coe0201/src/spack/lib/spack/spack/main.py", line 768, in main
return _invoke_command(command, parser, args, unknown)
File "/home/users/coe0201/src/spack/lib/spack/spack/main.py", line 496, in _invoke_command
return_val = command(parser, args)
File "/home/users/coe0201/src/spack/lib/spack/spack/cmd/spec.py", line 102, in spec
spec.concretize()
File "/home/users/coe0201/src/spack/lib/spack/spack/spec.py", line 2552, in concretize
self._new_concretize(tests)
File "/home/users/coe0201/src/spack/lib/spack/spack/spec.py", line 2513, in _new_concretize
import spack.solver.asp
File "/home/users/coe0201/src/spack/lib/spack/spack/solver/asp.py", line 22, in <module>
clingo_cffi = hasattr(clingo.Symbol, '_rep')
AttributeError: module 'clingo' has no attribute 'Symbol'
cat /home/users/coe0201/.spack/config.yaml
config:
concretizer: clingo
@tgamblin (you are the maintainer listed in the package)
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 18 (18 by maintainers)
@alalazo Yes - I think your summary is correct.
I haven’t tried removing gcc from the packages compiler field. (I don’t mind it being there at lower priority)
I’ll mess around with the package I have and try to pin down the spec problems … that should be in separate dialog though.
The gist of that is forcing downstream dependencies to have constraints on their dependencies. E.g.,
The dependency constraint on superlu-dist’s dependency causes all kinds of problems with the default concretizer.
It’s also worth adding the original motivator to this line of effort.
I developed package (fork of Trilinos) that declares several
depends_on. Most of the packages will depend onblasandlapack, and I want my Trilinos build’s blas/lapack to be used by the underlying libraries. E.g., superlu-dist should use the same blas/lapack as Trilinos. What I observed, was that because my package (and others)depend_on(blas|lapack)that caused the default spec for available blas/lapack to get added to the concretizer. (it wouldn’t realize that a spec for blas/lapack was provided and it should use it everywhere else as well).To that end, I was directed to try the new concretizer by Todd.
Lots to follow up on:
packages.yaml is correct
I clipped the remainder of the file (it goes on to declare externals + more package specific things.
I suppose I could try removing the compiler all together… I am generally building for a specific version of CCE. I need to bump up to 11.0.4, but I’ll cross that bridge after the spack issues.
I suspect that spack’s bootstrap process should ignore any constraints on compilers from
packages- those make sense for the user, but they don’t if you need to do something special inside spack.GCC / CCE etc… are compilers defined in compilers.yaml (gcc) or cray/compilers.yaml (cce) - (both are external via modules)
multiple installs of re2c
That makes sense. I was actually suprised that
spack spec zlib %gcc@9.2.0failed to bootstrap butspack install re2c %gcc@9.2.0did the right thing (even if it installed re2c and I’ll never use it)I thought about it afterwards - but perhaps debug flags are causing the PID problem (
-ddd)Either way, To get spack to bootstrap, I need to tell it to install re2c, which then let the bootstrap also work itself out.
I’ll need to try your new PRs and report back. May be 2-3 hours though
@alalazo I pulled develop Then branched and merged #22354 , I applied your patch.
I have
spack config edit configwith the clingo as the concretizer.My packages.yaml does not allow GCC (it only has cce as the compiler) … so, when I tried
It naturally tried to bootstrap with CCE, then failed with the error that GCC must be used.
I modified my packages.yaml to have
compilers: [ gcc@9.2.0, cce... ], and that resolved the issue of picking CCE.Again, clean + spec: (this time saying
%gcc@9.2.0- which is important, because my gcc 8.3.1 has no static libs - as per my discussion in the other merge request)Seen this before…(install re2c first)
The install triggered the clingo bootstrap in a good way… (output below)
It looks like it did some installs twice
It did work though.
Problem - it doesn’t work if you spec/install anything with non-gcc
e.g.,
Try with GCC still allowed in packages (but with lowest priority)
still will pick cce, since it’s the default If I put gcc first, then it will just use GCC, which is no fun at all.
action items
re2cfirst… Even though that very install triggered the bootstrap correctly. If I tried withoutre2cinstalled, I get cryptic errors about missingpid