Skip to content

Commit

Permalink
Fix problem with static link order with static clang and llvm
Browse files Browse the repository at this point in the history
---
Signed-off-by: Michael Ferguson <mppf@users.noreply.github.com>
  • Loading branch information
mppf committed Feb 18, 2022
1 parent 2a5b452 commit 765dde6
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions util/chplenv/chpl_llvm.py
Original file line number Diff line number Diff line change
Expand Up @@ -630,6 +630,18 @@ def get_host_link_args():
if host_platform == 'darwin':
llvm_dynamic = False

shared_mode = run_command([llvm_config, '--shared-mode'])

if shared_mode.strip() == 'static':
llvm_dynamic = False

# Make sure to put clang first on the link line
# because depends on LLVM libraries
if llvm_dynamic:
system.append('-lclang-cpp')
else:
system.extend(clang_static_libs)

libdir = run_command([llvm_config, '--libdir'])
if libdir:
libdir = libdir.strip()
Expand All @@ -642,10 +654,6 @@ def get_host_link_args():
if ldflags:
system.extend(filter_llvm_link_flags(ldflags.split()))

if llvm_dynamic:
system.append('-lclang-cpp')
else:
system.extend(clang_static_libs)

elif llvm_val == 'bundled':
# Link statically for now for the bundled configuration
Expand Down

0 comments on commit 765dde6

Please sign in to comment.