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

On Windows 10, swiftc gets error regarding swiftrt.obj #58435

Closed
gandalfas opened this issue Apr 27, 2022 · 8 comments
Closed

On Windows 10, swiftc gets error regarding swiftrt.obj #58435

gandalfas opened this issue Apr 27, 2022 · 8 comments
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. cloned Resolution: Was resubmitted in the appropriate repository rather than transferred documentation inaccurate info Bug → documentation: Inaccurate info † website This issue was supposed to belong in the swift-org-website repository Windows Platform: Windows

Comments

@gandalfas
Copy link

gandalfas commented Apr 27, 2022

This is due to a "bug" in the page Swift - Getting Started for Windows 10. Below, after describing the issue, I have both a solution for developers using Swift on Windows, and a request to change that page. I am new at Swift, and other thoughts are welcome! And many thanks to all who helped bring Swift to Windows!!! :)

Environment

build number: Swift 5.6.1
OS: Windows 10 desktop computer

Issue Description

On Windows 10, swiftc gets error: clang: error: no such file or directory: 'C:\Library\Developer\Toolchains\unknown-Asserts-development.xctoolchain\usr\lib\swift\windows\x86_64\swiftrt.obj'. :0: error: link command failed with exit code 1 (use -v to see invocation)

Test Case

After an install of Swift on Windows 10, run 'swiftc -g Factorial.swift' as shown on Swift - Getting Started > Using the LLDB Debugger. That elicits the error above.

Cause

Some sdk-related options are missing from the compile.

Solution

Add these options to your compile:

set SWIFTFLAGS=-sdk %SDKROOT% -I %SDKROOT%\usr\lib\swift -L %SDKROOT%\usr\lib\swift\windows
swiftc -g Factorial.swift -o Factorial.exe %SWIFTFLAGS%

I found this in: Compiling a simple hello.swift on Windows

Suggested Documentation Fix

On Swift - Getting Started > Using the LLDB Debugger, where it says to run:

swiftc -g Factorial.swift

add this text after that:

On Windows 10, additional options are needed, and the .exe extension must be requested:

set SWIFTFLAGS=-sdk %SDKROOT% -I %SDKROOT%\usr\lib\swift -L %SDKROOT%\usr\lib\swift\windows
swiftc -g Factorial.swift -o Factorial.exe %SWIFTFLAGS%

@gandalfas gandalfas added the bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. label Apr 27, 2022
@shahmishal shahmishal added the Windows Platform: Windows label Apr 27, 2022
@gandalfas
Copy link
Author

gandalfas commented Jul 16, 2022

@shahmishal, I see this documentation issue was not fixed in the recent release of 5.6.2. Did I classify this incorrectly as a 'bug'? It is not a fix to the code base - just a fix to the documentation page, which could be made at any time. Just wondering if I submitted this correctly because I am new to GitHub.

Note, the same question applies to several other issues I submitted, e.g.,

Thanks for any thoughts!

@compnerd
Copy link
Member

@Kim4444 the web documentation is not in this repository. The changes for that should be submitted to https://github.com/apple/swift-org-website

@gandalfas
Copy link
Author

@compnerd, Thanks for pointing that out. That has been done and I will review my other changes for the same.

@gandalfas
Copy link
Author

I am closing this, since I had resubmitted it as:
(https://github.com/apple/swift-org-website/issues/123

@gandalfas
Copy link
Author

closed

@AnthonyLatsis AnthonyLatsis added documentation off topic Resolution: Is beyond the scope of the Swift project (Xcode, proprietary Apple frameworks, etc.) labels Apr 16, 2023
@AnthonyLatsis
Copy link
Collaborator

AnthonyLatsis commented Apr 16, 2023

@gandalfas For the future, consider asking us to transfer the issue instead. This allows us to avoid duplication and minimize the amount of irrelevant issues in the database.

@AnthonyLatsis AnthonyLatsis closed this as not planned Won't fix, can't repro, duplicate, stale Apr 16, 2023
@AnthonyLatsis AnthonyLatsis added the inaccurate info Bug → documentation: Inaccurate info label Apr 16, 2023
@gandalfas
Copy link
Author

@AnthonyLatsis , I will surely do that - I definitely want to use best practices. And I do have more issues to review and move to swift-org-website. I will reference your name in those.

I would note though, that in some of these cases that you have closed for me today, the issue in here (apple/swift) did not match one for one with the new issue created on swift-org-website. In one case, one of three items I raised initially (~ a year ago) had been fixed, so that is not mentioned at all in the new issue on swift-org-website. And in another case, 3 issues here were closed and are best represented by one new issue on swift-org-website. Thus for these non 1-to-1 types, a straight transfer of the issue would not be correct. I guess for these kinds of cases I can ask for advice.

Also, I thought that today I had successfullly Closed-with-Comment this issue and others. But clearly I have caused you to have to close these issues - sorry to make work for you. I am a bit new to Github - did I not close them correctly?

Thanks for your guidance!

@AnthonyLatsis AnthonyLatsis added the duplicate Resolution: Duplicates another issue label Apr 17, 2023
@AnthonyLatsis
Copy link
Collaborator

AnthonyLatsis commented Apr 17, 2023

Thanks!

In one case, one of three items I raised initially (~ a year ago) had been fixed, so that is not mentioned at all in the new issue on swift-org-website.

In this case we could have manually linked (or referenced in a comment) the PR that fixed the item after the transfer and left the issue open.

And in another case, 3 issues here were closed and are best represented by one new issue on swift-org-website.

Personally, I would still vote for transferring all three and, depending on why they are best represented by a single issue, either close two as duplicates of the third or leave them to eventually be closed individually.

Also, I thought that today I had successfully Closed-with-Comment this issue and others. But clearly I have caused you to have to close these issues - sorry to make work for you. I am a bit new to Github - did I not close them correctly?

No biggie, I simply re-closed them with the status GitHub suggests for duplicates ('not planned').

@AnthonyLatsis AnthonyLatsis added † website This issue was supposed to belong in the swift-org-website repository cloned Resolution: Was resubmitted in the appropriate repository rather than transferred and removed off topic Resolution: Is beyond the scope of the Swift project (Xcode, proprietary Apple frameworks, etc.) duplicate Resolution: Duplicates another issue labels Apr 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. cloned Resolution: Was resubmitted in the appropriate repository rather than transferred documentation inaccurate info Bug → documentation: Inaccurate info † website This issue was supposed to belong in the swift-org-website repository Windows Platform: Windows
Projects
None yet
Development

No branches or pull requests

5 participants
@compnerd @shahmishal @AnthonyLatsis @gandalfas and others