Skip to content

Commit

Permalink
add buildscript link flags only to parent crate
Browse files Browse the repository at this point in the history
On Windows, an -lalias:real link flag will cause an error when used
by a crate that does not link to the underlying library. This is
triggered when compiling a rust_library that has pyo3 as a dependency
on Windows.
  • Loading branch information
dae committed Oct 16, 2020
1 parent 1d2ad1f commit e450b98
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions rust/private/rustc.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -724,15 +724,10 @@ def _create_extra_input_args(ctx, file, build_info, dep_info):
if build_info:
out_dir = build_info.out_dir.path
build_env_file = build_info.rustc_env.path

# out_dir will be added as input by the transitive_build_infos loop below.
build_flags_files.append(build_info.flags.path)

# This should probably only actually be exposed to actions which link.
for dep_build_info in dep_info.transitive_build_infos.to_list():
input_files.append(dep_build_info.out_dir)
build_flags_files.append(dep_build_info.link_flags.path)
input_files.append(dep_build_info.link_flags)
build_flags_files.append(build_info.link_flags.path)
input_files.append(build_info.out_dir)
input_files.append(build_info.link_flags)

return input_files, out_dir, build_env_file, build_flags_files

Expand Down

0 comments on commit e450b98

Please sign in to comment.