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

Running script in iOS project as build-script fails #113

Open
Jeehut opened this issue Mar 28, 2020 · 8 comments
Open

Running script in iOS project as build-script fails #113

Jeehut opened this issue Mar 28, 2020 · 8 comments

Comments

@Jeehut
Copy link

Jeehut commented Mar 28, 2020

I've just tried to run a Swift script using swift-sh in the Xcode build scripts step in an iOS project and it failed with the following output:

using sysroot for 'iPhoneSimulator' but targeting 'MacOSX'
'Swift' was created for incompatible target x86_64-apple-ios13.0: /var/folders/c_/pt8g6s3x3h5gg4gznvyqthmc0000gn/C/org.llvm.clang.user/ModuleCache/Swift-3LLGH9HFMRPI6.swiftmodule

This seems to be a known issue (SR-9216 – feel free to click the "Vote for this issue" button) but it's open for over a year now, so I suggest we add a workaround into swift-sh and don't wait for it to be fixed.

The simplest workaround seems to be using #!/usr/bin/xcrun --sdk macosx swift, so we might want to use that to execute Swift as well somehow. See also this Swift Forums thread.

@c0diq
Copy link

c0diq commented Apr 1, 2020

I'm having the same problem after updating to Xcode 11.4

@c0diq
Copy link

c0diq commented Apr 7, 2020

Any update?

@Jeehut
Copy link
Author

Jeehut commented May 21, 2020

@mxcl Do you think you'll have time to take a look into this sometime soon? Build scripts are a very useful feature, I'd love to see this fixed, it's currently the biggest blocker for a version 1.0.0 release of AnyLint. I'd be willing to help if you can give me some guidance.

@saijithendrag
Copy link

saijithendrag commented Jul 10, 2020

Try using /usr/bin/xcrun --sdk macosx swift-sh <path to script> instead of swift <path to script>.

@mxcl
Copy link
Owner

mxcl commented Jul 26, 2020

Hi everyone, I have finally got some time together to fix this.

I’m pretty sure the fix is a one liner.

It's depressing to me that my open source is totally dependent on what time I have to give it 😞

I'm not sure really what I could do to have made any of you felt confident enough to submit a PR.

@mxcl
Copy link
Owner

mxcl commented Jul 26, 2020

So, in theory #113 fixes it, but I could use a test-case.

@mxcl mxcl closed this as completed in a5cbe60 Jul 26, 2020
mxcl added a commit that referenced this issue Jul 26, 2020
@mxcl
Copy link
Owner

mxcl commented Jul 26, 2020

2.0.1 has the fix. Please try!

@mxcl mxcl reopened this Jul 26, 2020
@Jeehut
Copy link
Author

Jeehut commented Jul 28, 2020

@mxcl I just ugpraded to 2.0.1 but I'm still having the same issue:

/Users/Jeehut/Library/Developer/swift-sh.cache/6cfae87d4ff40300d031fc7f93264221: error: manifest parse error(s):
<unknown>:0: warning: using sysroot for 'iPhoneSimulator' but targeting 'MacOSX'
<unknown>:0: error: unable to load standard library for target 'x86_64-apple-macosx10.15'
error: 1 <(/Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift build -Xswiftc -suppress-warnings)

The funny thing is, when I switch to my macOS target, build (same build script there, running swift-sh lint.swift), then switch back to the iOS target, it seems to be magically working for a while. Really weird.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants