Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ability to infer CHPL_LLVM_GCC_INSTALL_DIR #26429

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 19 additions & 5 deletions util/chplenv/chpl_llvm.py
Original file line number Diff line number Diff line change
Expand Up @@ -752,13 +752,28 @@ def get_gcc_prefix_dir(clang_cfg_args):
def get_gcc_install_dir():
gcc_dir = overrides.get('CHPL_LLVM_GCC_INSTALL_DIR', '')

llvm_version = get_llvm_version()
flag_supported = llvm_version not in ('11', '12', '13', '14', '15')
if gcc_dir:
llvm_version = get_llvm_version()
if llvm_version in ('11', '12', '13', '14', '15'):
if not flag_supported:
warning("This LLVM / clang version {0} is too old to use "
"CHPL_LLVM_GCC_INSTALL_DIR -- "
"it will be ignored".format(llvm_version))
return ''
gcc_dir = ''
# allow CHPL_LLVM_GCC_INSTALL_DIR=none to disable inferring it
if gcc_dir == 'none':
gcc_dir = ''

elif flag_supported:
# compute the GCC that LLVM should use.
# this logic is based on the same logic in the LLVM spack package
_, _, stdout, _ = try_run_command(
["gcc", "-print-file-name=libgcc.a"], combine_output=True)
if stdout:
gcc_dir_path = stdout.strip()
if os.path.abspath(gcc_dir_path):
dirname = os.path.dirname(gcc_dir_path)
gcc_dir = dirname if os.path.exists(dirname) else gcc_dir

return gcc_dir

Expand Down Expand Up @@ -1054,8 +1069,7 @@ def filter_llvm_config_flags(llvm_val, flags):
# when adding LLVM=system as system headers, we should not perturb the
# include search path, so use -isystem-after/-idirafter
#
# when adding LLVM=bundled, we should include the LLVM headers as system
# headers and prefer the bundled headers, so use -isystem
# when adding LLVM=bundled, we should include the LLVM headers a
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

something weird happened with this comment

#
include_flag = '-idirafter' if llvm_val == 'system' else '-isystem'
if flag.startswith('-I'):
Expand Down
1 change: 1 addition & 0 deletions util/chplenv/overrides.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@
'CHPL_LLVM_CLANG_CXX',
# CHPL_LLVM_VERSION -- doesn't make sense to override it
'CHPL_LLVM_GCC_PREFIX', # not in printchplenv --all
'CHPL_LLVM_GCC_INSTALL_DIR', # not in printchplenv --all
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍


'CHPL_AUX_FILESYS',
'CHPL_LIB_PIC',
Expand Down
Loading