Hi all —
We've currently got a somewhat strange relationship between using C or LLVM as the back-end compiler, the CHPL_TARGET_COMPILER setting and the --llvm
flag. Over in this issue, there's a proposal to try to unify things a bit better. Head over, take a look, and comment if this is something you feel invested in or would like to learn more about:
opened 10:27PM - 20 May 21 UTC
area: Makefiles
type: Design
Traditionally, `CHPL_TARGET_COMPILER` has been used to indicate which C compiler… should be used to compile the C code generated by the `chpl` compiler as well as the runtime and third-party libraries that we link that code against. However, when using the LLVM back-end (by building with `CHPL_LLVM!=none` and compiling with `--llvm`, we tend to essentially ignore `CHPL_TARGET_COMPILER`, using `clang-included` when `CHPL_LLVM == bundled` and `clang` when `CHPL_LLVM=system`. This can potentially lead to confusion due to having too many options that specify how code is generated and compiled depending on the relative settings of `CHPL_TARGET_COMPILER`, `CHPL_LLVM` and the `--[no-]llvm` flag arguably leading to sources of confusion as have been noted in [this Discourse thread](https://chapel.discourse.group/t/build-process-for-variants-of-llvm-dependency/4554) or issues https://github.com/chapel-lang/chapel/issues/17606, https://github.com/chapel-lang/chapel/issues/17598, and https://github.com/chapel-lang/chapel/issues/17584
In this issue, I'm proposing that we unify these settings as follows:
* `CHPL_TARGET_COMPILER`:
* setting this to `gnu`, `intel`, `clang`, etc. would indicate that the C back-end should be used with the specified compiler
* setting it to `llvm` would indicate that the LLVM back-end should be used
* when C code needs to be compiled (e.g., the runtime, third-party libraries, or any `.c` files specified on the `chpl` command line or the code's `require` statements), `clang` will be used. Similar to today, the bundled version of clang will be used when `CHPL_LLVM=bundled` and the version in the user's path when `CHPL_LLVM=system`
This would effectively eliminate the need for the `--[no-]llvm` flag since the `--target-compiler` flag would essentially give the same control while reducing confusion about the meaning of `CHPL_TARGET_COMPILER` in an LLVM-based compilation, as well as the need for `clang` vs. `clang-included` as user-facing settings.
* `CHPL_LLVM`: this would now say where to get LLVM from in the event that it's needed
* `system`: use the system-installed version
* `bundled`: use the bundled version
* `none`: this would effectively result in an error if `CHPL_TARGET_COMPILER` were set to `llvm`
* `unset`: the need for this option might be reduced in this world
This would also have the effect of making the `CHPL_LLVM` flag slightly more like the current `CHPL_RE2` and `CHPL_GMP` variables in the sense of "Someone has requested LLVM (via their `CHPL_TARGET_COMPILER` or `--target-compiler` setting), so where should I get it from?"
-Brad