Skip to content

Commit 10cf701

Browse files
committed
doc: discuss build script instruction order
1 parent dc54f15 commit 10cf701

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/doc/src/reference/build-scripts.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,15 @@ Build scripts communicate with Cargo by printing to stdout. Cargo will
7777
interpret each line that starts with `cargo:` as an instruction that will
7878
influence compilation of the package. All other lines are ignored.
7979

80+
> Note: The order of `cargo:` instructions printed by the build script *may*
81+
> affect the order of arguments that `cargo` passes to `rustc`. In turn, the
82+
> order of arguments passed to `rustc` may affect the order of arguments passed
83+
> to the linker. Therefore, you will want to pay attention to the order of the
84+
> build script's instructions. For example, if object `foo` needs to link against
85+
> library `bar`, you may want to make sure that library `bar`'s
86+
> [`cargo:rustc-link-lib`](#rustc-link-lib) instruction appears *after*
87+
> instructions to link object `foo`.
88+
8089
The output of the script is hidden from the terminal during normal
8190
compilation. If you would like to see the output directly in your terminal,
8291
invoke Cargo as "very verbose" with the `-vv` flag. This only happens when the

0 commit comments

Comments
 (0)