Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

rustdoc fails to account for -Clinker and -Clink-arg when building tests #65171

Closed
nagisa opened this issue Oct 6, 2019 · 1 comment
Closed
Labels
A-doctests Area: Documentation tests, run by rustdoc A-linkage Area: linking into static, shared libraries and binaries C-bug Category: This is a bug. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.

Comments

@nagisa
Copy link
Member

nagisa commented Oct 6, 2019

I’m working on a fairly peculiar system at the moment where the default linker (cc) is not able of linking properly, and thus I set the following environment variables

export RUSTFLAGS="-Clinker=clang -Clink-arg=--target=$HOST_TARGET"
export RUSTDOCFLAGS="-Clinker=clang -Clink-arg=--target=$HOST_TARGET"
export CC="clang"
export CFLAGS="--target=$HOST_TARGET"

which made cargo build pass. However cargo test still fails because doctests are still being compiled with the default linker. Running cargo test --verbose reveals that the flags are being passed through to rustdoc:

rustdoc ... -Clinker=clang -Clink-arg=--target=$HOST_TARGET

However, rustdoc still uses a default linker:

error: linking with `cc` failed: exit code: 1
  |
  = note: "cc" ...

(Tested with rustdoc 1.38.0 (625451e37 2019-09-23))

@nagisa nagisa added T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. A-doctests Area: Documentation tests, run by rustdoc labels Oct 6, 2019
@jonas-schievink jonas-schievink added C-bug Category: This is a bug. A-linkage Area: linking into static, shared libraries and binaries labels Oct 6, 2019
@nagisa nagisa changed the title rustdoc fails to accuont for -Clinker and -Clink-arg when building tests rustdoc fails to account for -Clinker and -Clink-arg when building tests Oct 6, 2019
@ollie27
Copy link
Member

ollie27 commented Oct 6, 2019

This has been fixed by #63827 + #63834 so should work on 1.39.0.

@ollie27 ollie27 closed this as completed Oct 6, 2019
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
A-doctests Area: Documentation tests, run by rustdoc A-linkage Area: linking into static, shared libraries and binaries C-bug Category: This is a bug. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

3 participants