Skip to content

Spack spec fails with "complex" flags string even if quoted #31214

@adrienbernede

Description

@adrienbernede

Steps to reproduce

spack/bin/spack spec umpire%clang@9.0.0 cxxflags="-stdlib=libc++ -DGTEST_HAS_CXXABI_H_=0"

@cosmicexplorer @trws
I seem to have an issue with this

Error message

uberenv_libs git:(bernede1/ci/spack-user-cache-path) spack/bin/spack --debug --stacktrace spec umpire%clang@9.0.0 cxxflags="-stdlib=libc++ -DGTEST_HAS_CXXABI_H_=0"
/g/g91/bernede1/Projects/umpire/uberenv_libs/spack/lib/spack/spack/cmd/__init__.py:126 ==> [2022-06-21-07:01:56.277447] Imported spec from built-in commands
/g/g91/bernede1/Projects/umpire/uberenv_libs/spack/lib/spack/spack/cmd/__init__.py:126 ==> [2022-06-21-07:01:56.279183] Imported spec from built-in commands
/g/g91/bernede1/Projects/umpire/uberenv_libs/spack/lib/spack/spack/main.py:896 ==> [2022-06-21-07:01:56.281030] SpackError: Unexpected token: '='  Encountered when parsing spec:
    umpire%clang@9.0.0
                         ^

Some compiler or linker flags were provided without quoting their arguments,
which now causes spack to try to parse the *next* argument as a spec component
such as a variant instead of an additional compiler or linker flag. If the
intent was to set multiple flags, try quoting them together as described below.

Possible flag quotation errors (with the correctly-quoted version after the =>):
(1) cxxflags=-stdlib=libc++ -DGTEST_HAS_CXXABI_H_=0 => cxxflags="-stdlib=libc++ -DGTEST_HAS_CXXABI_H_=0"
/g/g91/bernede1/Projects/umpire/uberenv_libs/spack/lib/spack/spack/error.py:54 ==> [2022-06-21-07:01:56.281606] Error: Unexpected token: '='  Encountered when parsing spec:
    umpire%clang@9.0.0
                         ^

Some compiler or linker flags were provided without quoting their arguments,
which now causes spack to try to parse the *next* argument as a spec component
such as a variant instead of an additional compiler or linker flag. If the
intent was to set multiple flags, try quoting them together as described below.

Possible flag quotation errors (with the correctly-quoted version after the =>):
(1) cxxflags=-stdlib=libc++ -DGTEST_HAS_CXXABI_H_=0 => cxxflags="-stdlib=libc++ -DGTEST_HAS_CXXABI_H_=0"
Traceback (most recent call last):
  File "/g/g91/bernede1/Projects/umpire/uberenv_libs/spack/lib/spack/spack/spec.py", line 5145, in do_parse
    self.unexpected_token()
  File "/g/g91/bernede1/Projects/umpire/uberenv_libs/spack/lib/spack/spack/parse.py", line 133, in unexpected_token
    self.next_token_error("Unexpected token: '%s'" % self.next.value)
  File "/g/g91/bernede1/Projects/umpire/uberenv_libs/spack/lib/spack/spack/parse.py", line 126, in next_token_error
    raise ParseError(message, self.text[0], self.token.end)
spack.parse.ParseError: Unexpected token: '='

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/g/g91/bernede1/Projects/umpire/uberenv_libs/spack/lib/spack/spack/cmd/__init__.py", line 219, in parse_specs
    specs = spack.spec.parse(sargs)
  File "/g/g91/bernede1/Projects/umpire/uberenv_libs/spack/lib/spack/spack/spec.py", line 5366, in parse
    return SpecParser().parse(string)
  File "/g/g91/bernede1/Projects/umpire/uberenv_libs/spack/lib/spack/spack/parse.py", line 157, in parse
    return self.do_parse()
  File "/g/g91/bernede1/Projects/umpire/uberenv_libs/spack/lib/spack/spack/spec.py", line 5148, in do_parse
    raise six.raise_from(SpecParseError(e), e)
  File "<string>", line 3, in raise_from
spack.spec.SpecParseError: Unexpected token: '='

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/g/g91/bernede1/Projects/umpire/uberenv_libs/spack/lib/spack/spack/main.py", line 893, in main
    return _main(argv)
  File "/g/g91/bernede1/Projects/umpire/uberenv_libs/spack/lib/spack/spack/main.py", line 848, in _main
    return finish_parse_and_run(parser, cmd_name, env_format_error)
  File "/g/g91/bernede1/Projects/umpire/uberenv_libs/spack/lib/spack/spack/main.py", line 876, in finish_parse_and_run
    return _invoke_command(command, parser, args, unknown)
  File "/g/g91/bernede1/Projects/umpire/uberenv_libs/spack/lib/spack/spack/main.py", line 533, in _invoke_command
    return_val = command(parser, args)
  File "/g/g91/bernede1/Projects/umpire/uberenv_libs/spack/lib/spack/spack/cmd/spec.py", line 82, in spec
    input_specs = spack.cmd.parse_specs(args.specs)
  File "/g/g91/bernede1/Projects/umpire/uberenv_libs/spack/lib/spack/spack/cmd/__init__.py", line 236, in parse_specs
    raise spack.error.SpackError(msg)
spack.error.SpackError: Unexpected token: '='  Encountered when parsing spec:
    umpire%clang@9.0.0
                         ^

Some compiler or linker flags were provided without quoting their arguments,
which now causes spack to try to parse the *next* argument as a spec component
such as a variant instead of an additional compiler or linker flag. If the
intent was to set multiple flags, try quoting them together as described below.

Possible flag quotation errors (with the correctly-quoted version after the =>):
(1) cxxflags=-stdlib=libc++ -DGTEST_HAS_CXXABI_H_=0 => cxxflags="-stdlib=libc++ -DGTEST_HAS_CXXABI_H_=0"

Information on your system

  • Spack: 0.19.0.dev0 (aebb601)
  • Python: 3.7.2
  • Platform: linux-rhel7-power9le
  • Concretizer: clingo

@cosmicexplorer @trws, this likely relates to #29282

General information

  • I have run spack debug report and reported the version of Spack/Python/Platform
  • I have searched the issues of this repo and believe this is not a duplicate
  • I have run the failing commands in debug mode and reported the output

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions