Skip to content

Build script dylib test issue #6318

Closed
@ehuss

Description

@ehuss

The test build_script_with_dynamic_native_dependency does not seem to be working as it was originally intended. I was going to fix it myself, but there are too many changes that I don't understand. There are two primary issues:

  • This line in the test points to a non-existing path:
    println!("cargo:rustc-link-search=native={}/target/debug/deps",
  • These lines do not have any test coverage (removing add_plugin_deps does not cause any errors):
    // For all plugin dependencies, add their -L paths (now calculated and
    // present in `state`) to the dynamic library load path for the command to
    // execute.
    fn add_plugin_deps(
    rustc: &mut ProcessBuilder,
    build_state: &BuildMap,
    build_scripts: &BuildScripts,
    root_output: &PathBuf,
    ) -> CargoResult<()> {
    let var = util::dylib_path_envvar();
    let search_path = rustc.get_env(var).unwrap_or_default();
    let mut search_path = env::split_paths(&search_path).collect::<Vec<_>>();
    for id in build_scripts.plugins.iter() {
    let key = (id.clone(), Kind::Host);
    let output = build_state
    .get(&key)
    .ok_or_else(|| internal(format!("couldn't find libs for plugin dep {}", id)))?;
    search_path.append(&mut filter_dynamic_search_path(
    output.library_paths.iter(),
    root_output,
    ));
    }
    let search_path = join_paths(&search_path, var)?;
    rustc.env(var, &search_path);
    Ok(())
    }

The history for this test:

It's not clear to me how #3974 was supposed to work. It's also not clear if add_plugin_deps is even needed anymore. I would think all plugin dylibs should already live in the deps dir which is already included in the LD_LIBRARY_PATH, so I don't know why add_plugin_deps exists.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions