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

[SR-9972] Linker error when building SwiftSyntax using SwiftPM's generated Xcodeproj in Xcode 10.2 beta 3 #52376

Closed
hartbit opened this issue Feb 21, 2019 · 19 comments
Assignees
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior.

Comments

@hartbit
Copy link
Collaborator

hartbit commented Feb 21, 2019

Previous ID SR-9972
Radar rdar://problem/48044350
Original Reporter @hartbit
Type Bug
Status Resolved
Resolution Done
Additional Detail from JIRA
Votes 0
Component/s Project Infrastructure
Labels Bug
Assignee @hartbit
Priority Medium

md5: 07ac891ad766d7dd268dcc9e0328f39e

Issue Description:

I haven't had to time to diagnose what could be causing this issue but those steps reproduce it:

  1. Install Xcode 10.2 beta 3

  2. Install the latest master toolchain

  3. Clone the latest commit from SwiftSyntax

  4. Execute:

    $ export TOOLCHAINS=swift
    $ cd swift-syntax
    $ ./build-script.py --generate-xcodeproj
    ** Generating gyb Files **
    Done Generating gyb Files
    ** Generate SwiftSyntax as an Xcode project **
    generated: ./SwiftSyntax.xcodeproj
  5. Launch Xcode 10.2 beta3 with the generated project

  6. Build any of the schemes.

Xcode will fail building with the following linker error:

ld: file not found: /Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2019-02-19-a.xctoolchain/usr/lib/arc/libarclite_macosx.a 

On the other hand, building using either the build-script or SwiftPM directly works:

$ ./build-script.py
$ swift build 
@ankitspd
Copy link
Member

@belkadan any idea what's going on?

@belkadan
Copy link
Contributor

I think we decided that something funny was going on where we thought arclite was going to be in the toolchain but then it wasn't (maybe the arc/ directory exists but it's empty).

@hartbit
Copy link
Collaborator Author

hartbit commented Feb 21, 2019

Stupid question: why would a SwiftPM build (from the same toolchain) not generate the same error?

@belkadan
Copy link
Contributor

Whether or not you need arclite depends on your deployment target. I suspect SwiftPM is always building for the host OS.

@belkadan
Copy link
Contributor

Ahh, figured it out today. It's because we're now shipping Clang in the downloadable toolchain too.

@belkadan
Copy link
Contributor

#22911

@belkadan
Copy link
Contributor

5.1: #22923

@hartbit
Copy link
Collaborator Author

hartbit commented Feb 26, 2019

Thanks!

@hartbit
Copy link
Collaborator Author

hartbit commented Apr 14, 2019

I'm still seeing this error, even in recent toolchains. Any idea why?

@belkadan
Copy link
Contributor

Hm, no. Fully the same, with your toolchain name in the path and then libarclite_macosx.a at the end?

@hartbit
Copy link
Collaborator Author

hartbit commented Apr 15, 2019

Exactly the same, yes.

@belkadan
Copy link
Contributor

And which toolchain?

@hartbit
Copy link
Collaborator Author

hartbit commented Apr 15, 2019

For example, here's the error on march 26th toolchain:

ld: file not found: /Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2019-03-26-a.xctoolchain/usr/lib/arc/libarclite_macosx.a 

I'll try with a more recent one.

@hartbit
Copy link
Collaborator Author

hartbit commented Apr 15, 2019

Same with the latest master toolchain:

ld: file not found: /Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2019-04-10-a.xctoolchain/usr/lib/arc/libarclite_macosx.a 

@hartbit
Copy link
Collaborator Author

hartbit commented Apr 16, 2019

@belkadan I'm not the only one with the issue: #23701 (comment)

@belkadan
Copy link
Contributor

Oh, bah. Xcode probably needs the same fix that the Swift driver took. Do you want to file a Radar or should I?

@hartbit
Copy link
Collaborator Author

hartbit commented Apr 16, 2019

If you can, I'd appreciate it. If not, I'll try to find some time tomorrow.

@belkadan
Copy link
Contributor

…it's even worse than I thought. Xcode just calls Clang to link. It doesn't add arclite itself. But the Clang in the toolchain doesn't have a copy of arclite, because that's not an open-source library. (Well, it's not part of the Swift project, anyway.)

I'm not sure what the right fix is here, but "don't use an open-source toolchain" definitely isn't it. A workaround is to change your deployment target to 10.11 or newer.

@belkadan
Copy link
Contributor

Filed rdar://problem/49947573 and talking to the Apple Clang folks.

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
This issue was closed.
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.
Projects
None yet
Development

No branches or pull requests

3 participants