]> git.lizzy.rs Git - rust.git/blob - src/bootstrap/tool.rs
Auto merge of #61541 - petrochenkov:tsp, r=oli-obk
[rust.git] / src / bootstrap / tool.rs
1 use std::fs;
2 use std::env;
3 use std::path::PathBuf;
4 use std::process::{Command, exit};
5 use std::collections::HashSet;
6
7 use build_helper::t;
8
9 use crate::Mode;
10 use crate::Compiler;
11 use crate::builder::{Step, RunConfig, ShouldRun, Builder};
12 use crate::util::{exe, add_lib_path};
13 use crate::compile;
14 use crate::channel::GitInfo;
15 use crate::channel;
16 use crate::cache::Interned;
17 use crate::toolstate::ToolState;
18
19 #[derive(Debug, Clone, Hash, PartialEq, Eq)]
20 pub enum SourceType {
21     InTree,
22     Submodule,
23 }
24
25 #[derive(Debug, Clone, Hash, PartialEq, Eq)]
26 struct ToolBuild {
27     compiler: Compiler,
28     target: Interned<String>,
29     tool: &'static str,
30     path: &'static str,
31     mode: Mode,
32     is_optional_tool: bool,
33     source_type: SourceType,
34     extra_features: Vec<String>,
35 }
36
37 impl Step for ToolBuild {
38     type Output = Option<PathBuf>;
39
40     fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
41         run.never()
42     }
43
44     /// Builds a tool in `src/tools`
45     ///
46     /// This will build the specified tool with the specified `host` compiler in
47     /// `stage` into the normal cargo output directory.
48     fn run(self, builder: &Builder<'_>) -> Option<PathBuf> {
49         let compiler = self.compiler;
50         let target = self.target;
51         let tool = self.tool;
52         let path = self.path;
53         let is_optional_tool = self.is_optional_tool;
54
55         match self.mode {
56             Mode::ToolRustc => {
57                 builder.ensure(compile::Rustc { compiler, target })
58             }
59             Mode::ToolStd => {
60                 builder.ensure(compile::Std { compiler, target })
61             }
62             Mode::ToolBootstrap => {} // uses downloaded stage0 compiler libs
63             _ => panic!("unexpected Mode for tool build")
64         }
65
66         let mut cargo = prepare_tool_cargo(
67             builder,
68             compiler,
69             self.mode,
70             target,
71             "build",
72             path,
73             self.source_type,
74             &self.extra_features,
75         );
76
77         let _folder = builder.fold_output(|| format!("stage{}-{}", compiler.stage, tool));
78         builder.info(&format!("Building stage{} tool {} ({})", compiler.stage, tool, target));
79         let mut duplicates = Vec::new();
80         let is_expected = compile::stream_cargo(builder, &mut cargo, vec![], &mut |msg| {
81             // Only care about big things like the RLS/Cargo for now
82             match tool {
83                 | "rls"
84                 | "cargo"
85                 | "clippy-driver"
86                 | "miri"
87                 | "rustfmt"
88                 => {}
89
90                 _ => return,
91             }
92             let (id, features, filenames) = match msg {
93                 compile::CargoMessage::CompilerArtifact {
94                     package_id,
95                     features,
96                     filenames,
97                     target: _,
98                 } => {
99                     (package_id, features, filenames)
100                 }
101                 _ => return,
102             };
103             let features = features.iter().map(|s| s.to_string()).collect::<Vec<_>>();
104
105             for path in filenames {
106                 let val = (tool, PathBuf::from(&*path), features.clone());
107                 // we're only interested in deduplicating rlibs for now
108                 if val.1.extension().and_then(|s| s.to_str()) != Some("rlib") {
109                     continue
110                 }
111
112                 // Don't worry about libs that turn out to be host dependencies
113                 // or build scripts, we only care about target dependencies that
114                 // are in `deps`.
115                 if let Some(maybe_target) = val.1
116                     .parent()                   // chop off file name
117                     .and_then(|p| p.parent())   // chop off `deps`
118                     .and_then(|p| p.parent())   // chop off `release`
119                     .and_then(|p| p.file_name())
120                     .and_then(|p| p.to_str())
121                 {
122                     if maybe_target != &*target {
123                         continue
124                     }
125                 }
126
127                 let mut artifacts = builder.tool_artifacts.borrow_mut();
128                 let prev_artifacts = artifacts
129                     .entry(target)
130                     .or_default();
131                 if let Some(prev) = prev_artifacts.get(&*id) {
132                     if prev.1 != val.1 {
133                         duplicates.push((
134                             id.to_string(),
135                             val,
136                             prev.clone(),
137                         ));
138                     }
139                     return
140                 }
141                 prev_artifacts.insert(id.to_string(), val);
142             }
143         });
144
145         if is_expected && !duplicates.is_empty() {
146             println!("duplicate artifacts found when compiling a tool, this \
147                       typically means that something was recompiled because \
148                       a transitive dependency has different features activated \
149                       than in a previous build:\n");
150             println!("the following dependencies are duplicated although they \
151                       have the same features enabled:");
152             for (id, cur, prev) in duplicates.drain_filter(|(_, cur, prev)| cur.2 == prev.2) {
153                 println!("  {}", id);
154                 // same features
155                 println!("    `{}` ({:?})\n    `{}` ({:?})", cur.0, cur.1, prev.0, prev.1);
156             }
157             println!("the following dependencies have different features:");
158             for (id, cur, prev) in duplicates {
159                 println!("  {}", id);
160                 let cur_features: HashSet<_> = cur.2.into_iter().collect();
161                 let prev_features: HashSet<_> = prev.2.into_iter().collect();
162                 println!("    `{}` additionally enabled features {:?} at {:?}",
163                          cur.0, &cur_features - &prev_features, cur.1);
164                 println!("    `{}` additionally enabled features {:?} at {:?}",
165                          prev.0, &prev_features - &cur_features, prev.1);
166             }
167             println!();
168             println!("to fix this you will probably want to edit the local \
169                       src/tools/rustc-workspace-hack/Cargo.toml crate, as \
170                       that will update the dependency graph to ensure that \
171                       these crates all share the same feature set");
172             panic!("tools should not compile multiple copies of the same crate");
173         }
174
175         builder.save_toolstate(tool, if is_expected {
176             ToolState::TestFail
177         } else {
178             ToolState::BuildFail
179         });
180
181         if !is_expected {
182             if !is_optional_tool {
183                 exit(1);
184             } else {
185                 None
186             }
187         } else {
188             let cargo_out = builder.cargo_out(compiler, self.mode, target)
189                 .join(exe(tool, &compiler.host));
190             let bin = builder.tools_dir(compiler).join(exe(tool, &compiler.host));
191             builder.copy(&cargo_out, &bin);
192             Some(bin)
193         }
194     }
195 }
196
197 pub fn prepare_tool_cargo(
198     builder: &Builder<'_>,
199     compiler: Compiler,
200     mode: Mode,
201     target: Interned<String>,
202     command: &'static str,
203     path: &'static str,
204     source_type: SourceType,
205     extra_features: &[String],
206 ) -> Command {
207     let mut cargo = builder.cargo(compiler, mode, target, command);
208     let dir = builder.src.join(path);
209     cargo.arg("--manifest-path").arg(dir.join("Cargo.toml"));
210
211     // We don't want to build tools dynamically as they'll be running across
212     // stages and such and it's just easier if they're not dynamically linked.
213     cargo.env("RUSTC_NO_PREFER_DYNAMIC", "1");
214
215     if source_type == SourceType::Submodule {
216         cargo.env("RUSTC_EXTERNAL_TOOL", "1");
217     }
218
219     let mut features = extra_features.iter().cloned().collect::<Vec<_>>();
220     if builder.build.config.cargo_native_static {
221         if path.ends_with("cargo") ||
222             path.ends_with("rls") ||
223             path.ends_with("clippy") ||
224             path.ends_with("miri") ||
225             path.ends_with("rustfmt")
226         {
227             cargo.env("LIBZ_SYS_STATIC", "1");
228             features.push("rustc-workspace-hack/all-static".to_string());
229         }
230     }
231
232     // if tools are using lzma we want to force the build script to build its
233     // own copy
234     cargo.env("LZMA_API_STATIC", "1");
235
236     cargo.env("CFG_RELEASE_CHANNEL", &builder.config.channel);
237     cargo.env("CFG_VERSION", builder.rust_version());
238     cargo.env("CFG_RELEASE_NUM", channel::CFG_RELEASE_NUM);
239
240     let info = GitInfo::new(builder.config.ignore_git, &dir);
241     if let Some(sha) = info.sha() {
242         cargo.env("CFG_COMMIT_HASH", sha);
243     }
244     if let Some(sha_short) = info.sha_short() {
245         cargo.env("CFG_SHORT_COMMIT_HASH", sha_short);
246     }
247     if let Some(date) = info.commit_date() {
248         cargo.env("CFG_COMMIT_DATE", date);
249     }
250     if !features.is_empty() {
251         cargo.arg("--features").arg(&features.join(", "));
252     }
253     cargo
254 }
255
256 macro_rules! bootstrap_tool {
257     ($(
258         $name:ident, $path:expr, $tool_name:expr
259         $(,llvm_tools = $llvm:expr)*
260         $(,is_external_tool = $external:expr)*
261         ;
262     )+) => {
263         #[derive(Copy, PartialEq, Eq, Clone)]
264         pub enum Tool {
265             $(
266                 $name,
267             )+
268         }
269
270         impl Tool {
271             pub fn get_mode(&self) -> Mode {
272                 Mode::ToolBootstrap
273             }
274
275             /// Whether this tool requires LLVM to run
276             pub fn uses_llvm_tools(&self) -> bool {
277                 match self {
278                     $(Tool::$name => false $(|| $llvm)*,)+
279                 }
280             }
281         }
282
283         impl<'a> Builder<'a> {
284             pub fn tool_exe(&self, tool: Tool) -> PathBuf {
285                 match tool {
286                     $(Tool::$name =>
287                         self.ensure($name {
288                             compiler: self.compiler(0, self.config.build),
289                             target: self.config.build,
290                         }),
291                     )+
292                 }
293             }
294         }
295
296         $(
297             #[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
298         pub struct $name {
299             pub compiler: Compiler,
300             pub target: Interned<String>,
301         }
302
303         impl Step for $name {
304             type Output = PathBuf;
305
306             fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
307                 run.path($path)
308             }
309
310             fn make_run(run: RunConfig<'_>) {
311                 run.builder.ensure($name {
312                     // snapshot compiler
313                     compiler: run.builder.compiler(0, run.builder.config.build),
314                     target: run.target,
315                 });
316             }
317
318             fn run(self, builder: &Builder<'_>) -> PathBuf {
319                 builder.ensure(ToolBuild {
320                     compiler: self.compiler,
321                     target: self.target,
322                     tool: $tool_name,
323                     mode: Mode::ToolBootstrap,
324                     path: $path,
325                     is_optional_tool: false,
326                     source_type: if false $(|| $external)* {
327                         SourceType::Submodule
328                     } else {
329                         SourceType::InTree
330                     },
331                     extra_features: Vec::new(),
332                 }).expect("expected to build -- essential tool")
333             }
334         }
335         )+
336     }
337 }
338
339 bootstrap_tool!(
340     Rustbook, "src/tools/rustbook", "rustbook";
341     UnstableBookGen, "src/tools/unstable-book-gen", "unstable-book-gen";
342     Tidy, "src/tools/tidy", "tidy";
343     Linkchecker, "src/tools/linkchecker", "linkchecker";
344     CargoTest, "src/tools/cargotest", "cargotest";
345     Compiletest, "src/tools/compiletest", "compiletest", llvm_tools = true;
346     BuildManifest, "src/tools/build-manifest", "build-manifest";
347     RemoteTestClient, "src/tools/remote-test-client", "remote-test-client";
348     RustInstaller, "src/tools/rust-installer", "fabricate", is_external_tool = true;
349     RustdocTheme, "src/tools/rustdoc-themes", "rustdoc-themes";
350 );
351
352 #[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
353 pub struct ErrorIndex {
354     pub compiler: Compiler,
355 }
356
357 impl ErrorIndex {
358     pub fn command(builder: &Builder<'_>, compiler: Compiler) -> Command {
359         let mut cmd = Command::new(builder.ensure(ErrorIndex {
360             compiler
361         }));
362         add_lib_path(
363             vec![PathBuf::from(&builder.sysroot_libdir(compiler, compiler.host))],
364             &mut cmd,
365         );
366         cmd
367     }
368 }
369
370 impl Step for ErrorIndex {
371     type Output = PathBuf;
372
373     fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
374         run.path("src/tools/error_index_generator")
375     }
376
377     fn make_run(run: RunConfig<'_>) {
378         // Compile the error-index in the same stage as rustdoc to avoid
379         // recompiling rustdoc twice if we can.
380         let stage = if run.builder.top_stage >= 2 { run.builder.top_stage } else { 0 };
381         run.builder.ensure(ErrorIndex {
382             compiler: run.builder.compiler(stage, run.builder.config.build),
383         });
384     }
385
386     fn run(self, builder: &Builder<'_>) -> PathBuf {
387         builder.ensure(ToolBuild {
388             compiler: self.compiler,
389             target: self.compiler.host,
390             tool: "error_index_generator",
391             mode: Mode::ToolRustc,
392             path: "src/tools/error_index_generator",
393             is_optional_tool: false,
394             source_type: SourceType::InTree,
395             extra_features: Vec::new(),
396         }).expect("expected to build -- essential tool")
397     }
398 }
399
400 #[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
401 pub struct RemoteTestServer {
402     pub compiler: Compiler,
403     pub target: Interned<String>,
404 }
405
406 impl Step for RemoteTestServer {
407     type Output = PathBuf;
408
409     fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
410         run.path("src/tools/remote-test-server")
411     }
412
413     fn make_run(run: RunConfig<'_>) {
414         run.builder.ensure(RemoteTestServer {
415             compiler: run.builder.compiler(run.builder.top_stage, run.builder.config.build),
416             target: run.target,
417         });
418     }
419
420     fn run(self, builder: &Builder<'_>) -> PathBuf {
421         builder.ensure(ToolBuild {
422             compiler: self.compiler,
423             target: self.target,
424             tool: "remote-test-server",
425             mode: Mode::ToolStd,
426             path: "src/tools/remote-test-server",
427             is_optional_tool: false,
428             source_type: SourceType::InTree,
429             extra_features: Vec::new(),
430         }).expect("expected to build -- essential tool")
431     }
432 }
433
434 #[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
435 pub struct Rustdoc {
436     /// This should only ever be 0 or 2.
437     /// We sometimes want to reference the "bootstrap" rustdoc, which is why this option is here.
438     pub compiler: Compiler,
439 }
440
441 impl Step for Rustdoc {
442     type Output = PathBuf;
443     const DEFAULT: bool = true;
444     const ONLY_HOSTS: bool = true;
445
446     fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
447         run.path("src/tools/rustdoc")
448     }
449
450     fn make_run(run: RunConfig<'_>) {
451         run.builder.ensure(Rustdoc {
452             compiler: run.builder.compiler(run.builder.top_stage, run.host),
453         });
454     }
455
456     fn run(self, builder: &Builder<'_>) -> PathBuf {
457         let target_compiler = self.compiler;
458         if target_compiler.stage == 0 {
459             if !target_compiler.is_snapshot(builder) {
460                 panic!("rustdoc in stage 0 must be snapshot rustdoc");
461             }
462             return builder.initial_rustc.with_file_name(exe("rustdoc", &target_compiler.host));
463         }
464         let target = target_compiler.host;
465         // Similar to `compile::Assemble`, build with the previous stage's compiler. Otherwise
466         // we'd have stageN/bin/rustc and stageN/bin/rustdoc be effectively different stage
467         // compilers, which isn't what we want. Rustdoc should be linked in the same way as the
468         // rustc compiler it's paired with, so it must be built with the previous stage compiler.
469         let build_compiler = builder.compiler(target_compiler.stage - 1, builder.config.build);
470
471         // The presence of `target_compiler` ensures that the necessary libraries (codegen backends,
472         // compiler libraries, ...) are built. Rustdoc does not require the presence of any
473         // libraries within sysroot_libdir (i.e., rustlib), though doctests may want it (since
474         // they'll be linked to those libraries). As such, don't explicitly `ensure` any additional
475         // libraries here. The intuition here is that If we've built a compiler, we should be able
476         // to build rustdoc.
477
478         let mut cargo = prepare_tool_cargo(
479             builder,
480             build_compiler,
481             Mode::ToolRustc,
482             target,
483             "build",
484             "src/tools/rustdoc",
485             SourceType::InTree,
486             &[],
487         );
488
489         let _folder = builder.fold_output(|| format!("stage{}-rustdoc", target_compiler.stage));
490         builder.info(&format!("Building rustdoc for stage{} ({})",
491             target_compiler.stage, target_compiler.host));
492         builder.run(&mut cargo);
493
494         // Cargo adds a number of paths to the dylib search path on windows, which results in
495         // the wrong rustdoc being executed. To avoid the conflicting rustdocs, we name the "tool"
496         // rustdoc a different name.
497         let tool_rustdoc = builder.cargo_out(build_compiler, Mode::ToolRustc, target)
498             .join(exe("rustdoc_tool_binary", &target_compiler.host));
499
500         // don't create a stage0-sysroot/bin directory.
501         if target_compiler.stage > 0 {
502             let sysroot = builder.sysroot(target_compiler);
503             let bindir = sysroot.join("bin");
504             t!(fs::create_dir_all(&bindir));
505             let bin_rustdoc = bindir.join(exe("rustdoc", &*target_compiler.host));
506             let _ = fs::remove_file(&bin_rustdoc);
507             builder.copy(&tool_rustdoc, &bin_rustdoc);
508             bin_rustdoc
509         } else {
510             tool_rustdoc
511         }
512     }
513 }
514
515 #[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
516 pub struct Cargo {
517     pub compiler: Compiler,
518     pub target: Interned<String>,
519 }
520
521 impl Step for Cargo {
522     type Output = PathBuf;
523     const DEFAULT: bool = true;
524     const ONLY_HOSTS: bool = true;
525
526     fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
527         let builder = run.builder;
528         run.path("src/tools/cargo").default_condition(builder.config.extended)
529     }
530
531     fn make_run(run: RunConfig<'_>) {
532         run.builder.ensure(Cargo {
533             compiler: run.builder.compiler(run.builder.top_stage, run.builder.config.build),
534             target: run.target,
535         });
536     }
537
538     fn run(self, builder: &Builder<'_>) -> PathBuf {
539         // Cargo depends on procedural macros, so make sure the host
540         // libstd/libproc_macro is available.
541         builder.ensure(compile::Test {
542             compiler: self.compiler,
543             target: builder.config.build,
544         });
545         builder.ensure(ToolBuild {
546             compiler: self.compiler,
547             target: self.target,
548             tool: "cargo",
549             mode: Mode::ToolRustc,
550             path: "src/tools/cargo",
551             is_optional_tool: false,
552             source_type: SourceType::Submodule,
553             extra_features: Vec::new(),
554         }).expect("expected to build -- essential tool")
555     }
556 }
557
558 macro_rules! tool_extended {
559     (($sel:ident, $builder:ident),
560        $($name:ident,
561        $toolstate:ident,
562        $path:expr,
563        $tool_name:expr,
564        $extra_deps:block;)+) => {
565         $(
566             #[derive(Debug, Clone, Hash, PartialEq, Eq)]
567         pub struct $name {
568             pub compiler: Compiler,
569             pub target: Interned<String>,
570             pub extra_features: Vec<String>,
571         }
572
573         impl Step for $name {
574             type Output = Option<PathBuf>;
575             const DEFAULT: bool = true;
576             const ONLY_HOSTS: bool = true;
577
578             fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
579                 let builder = run.builder;
580                 run.path($path).default_condition(builder.config.extended)
581             }
582
583             fn make_run(run: RunConfig<'_>) {
584                 run.builder.ensure($name {
585                     compiler: run.builder.compiler(run.builder.top_stage, run.builder.config.build),
586                     target: run.target,
587                     extra_features: Vec::new(),
588                 });
589             }
590
591             #[allow(unused_mut)]
592             fn run(mut $sel, $builder: &Builder<'_>) -> Option<PathBuf> {
593                 $extra_deps
594                 $builder.ensure(ToolBuild {
595                     compiler: $sel.compiler,
596                     target: $sel.target,
597                     tool: $tool_name,
598                     mode: Mode::ToolRustc,
599                     path: $path,
600                     extra_features: $sel.extra_features,
601                     is_optional_tool: true,
602                     source_type: SourceType::Submodule,
603                 })
604             }
605         }
606         )+
607     }
608 }
609
610 tool_extended!((self, builder),
611     Cargofmt, rustfmt, "src/tools/rustfmt", "cargo-fmt", {};
612     CargoClippy, clippy, "src/tools/clippy", "cargo-clippy", {
613         // Clippy depends on procedural macros, so make sure that's built for
614         // the compiler itself.
615         builder.ensure(compile::Test {
616             compiler: self.compiler,
617             target: builder.config.build,
618         });
619     };
620     Clippy, clippy, "src/tools/clippy", "clippy-driver", {
621         // Clippy depends on procedural macros, so make sure that's built for
622         // the compiler itself.
623         builder.ensure(compile::Test {
624             compiler: self.compiler,
625             target: builder.config.build,
626         });
627     };
628     Miri, miri, "src/tools/miri", "miri", {};
629     CargoMiri, miri, "src/tools/miri", "cargo-miri", {
630         // Miri depends on procedural macros, so make sure that's built for
631         // the compiler itself.
632         builder.ensure(compile::Test {
633             compiler: self.compiler,
634             target: builder.config.build,
635         });
636     };
637     Rls, rls, "src/tools/rls", "rls", {
638         let clippy = builder.ensure(Clippy {
639             compiler: self.compiler,
640             target: self.target,
641             extra_features: Vec::new(),
642         });
643         if clippy.is_some() {
644             self.extra_features.push("clippy".to_owned());
645         }
646         // RLS depends on procedural macros, so make sure that's built for
647         // the compiler itself.
648         builder.ensure(compile::Test {
649             compiler: self.compiler,
650             target: builder.config.build,
651         });
652     };
653     Rustfmt, rustfmt, "src/tools/rustfmt", "rustfmt", {};
654 );
655
656 impl<'a> Builder<'a> {
657     /// Gets a `Command` which is ready to run `tool` in `stage` built for
658     /// `host`.
659     pub fn tool_cmd(&self, tool: Tool) -> Command {
660         let mut cmd = Command::new(self.tool_exe(tool));
661         let compiler = self.compiler(0, self.config.build);
662         self.prepare_tool_cmd(compiler, tool, &mut cmd);
663         cmd
664     }
665
666     /// Prepares the `cmd` provided to be able to run the `compiler` provided.
667     ///
668     /// Notably this munges the dynamic library lookup path to point to the
669     /// right location to run `compiler`.
670     fn prepare_tool_cmd(&self, compiler: Compiler, tool: Tool, cmd: &mut Command) {
671         let host = &compiler.host;
672         let mut lib_paths: Vec<PathBuf> = vec![
673             if compiler.stage == 0 {
674                 self.build.rustc_snapshot_libdir()
675             } else {
676                 PathBuf::from(&self.sysroot_libdir(compiler, compiler.host))
677             },
678             self.cargo_out(compiler, tool.get_mode(), *host).join("deps"),
679         ];
680
681         // On MSVC a tool may invoke a C compiler (e.g., compiletest in run-make
682         // mode) and that C compiler may need some extra PATH modification. Do
683         // so here.
684         if compiler.host.contains("msvc") {
685             let curpaths = env::var_os("PATH").unwrap_or_default();
686             let curpaths = env::split_paths(&curpaths).collect::<Vec<_>>();
687             for &(ref k, ref v) in self.cc[&compiler.host].env() {
688                 if k != "PATH" {
689                     continue
690                 }
691                 for path in env::split_paths(v) {
692                     if !curpaths.contains(&path) {
693                         lib_paths.push(path);
694                     }
695                 }
696             }
697         }
698
699         add_lib_path(lib_paths, cmd);
700     }
701 }