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

rustdoc prefers dynamic linking #16358

Closed
metajack opened this issue Aug 8, 2014 · 13 comments
Closed

rustdoc prefers dynamic linking #16358

metajack opened this issue Aug 8, 2014 · 13 comments
Labels
T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.

Comments

@metajack
Copy link
Contributor

metajack commented Aug 8, 2014

rustdoc chooses to link dynamically if rlibs are available, which can sometimes cause problems. This seems bizarre since rustc has the opposite behavior.

@metajack
Copy link
Contributor Author

metajack commented Aug 8, 2014

cc @alexcrichton

@huonw
Copy link
Member

huonw commented Aug 8, 2014

What does this mean? When is rustdoc creating binary artifacts?

@metajack
Copy link
Contributor Author

metajack commented Aug 8, 2014

When it compiles doctests.

@alexcrichton
Copy link
Member

Yes, rustdoc passes -C prefer-dynamic because generating many many executables is far more efficient if they're dynamically linked.

I agree that rustdoc should probably have an opt-out for this (not turned on by default in my opinion). Out of curiosity, what were the problems you were seeing?

@metajack
Copy link
Contributor Author

metajack commented Aug 9, 2014

If there are name conflicts this will show up in dynamic linking. For example, rust-foo which links libfoo.a and generates libfoo.so. We had a lot of this in Servo and it took some time to fix all of them. After I had done so, the test prorams would then sometimes fail even though everything else linked fine. There was no indication of why the problem happened, it would just say it couldn't find the library.

@alexcrichton
Copy link
Member

Why would this only show up during dynamic linking, and not when linking an executable with rlibs? When linking with rlibs we still just pass -lfoo?

@metajack
Copy link
Contributor Author

metajack commented Aug 9, 2014

I don't know the answer. But I found the that if I forced rlibs only to be generated, the problems went away. Eventually, after discussion with you, I switched to using kind="static" and doing it correctly.

@alexcrichton
Copy link
Member

While this is certainly a bug and should be implemented, it sounds like it may not necessarily fix the issues you've been seeing (conflicting names of native/rust libraries). For those conflicts the recommended solution is -C extra-filename=...

@metajack
Copy link
Contributor Author

metajack commented Aug 9, 2014

That is exactly what I've done as I've discovered the issues.

@larsbergstrom
Copy link
Contributor

@alexcrichton FYI, @mrobinson has been running into this and it's causing us to disable rustdoc on a bunch of our modules. Is there any ETA for a fix?

@alexcrichton
Copy link
Member

Is there a more minimal reproduction for this issue other than "cargo doc in servo" ?

@steveklabnik
Copy link
Member

Without a reproduction, we can't fix this. @metajack let us know if you have one!

@larsbergstrom
Copy link
Contributor

I'm not aware of a more minimal repro than "cargo doc in servo."

bors added a commit to rust-lang-ci/rust that referenced this issue Feb 25, 2024
…h-macros, r=Veykril

Deduplicate references when some of them are in macro expansions

EDIT: I wonder if this is a regression, I'll try to investigate.

Commit 6a06f6f (Deduplicate reference search results, 2022-11-07)
deduplicates references within each definition.

Apparently our descend_into_macros() stanza returns
one definition for each time a name is used in a macro.
Each of those definitions has the same set of references.
We return them all, leading to many redundant references.

Work around this by deduplicating definitions as well.  Perhaps there
is a better fix to not produce duplicate definitions in the first
place.

I discovered this working with the "bitflags" macro from the crate
of the same name.

Fixes rust-lang#16357
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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

5 participants