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
Fix possible build errors from ENABLE_THREAD_SANITIZER=YES #2085
base: master
Are you sure you want to change the base?
Conversation
Thanks for the PR! |
Thanks for the PR — we should definitely make it easier of users of Carthage to configure the thread sanitizer. In terms of build settings only applicable to certain platforms, XCDBLD ideally shouldn’t have intelligence of that, and Carthage/CarthageKit (while the better place for such logic) shouldn’t hardcode settings which might have applicability change between Clang/LLVM/Swift versions. There is another way for a user to configure this behavior with the current version of Carthage, though very unintuitive. tee ~/Library/Preferences/thread-sanitizer.xcconfig <<-'EOF'
ENABLE_THREAD_SANITIZER[sdk=macosx*] = YES
ENABLE_THREAD_SANITIZER[sdk=iphonesimulator*][arch=x86_64] = YES
ENABLE_THREAD_SANITIZER[sdk=appletvsimulator*][arch=x86_64] = YES
ENABLE_THREAD_SANITIZER[sdk=watchsimulator*][arch=x86_64] = YES
EOF
XCODE_XCCONFIG_FILE="${HOME}/Library/Preferences/thread-sanitizer.xcconfig" carthage build --no-skip-current For unspecified SDKs and architectures in the How to inform a user of this solution:We could, for a user who has set Think I've figured out what’s necessary for Carthage to parse this error¹ and would appreciate your input (thanks again, @sinoru) once it’s posted². 1: plumbing changes necessary because the |
Mostly non-scientific¹, but seemingly no slower behavior with the parsing than without it. Here’s a link to the work-in-progress of the TODO
1: Non-scientific meaning: run on cloud CI, probably on a shared machine. Small, but not singular sample size. |
I think |
@ikesyo Ooops.. Yeah.. I should use that parameter. |
Via someone I asked, their initial thought was that You’re correct in the aspect: And alternatively, a xcscheme-enabled Thread Sanitized Swift-less Objective-C project can have it disabled via $ cat >! ~/Library/Preferences/platform-specific-thread-sanitizer.xcconfig <<-'EOF'
ENABLE_THREAD_SANITIZER[sdk=appletvsimulator*][arch=x86_64] = NO
EOF
$ grep 'enableThreadSanitizer' OMGHTTPURLRQ.xcodeproj/xcshareddata/xcschemes/OMGHTTPURLRQ.xcscheme
enableThreadSanitizer = "YES"
$ XCODE_XCCONFIG_FILE="${HOME}/Library/Preferences/platform-specific-thread-sanitizer.xcconfig" carthage build --no-skip-current --verbose --platform tvOS | grep 'fsanitize' || echo 'no «fsanitize» found'
no «fsanitize» found Sidenote and caveat, still unclear whether the following behavior is a bug:Works as expected on a clean `build`, but when there’s DerivedData, no `-fsanitize=thread` behavior is observed. Also, the behavior is as-of-yet untested by me on Xcode 9’s XCBuild. 1: Okay in the general sense, considering I only posed the question in a generic way. |
I'm sure that there are no localization for xcodebuild (Actually, that messages from swift compiler. And I can't find in swift repo. I agree for that messages. But I don't think that we should refers to set that options by user. I means,
for override Xcode's own settings. It looks like kinda tricky way.. Well.. I might thinks wrong. |
@sinoru Thanks for your feedback! I am not quite sure what you mean by “parent project” — is this parent/child relationship in terms of dependencies (meaning module imports)? Or something else? |
ping |
Oh, sorry. I missed that. @jdhealy I meant which project run the Carthage command by |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
This can be happened when ENABLE_THREAD_SANITIZER=YES passed from Environment Variable. (e.g
carthage build
triggered inThread Sanitizer
enabled projects)Because
Thread Sanitizer
only support in macOS and other device's simulators. If that parameter passes to iPhoneOS, watchOS, AppleTVOS build, it leads to build error.This fix will prevent for that.