[Chapel Merge] Add check to see if libclang-cpp-dev package is in

Branch: refs/heads/main
Revision: bf10828
Author: stonea
Link: Unavailable
Log Message:

Merge pull request #19851 from stonea/llvm_check_for_lclang_cpp

Add check to see if libclang-cpp-dev package is installed and ensure missing package errors get to user

I'm trying to install llvm 13 on my desktop to use it as the "system" LLVM when CHPL_LLVM=system. Anyway, I must have forgotten to install a package because when I build Chapel I get this error:
/usr/bin/ld: cannot find -lclang-cpp

I figured out the missing package was: libclang-cpp-dev (after apt-getting it things work fine).
It's a better user experience if we can get printchplenv to guide the user towards installing the necessary packages. I see in chplenv/chpl_llvm.py (in the check_llvm_config function) we have some checking that looks for things like missing include files (due to missing packages) and produces some nice error messages. Unfortunately, these error messages never reach the user, rather you'll get this more confusing error:

Exception: CHPL_LLVM=system but could not find an installed LLVM with one of the supported versions: 14, 13, 12, 11

You can reproduce this by running sudo apt remove libclang-dev and running printchplenv. I think this is due to a bug where we produce the error message (and add it to some error log) but never actually report it to the user.

In this PR I fix this so we separate out the check for the presence of llvm_config from the other checks about include files (and now libs) and ensure that we run these checks when we're using the system LLVM.
I also add in the check for missing -lclang_cpp, you'll now get this message if it can't find it:

Perhaps you need to install the libclang-cpp-dev package

[Reviewed by @daviditen]

Modified Files:
M util/chplenv/chpl_llvm.py

Compare: https://github.com/chapel-lang/chapel/compare/717e22529f4a...bf1082871e36