Skip to content

Commit

Permalink
Auto merge of #72058 - RalfJung:no-dist-lldb, r=Mark-Simulacrum
Browse files Browse the repository at this point in the history
bootstrap: remove lldb dist packaging

The lldb-preview rustup package is missing on every single target, and has never been shipped beyond x86_64-apple-darwin. It was removed in #62592 which landed around a year ago, and there's not been demand that we re-enable it since, so we're now removing support entirely to cleanup the code a bit.

The hope is that this will also kill the useless "lldb-preview" row on https://rust-lang.github.io/rustup-components-history/.
  • Loading branch information
bors committed May 14, 2020
2 parents 94c0ab9 + dc7524b commit 23ffeea
Show file tree
Hide file tree
Showing 10 changed files with 7 additions and 184 deletions.
4 changes: 0 additions & 4 deletions config.toml.example
Expand Up @@ -411,10 +411,6 @@
# sysroot.
#llvm-tools = false

# Indicates whether LLDB will be made available in the sysroot.
# This is only built if LLVM is also being built.
#lldb = false

# Whether to deny warnings in crates
#deny-warnings = true

Expand Down
1 change: 0 additions & 1 deletion src/bootstrap/builder.rs
Expand Up @@ -439,7 +439,6 @@ impl<'a> Builder<'a> {
dist::Clippy,
dist::Miri,
dist::LlvmTools,
dist::Lldb,
dist::Extended,
dist::HashSign
),
Expand Down
3 changes: 0 additions & 3 deletions src/bootstrap/config.rs
Expand Up @@ -85,7 +85,6 @@ pub struct Config {

pub use_lld: bool,
pub lld_enabled: bool,
pub lldb_enabled: bool,
pub llvm_tools_enabled: bool,

pub llvm_cflags: Option<String>,
Expand Down Expand Up @@ -337,7 +336,6 @@ struct Rust {
lld: Option<bool>,
use_lld: Option<bool>,
llvm_tools: Option<bool>,
lldb: Option<bool>,
deny_warnings: Option<bool>,
backtrace_on_ice: Option<bool>,
verify_llvm_ir: Option<bool>,
Expand Down Expand Up @@ -585,7 +583,6 @@ impl Config {
}
set(&mut config.use_lld, rust.use_lld);
set(&mut config.lld_enabled, rust.lld);
set(&mut config.lldb_enabled, rust.lldb);
set(&mut config.llvm_tools_enabled, rust.llvm_tools);
config.rustc_parallel = rust.parallel_compiler.unwrap_or(false);
config.rustc_default_linker = rust.default_linker.clone();
Expand Down
1 change: 0 additions & 1 deletion src/bootstrap/configure.py
Expand Up @@ -57,7 +57,6 @@ def v(*args):
o("profiler", "build.profiler", "build the profiler runtime")
o("full-tools", None, "enable all tools")
o("lld", "rust.lld", "build lld")
o("lldb", "rust.lldb", "build lldb")
o("missing-tools", "dist.missing-tools", "allow failures when building tools")
o("use-libcxx", "llvm.use-libcxx", "build LLVM with libc++")
o("control-flow-guard", "rust.control-flow-guard", "Enable Control Flow Guard")
Expand Down
121 changes: 0 additions & 121 deletions src/bootstrap/dist.rs
Expand Up @@ -38,8 +38,6 @@ pub fn pkgname(builder: &Builder<'_>, component: &str) -> String {
format!("{}-{}", component, builder.rustfmt_package_vers())
} else if component == "llvm-tools" {
format!("{}-{}", component, builder.llvm_tools_package_vers())
} else if component == "lldb" {
format!("{}-{}", component, builder.lldb_package_vers())
} else {
assert!(component.starts_with("rust"));
format!("{}-{}", component, builder.rust_package_vers())
Expand Down Expand Up @@ -1645,7 +1643,6 @@ impl Step for Extended {
let llvm_tools_installer = builder.ensure(LlvmTools { target });
let clippy_installer = builder.ensure(Clippy { compiler, target });
let miri_installer = builder.ensure(Miri { compiler, target });
let lldb_installer = builder.ensure(Lldb { target });
let mingw_installer = builder.ensure(Mingw { host: target });
let analysis_installer = builder.ensure(Analysis { compiler, target });

Expand Down Expand Up @@ -1681,7 +1678,6 @@ impl Step for Extended {
tarballs.extend(miri_installer.clone());
tarballs.extend(rustfmt_installer.clone());
tarballs.extend(llvm_tools_installer);
tarballs.extend(lldb_installer);
tarballs.push(analysis_installer);
tarballs.push(std_installer);
if builder.config.docs {
Expand Down Expand Up @@ -2222,7 +2218,6 @@ impl Step for HashSign {
cmd.arg(builder.package_vers(&builder.release_num("miri")));
cmd.arg(builder.package_vers(&builder.release_num("rustfmt")));
cmd.arg(builder.llvm_tools_package_vers());
cmd.arg(builder.lldb_package_vers());

builder.create_dir(&distdir(builder));

Expand Down Expand Up @@ -2349,119 +2344,3 @@ impl Step for LlvmTools {
Some(distdir(builder).join(format!("{}-{}.tar.gz", name, target)))
}
}

#[derive(Clone, Debug, Eq, Hash, PartialEq)]
pub struct Lldb {
pub target: Interned<String>,
}

impl Step for Lldb {
type Output = Option<PathBuf>;
const ONLY_HOSTS: bool = true;
const DEFAULT: bool = true;

fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
run.path("src/llvm-project/lldb").path("src/tools/lldb")
}

fn make_run(run: RunConfig<'_>) {
run.builder.ensure(Lldb { target: run.target });
}

fn run(self, builder: &Builder<'_>) -> Option<PathBuf> {
let target = self.target;

if builder.config.dry_run {
return None;
}

let bindir = builder.llvm_out(target).join("bin");
let lldb_exe = bindir.join(exe("lldb", &target));
if !lldb_exe.exists() {
return None;
}

builder.info(&format!("Dist Lldb ({})", target));
let src = builder.src.join("src/llvm-project/lldb");
let name = pkgname(builder, "lldb");

let tmp = tmpdir(builder);
let image = tmp.join("lldb-image");
drop(fs::remove_dir_all(&image));

// Prepare the image directory
let root = image.join("lib/rustlib").join(&*target);
let dst = root.join("bin");
t!(fs::create_dir_all(&dst));
for program in &["lldb", "lldb-argdumper", "lldb-mi", "lldb-server"] {
let exe = bindir.join(exe(program, &target));
builder.install(&exe, &dst, 0o755);
}

// The libraries.
let libdir = builder.llvm_out(target).join("lib");
let dst = root.join("lib");
t!(fs::create_dir_all(&dst));
for entry in t!(fs::read_dir(&libdir)) {
let entry = entry.unwrap();
if let Ok(name) = entry.file_name().into_string() {
if name.starts_with("liblldb.") && !name.ends_with(".a") {
if t!(entry.file_type()).is_symlink() {
builder.copy_to_folder(&entry.path(), &dst);
} else {
builder.install(&entry.path(), &dst, 0o755);
}
}
}
}

// The lldb scripts might be installed in lib/python$version
// or in lib64/python$version. If lib64 exists, use it;
// otherwise lib.
let libdir = builder.llvm_out(target).join("lib64");
let (libdir, libdir_name) = if libdir.exists() {
(libdir, "lib64")
} else {
(builder.llvm_out(target).join("lib"), "lib")
};
for entry in t!(fs::read_dir(&libdir)) {
let entry = t!(entry);
if let Ok(name) = entry.file_name().into_string() {
if name.starts_with("python") {
let dst = root.join(libdir_name).join(entry.file_name());
t!(fs::create_dir_all(&dst));
builder.cp_r(&entry.path(), &dst);
break;
}
}
}

// Prepare the overlay
let overlay = tmp.join("lldb-overlay");
drop(fs::remove_dir_all(&overlay));
builder.create_dir(&overlay);
builder.install(&src.join("LICENSE.TXT"), &overlay, 0o644);
builder.create(&overlay.join("version"), &builder.lldb_vers());

// Generate the installer tarball
let mut cmd = rust_installer(builder);
cmd.arg("generate")
.arg("--product-name=Rust")
.arg("--rel-manifest-dir=rustlib")
.arg("--success-message=lldb-installed.")
.arg("--image-dir")
.arg(&image)
.arg("--work-dir")
.arg(&tmpdir(builder))
.arg("--output-dir")
.arg(&distdir(builder))
.arg("--non-installed-overlay")
.arg(&overlay)
.arg(format!("--package-name={}-{}", name, target))
.arg("--legacy-manifest-dirs=rustlib,cargo")
.arg("--component-name=lldb-preview");

builder.run(&mut cmd);
Some(distdir(builder).join(format!("{}-{}.tar.gz", name, target)))
}
}
8 changes: 0 additions & 8 deletions src/bootstrap/lib.rs
Expand Up @@ -1029,14 +1029,6 @@ impl Build {
self.rust_version()
}

fn lldb_package_vers(&self) -> String {
self.package_vers(channel::CFG_RELEASE_NUM)
}

fn lldb_vers(&self) -> String {
self.rust_version()
}

fn llvm_link_tools_dynamically(&self, target: Interned<String>) -> bool {
target.contains("linux-gnu") || target.contains("apple-darwin")
}
Expand Down
16 changes: 4 additions & 12 deletions src/bootstrap/native.rs
Expand Up @@ -184,7 +184,7 @@ impl Step for Llvm {
}

// For distribution we want the LLVM tools to be *statically* linked to libstdc++
if builder.config.llvm_tools_enabled || builder.config.lldb_enabled {
if builder.config.llvm_tools_enabled {
if !target.contains("msvc") {
if target.contains("apple") {
cfg.define("CMAKE_EXE_LINKER_FLAGS", "-static-libstdc++");
Expand Down Expand Up @@ -212,17 +212,9 @@ impl Step for Llvm {
enabled_llvm_projects.push("compiler-rt");
}

if builder.config.lldb_enabled {
enabled_llvm_projects.push("clang");
enabled_llvm_projects.push("lldb");
// For the time being, disable code signing.
cfg.define("LLDB_CODESIGN_IDENTITY", "");
cfg.define("LLDB_NO_DEBUGSERVER", "ON");
} else {
// LLDB requires libxml2; but otherwise we want it to be disabled.
// See https://github.com/rust-lang/rust/pull/50104
cfg.define("LLVM_ENABLE_LIBXML2", "OFF");
}
// We want libxml to be disabled.
// See https://github.com/rust-lang/rust/pull/50104
cfg.define("LLVM_ENABLE_LIBXML2", "OFF");

if !enabled_llvm_projects.is_empty() {
enabled_llvm_projects.sort();
Expand Down
8 changes: 0 additions & 8 deletions src/bootstrap/sanity.rs
Expand Up @@ -117,14 +117,6 @@ pub fn check(build: &mut Build) {
build.config.ninja = true;
}
}

if build.config.lldb_enabled {
cmd_finder.must_have("swig");
let out = output(Command::new("swig").arg("-version"));
if !out.contains("SWIG Version 3") && !out.contains("SWIG Version 4") {
panic!("Ensure that Swig 3.x.x or 4.x.x is installed.");
}
}
}

build.config.python = build
Expand Down
11 changes: 3 additions & 8 deletions src/bootstrap/test.rs
Expand Up @@ -1096,20 +1096,15 @@ impl Step for Compiletest {
.to_string()
})
};
let lldb_exe = if builder.config.lldb_enabled {
// Test against the lldb that was just built.
builder.llvm_out(target).join("bin").join("lldb")
} else {
PathBuf::from("lldb")
};
let lldb_version = Command::new(&lldb_exe)
let lldb_exe = "lldb";
let lldb_version = Command::new(lldb_exe)
.arg("--version")
.output()
.map(|output| String::from_utf8_lossy(&output.stdout).to_string())
.ok();
if let Some(ref vers) = lldb_version {
cmd.arg("--lldb-version").arg(vers);
let lldb_python_dir = run(Command::new(&lldb_exe).arg("-P")).ok();
let lldb_python_dir = run(Command::new(lldb_exe).arg("-P")).ok();
if let Some(ref dir) = lldb_python_dir {
cmd.arg("--lldb-python-dir").arg(dir);
}
Expand Down

0 comments on commit 23ffeea

Please sign in to comment.