Skip to content

Fix for https://github.com/rust-lang/libc/issues/2860#2861

Merged
bors merged 1 commit into
rust-lang:masterfrom
Tastaturtaste:master
Aug 8, 2022
Merged

Fix for https://github.com/rust-lang/libc/issues/2860#2861
bors merged 1 commit into
rust-lang:masterfrom
Tastaturtaste:master

Conversation

@Tastaturtaste

@Tastaturtaste Tastaturtaste commented Aug 3, 2022

Copy link
Copy Markdown
Contributor

This PR is intended to fix #2860.
As indicated in the issue, this fix requires linking against "legacy_stdio_definitions.lib", which is only provided with Visual Studio >=15. I don't know how this could be checked conditionally at compile time though.

@rust-highfive

Copy link
Copy Markdown

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @Amanieu (or someone else) soon.

Please see the contribution instructions for more information.

@Amanieu

Amanieu commented Aug 4, 2022

Copy link
Copy Markdown
Member

It seems that we are linking against symbols that have been changed in the latest CRT? Could we change libc to link against the new symbols instead? The UCRT must expose some version of printf, right?

@rustbot ping windows

@rustbot

rustbot commented Aug 4, 2022

Copy link
Copy Markdown
Collaborator

Error: The feature ping is not enabled in this repository.
To enable it add its section in the triagebot.toml in the root of the repository.

Please file an issue on GitHub at triagebot if there's a problem with this bot, or reach out on #t-infra on Zulip.

@Amanieu

Amanieu commented Aug 4, 2022

Copy link
Copy Markdown
Member

cc @ChrisDenton

@ChrisDenton

Copy link
Copy Markdown
Member

Yeah. these aren't exported by the ucrt and haven't been for a long time. IIRC printf &co are implemented in the C headers as wrappers around internal functions. So I guess the options are:

  1. Leave it up to users to workaround this issue (aka the status quo).
  2. Ignore the warnings and try to recreate the C headers in Rust using the internal symbols. This could break at any time.
  3. Reimplement prinf in libc
  4. Try to link legacy_stdio_definitions.lib which is a library that provide these (and other) symbols

@Amanieu

Amanieu commented Aug 4, 2022

Copy link
Copy Markdown
Member

2 & 3 are straight out: we don't want this kind of maintenance burden on libc.

I think the best thing to do is to just link against legacy_stdio_definitions.

@bors r+

@bors

bors commented Aug 4, 2022

Copy link
Copy Markdown
Contributor

📌 Commit 2ec8995 has been approved by Amanieu

It is now in the queue for this repository.

@bors

bors commented Aug 4, 2022

Copy link
Copy Markdown
Contributor

⌛ Testing commit 2ec8995 with merge 10bb48d...

bors added a commit that referenced this pull request Aug 4, 2022
Fix for #2860

This PR is intended to fix the issue #2860.
As indicated in the issue, this fix requires linking against "legacy_stdio_definitions.lib", [which is only provided with Visual Studio >=15](https://docs.microsoft.com/en-us/cpp/porting/overview-of-potential-upgrade-issues-visual-cpp?view=msvc-170#libraries). I don't know how this could be checked conditionally at compile time though.
@bors

bors commented Aug 4, 2022

Copy link
Copy Markdown
Contributor

💔 Test failed - checks-actions

@Tastaturtaste

Copy link
Copy Markdown
Contributor Author

Thanks for the review!
It seems the task runner for Docker Linux Tier2 (sparc64-unknown-linux-gnu) failed with some kind of timeout:

terminating on signal 15 from pid 2252 (timeout)

@JohnTitor

Copy link
Copy Markdown
Member

@bors retry

bors added a commit that referenced this pull request Aug 4, 2022
Fix for #2860

This PR is intended to fix the issue #2860.
As indicated in the issue, this fix requires linking against "legacy_stdio_definitions.lib", [which is only provided with Visual Studio >=15](https://docs.microsoft.com/en-us/cpp/porting/overview-of-potential-upgrade-issues-visual-cpp?view=msvc-170#libraries). I don't know how this could be checked conditionally at compile time though.
@bors

bors commented Aug 4, 2022

Copy link
Copy Markdown
Contributor

⌛ Testing commit 2ec8995 with merge 12f0b20...

@bors

bors commented Aug 4, 2022

Copy link
Copy Markdown
Contributor

💥 Test timed out

@JohnTitor

Copy link
Copy Markdown
Member

@bors retry

@bors

bors commented Aug 8, 2022

Copy link
Copy Markdown
Contributor

⌛ Testing commit 2ec8995 with merge af34f07...

@bors

bors commented Aug 8, 2022

Copy link
Copy Markdown
Contributor

☀️ Test successful - checks-actions, checks-cirrus-freebsd-12, checks-cirrus-freebsd-13, checks-cirrus-freebsd-14
Approved by: Amanieu
Pushing af34f07 to master...

@bors bors merged commit af34f07 into rust-lang:master Aug 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

error LNK2019: unresolved external symbol printf

7 participants