chapel-lang / chapel

a Productive Parallel Programming Language
https://chapel-lang.org
Other
1.78k stars 418 forks source link

[Bug]: Error compiling Chapel-Py #25054

Closed RedHatTurtle closed 4 months ago

RedHatTurtle commented 4 months ago

Summary of Problem

Description: I get an error when compiling Chapel-Py and therefore the Chapel Language Server and ChplCheck

Building wheels for collected packages: chapel
  Building wheel for chapel (setup.py): started
  Building wheel for chapel (setup.py): finished with status 'error'
  error: subprocess-exited-with-error

  × python setup.py bdist_wheel did not run successfully.
  │ exit code: 1
  ╰─> [2061 lines of output]
      ...
      ...
      ...
      At global scope:
      cc1plus: note: unrecognized command-line option ‘-Wno-c99-designator’ may have been intended to silence earlier diagnostics
      cc1plus: some warnings being treated as errors
      error: command '/usr/bin/gcc' failed with exit code 1
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for chapel
  Running setup.py clean for chapel
Failed to build chapel
ERROR: Could not build wheels for chapel, which is required to install pyproject.toml-based projects
make[3]: *** [Makefile:109: chapel-py-venv] Error 1
make[2]: *** [Makefile:96: chapel-py-venv] Error 2
make[1]: *** [Makefile:132: third-party-chapel-py-venv] Error 2
make: *** [Makefile:137: chapel-py-venv] Error 2

Steps to Reproduce

Source Code: The offending function is on ./tools/chapel-py/src/core-types-gen.cpp, lines 53 to 59.

static const char* blockStyleToString(BlockStyle blockStyle) {
  switch (blockStyle) {
    case BlockStyle::EXPLICIT: return "explicit";
    case BlockStyle::IMPLICIT: return "implicit";
    case BlockStyle::UNNECESSARY_KEYWORD_AND_BLOCK: return "unnecessary";
  }
}

I guess it just needs a default?

Compile command: It only stops compilation because this flag is enabled by default -Werror=return-type

Execution command: I'm just running make chapel-py-venv I'm confused about how I'm the only one with this error, should this flag not be enabled by default?

Workaround

Just add a default to the switch statement.

    default: return "";

It compiles both in 2.0.1 and 2.1-pre but I have no idea if it's the right fix :shrug:

Configuration Information

Happens on both 2.0.1 and the pre-release 2.1.0 (f1676da73c)

jabraham17 commented 4 months ago

Hi @redhatturtle, thanks for posting this. I suspect this has to do with your gcc version, but your patch is exactly how I would fix the issue.

Feel free to open a PR for it and ping me to review.

jabraham17 commented 4 months ago

Resolved with https://github.com/chapel-lang/chapel/pull/25056

bradcray commented 4 months ago

Thanks Jade!