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

fix: Add rustc dylib directory to compile action search paths #356

Closed
wants to merge 3 commits into from
Closed
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
2 changes: 1 addition & 1 deletion WORKSPACE
Original file line number Diff line number Diff line change
@@ -26,7 +26,7 @@ http_archive(

# TODO: Move this to examples/WORKSPACE when recursive repositories are enabled.
load("@io_bazel_rules_rust//rust:repositories.bzl", "rust_repositories")
rust_repositories()
rust_repositories(version = "nightly", iso_date = "2020-06-23", dev_components = True)

new_git_repository(
name = "libc",
2 changes: 1 addition & 1 deletion examples/WORKSPACE
Original file line number Diff line number Diff line change
@@ -10,7 +10,7 @@ local_repository(

load("@io_bazel_rules_rust//rust:repositories.bzl", "rust_repositories")

rust_repositories()
rust_repositories(version = "nightly", iso_date = "2020-06-23", dev_components = True)

http_archive(
name = "libc",
8 changes: 8 additions & 0 deletions examples/hello_rustc_private/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package(default_visibility = ["//visibility:public"])
load("@io_bazel_rules_rust//rust:rust.bzl", "rust_binary")

rust_binary(
name = "hello_rustc_private",
srcs = ["main.rs"],
edition = "2018",
)
7 changes: 7 additions & 0 deletions examples/hello_rustc_private/main.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#![feature(rustc_private)]

extern crate rustc_driver;

fn main() {
println!("Hello, world!");
}
4 changes: 3 additions & 1 deletion rust/private/rustc.bzl
Original file line number Diff line number Diff line change
@@ -327,8 +327,10 @@ def construct_arguments(

# Gets the paths to the folders containing the standard library (or libcore)
rust_lib_paths = depset([file.dirname for file in toolchain.rust_lib.files.to_list()]).to_list()
# Gets the paths to the folders containing the rustc dynamic libraries
rustc_lib_paths = depset([file.dirname for file in toolchain.rustc_lib.files.to_list()]).to_list()
# Tell Rustc where to find the standard library
args.add_all(rust_lib_paths, before_each = "-L", format_each = "%s")
args.add_all(rust_lib_paths+rustc_lib_paths, before_each = "-L", format_each = "%s")

args.add_all(rust_flags)
args.add_all(getattr(ctx.attr, "rustc_flags", []))