Skip to content

Commit 011b32e

Browse files
committed
Fix amdclang version detection for src build
1 parent f6cc0a6 commit 011b32e

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

script/get-amdclang/customize.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,23 @@ def preprocess(i):
4444
if os.path.isdir(p) and p not in search_paths:
4545
search_paths.append(p)
4646

47+
# For src builds: also check the install bin dir directly
48+
# and create amdclang symlinks if clang exists but amdclang doesn't
49+
if env.get('MLC_ROCM_BUILD_FROM_SRC', '') == 'yes':
50+
install_prefix = env.get('MLC_ROCM_INSTALL_PREFIX', '')
51+
if install_prefix:
52+
bin_dir = os.path.join(install_prefix, 'bin')
53+
if os.path.isdir(bin_dir):
54+
if bin_dir not in search_paths:
55+
search_paths.append(bin_dir)
56+
# Create symlinks if needed
57+
symlinks = {'amdclang': 'clang', 'amdclang++': 'clang++', 'amdflang': 'flang-new'}
58+
for link_name, target in symlinks.items():
59+
link_path = os.path.join(bin_dir, link_name)
60+
target_path = os.path.join(bin_dir, target)
61+
if os.path.isfile(target_path) and not os.path.exists(link_path):
62+
os.symlink(target, link_path)
63+
4764
if search_paths:
4865
env['MLC_TMP_PATH'] = os.pathsep.join(search_paths)
4966

0 commit comments

Comments
 (0)