Skip to content

librustc: add LLVM LDFLAGS to deps #12651

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

Merged
merged 2 commits into from
Mar 2, 2014
Merged
Show file tree
Hide file tree
Changes from all 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
7 changes: 1 addition & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,11 @@ before_script:
# Note that this is meant to run in a "fairly small" amount of time, so this
# isn't exhaustive at all.
#
# The "-lffi and -lncurses" are required for LLVM. The LLVM that rust builds
# manually disables bringing in these two libraries, but the stock LLVM was
# apparently built with these options. We provide these options when building so
# the `rustc` binary can successfully link.
#
# As a result of https://github.com/travis-ci/travis-ci/issues/1066, we run
# everything in one large command instead of multiple commands.
script: |
make tidy &&
RUSTFLAGS="-C link-args='-lffi -lncurses'" make -j4 rustc-stage1 &&
make -j4 rustc-stage1 &&
make check-stage1-std check-stage1-rpass check-stage1-cfail check-stage1-rfail

env:
Expand Down
16 changes: 16 additions & 0 deletions src/etc/mklldeps.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@

f.write("#[cfg(" + ', '.join(cfg) + ")]\n")

# LLVM libs
args = [llconfig, '--libs']
args.extend(components)
proc = subprocess.Popen(args, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
Expand All @@ -67,6 +68,21 @@
for lib in out.strip().split(' '):
lib = lib[2:] # chop of the leading '-l'
f.write("#[link(name = \"" + lib + "\", kind = \"static\")]\n")

# LLVM ldflags
args = [llconfig, '--ldflags']
proc = subprocess.Popen(args, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
out, err = proc.communicate()

if err:
print("failed to run llconfig: args = `{}`".format(args))
sys.exit(1)

for lib in out.strip().split(' '):
if lib[:2] == "-l":
f.write("#[link(name = \"" + lib[2:] + "\")]\n")

#extra
f.write("#[link(name = \"stdc++\")]\n")
if os == 'win32':
f.write("#[link(name = \"imagehlp\")]\n")
Expand Down