yonaskolb / Mint

A package manager that installs and runs executable Swift packages
MIT License
2.27k stars 122 forks source link

XCode 11.5 using mint run in script phase for non macOS project #179

Open cltnschlosser opened 4 years ago

cltnschlosser commented 4 years ago

Given xcode environment variables the swift compiler gets confused because sysroot is set for iOS and target is macOS. I don't have the exact error message anymore, but adding unset SDKROOT before calling mint fixes it.

Even if this isn't something mint wants to handle, figured I'd leave this here to help anyone else that runs into this issue.

adamjcampbell commented 4 years ago

@cltnschlosser I have also run into this Thanks for mentioning the workaround

PatrickDotStar commented 4 years ago

Same issue here.

⚠️: using sysroot for 'iPhoneSimulator' but targeting 'MacOSX': module 'Swift' was created for incompatible target

🛑: x86_64-apple-ios13.0: /var/folders/95/56dg4mm10hq3gh4ks84qf41h0000gn/C/org.llvm.clang/ModuleCache/Swift-XC2YA6783J4B.swiftmodule

unset SDKROOT works indeed. Not sure though if this has any side effects

uhooi commented 4 years ago

Same issue here too with Xcode 11.6. unset SDKROOT works indeed too. Thank you :)

スクリーンショット_2020-07-19_15_40_17_skitch スクリーンショット_2020-07-19_16_03_02_skitch

But I'm wondering if there are any side effects:sweat_smile:

cltnschlosser commented 4 years ago

There shouldn't be, the goal is just to get the swift compiler execution by spm to avoid this branch https://github.com/apple/swift/blame/c7da0f2f658db600ff43af49dd204eaa625e858f/lib/Driver/Driver.cpp#L1711 It's been there for a long time, so maybe spm changed something in 5.2.

asam139 commented 3 years ago

Same issue here.

Screenshot 2020-10-13 at 11 20 51
asam139 commented 3 years ago

I have just resolved using the version 0.40.3 of SwiftLint and adding the line unset SDKROOT at the beginning.

Screenshot 2020-10-13 at 11 40 37
uhooi commented 3 years ago

Running unset SDKROOT sometimes results in 'Missing value for SDKROOT'.

Because tools built in Mint are run on macOS, It's good to specify the SDK as xcrun --sdk macosx mint run ....

スクリーンショット_2020-11-24_15_16_01