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

Force static linking of LLVM #37617

Merged
merged 1 commit into from
Nov 6, 2016
Merged

Conversation

pweyck
Copy link
Contributor

@pweyck pweyck commented Nov 6, 2016

Run llvm-config with --link-static if available, to force static linking of LLVM.
This option was added in LLVM 3.8.

This is my first pull request, any feedback is welcome!

Fixes #36854
See also: #36996

Run llvm-config with "--link-static" if available, to force static linking of LLVM.
This option was added in LLVM 3.8.

Fixes rust-lang#36854
See also: rust-lang#36996
@rust-highfive
Copy link
Collaborator

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @arielb1 (or someone else) soon.

If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes.

Please see the contribution instructions for more information.

@alexcrichton
Copy link
Member

@bors: r+

Thanks!

@bors
Copy link
Contributor

bors commented Nov 6, 2016

📌 Commit bcfbbd8 has been approved by alexcrichton

@bors
Copy link
Contributor

bors commented Nov 6, 2016

⌛ Testing commit bcfbbd8 with merge 4742008...

bors added a commit that referenced this pull request Nov 6, 2016
Force static linking of LLVM

Run `llvm-config` with `--link-static` if available, to force static linking of LLVM.
This option was added in LLVM 3.8.

This is my first pull request, any feedback is welcome!

Fixes #36854
See also: #36996
@bors bors merged commit bcfbbd8 into rust-lang:master Nov 6, 2016
@japaric
Copy link
Member

japaric commented Nov 9, 2016

This broke building Rust on Ubuntu 16.04 against system llvm AFAICT. The build fails when building th rustc_llvm crate with this output:

--- stderr
usage: llvm-config <OPTION>... [<COMPONENT>...]

Get various configuration information needed to compile programs which use
LLVM.  Typically called from 'configure' scripts.  Examples:
  llvm-config --cxxflags
  llvm-config --ldflags
  llvm-config --libs engine bcreader scalaropts

Options:
  --version         Print LLVM version.
  --prefix          Print the installation prefix.
  --src-root        Print the source root LLVM was built from.
  --obj-root        Print the object root used to build LLVM.
  --bindir          Directory containing LLVM executables.
  --includedir      Directory containing LLVM headers.
  --libdir          Directory containing LLVM libraries.
  --cppflags        C preprocessor flags for files that include LLVM headers.
  --cflags          C compiler flags for files that include LLVM headers.
  --cxxflags        C++ compiler flags for files that include LLVM headers.
  --ldflags         Print Linker flags.
  --system-libs     System Libraries needed to link against LLVM components.
  --libs            Libraries needed to link against LLVM components.
  --libnames        Bare library names for in-tree builds.
  --libfiles        Fully qualified library filenames for makefile depends.
  --components      List of all possible components.
  --targets-built   List of all targets currently built.
  --host-target     Target triple used to configure LLVM.
  --build-mode      Print build mode of LLVM tree (e.g. Debug or Release).
  --assertion-mode  Print assertion mode of LLVM tree (ON or OFF).
  --build-system    Print the build system used to build LLVM (autoconf or cmake).
  --has-rtti        Print whether or not LLVM was built with rtti (YES or NO).
  --shared-mode     Print how the provided components can be collectively linked (`shared` or `static`).
Typical components:
  all               All LLVM libraries (default).
  engine            Either a native JIT or a bitcode interpreter.
thread 'main' panicked at 'command did not execute successfully: "/usr/bin/llvm-config" "--libs" "--link-static" "--system-libs" "aarch64" "arm" "asmparser" "bitreader" "bitwriter" "instrumentation" "interpreter" "ipo" "linker" "mcjit" "mips" "powerpc" "systemz" "x86"
expected success, got: exit code: 1', /shared/rust/checkouts/msp430/src/build_helper/lib.rs:69
note: Run with `RUST_BACKTRACE=1` for a backtrace.

Ubuntu 16.04 ships with llvm 3.8 but this link-static flag doesn't seem to be available. If run the llvm-config command withouth the link-static flag then it succeeds.

$ /usr/bin/llvm-config --version
3.8.0

@japaric
Copy link
Member

japaric commented Nov 9, 2016

FWIW, Ubuntu 16.10 also ships with llvm 3.8 so this is probably broken there as well but I didn't check.

@alexcrichton
Copy link
Member

:\

LLVM version what even are you?

@alexcrichton
Copy link
Member

Opened a PR for that: #37667

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants