Skip to content

Fix compilation issues with HAS_DISPATCH on Linux #257

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

Merged
merged 1 commit into from
Feb 11, 2016

Conversation

seabaylea
Copy link
Contributor

As part of the prep work I'm doing with @dgrove-oss to enable Dispatch, I've done some testing of compiling swift-corelibs-foundation with __HAS_DISPATCH__ enabled. That's highlighted a number of compile errors which this PR resolves.

Enabling __HAS_DISPATCH__ will still result in linker errors, which we'll look to resolve once we have the Dispatch overlay built into lib dispatch on Linux (libdispatch PR #43, and made the necessary modifications to the foundation build scripts.

@@ -850,9 +850,6 @@ CF_INLINE const char *CFPathRelativeToAppleFrameworksRoot(const char *path, Bool
#if (DEPLOYMENT_TARGET_MACOSX || DEPLOYMENT_TARGET_EMBEDDED || DEPLOYMENT_TARGET_EMBEDDED_MINI || DEPLOYMENT_TARGET_LINUX)
#if __HAS_DISPATCH__

#include <dispatch/dispatch.h>
#include <dispatch/private.h>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why don't we have /usr/local/include/dispatch/private.h? can we just pass across private header paths if it isn't installed into a staging sysroot?

and I am not certain that /usr/include/dispatch/dispatch.h missing is a good thing. If that is not actually missing then perhaps we should just move the private.h out only.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't have a dispatch/private.h on Linux so it needs to be removed (at least for now). There's also no direct need to reference dispatch/dispatch.h from CFInternal.h, but I'll, update to retain the reference.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a workaround for dispatch/private.h in the pending overlay pull requests. Basically it exploits the symlink that is made by configure from $(top_bindir)/tests/dispatch to $(top_srcdir)/private to allow an include of dispatch/private.h to succeed. Personally, I think this is a bit quirky, but it works (and is consistent with how the include of dispatch/private.h is made to work when compiling libdispatch's test cases on linux).

@seabaylea
Copy link
Contributor Author

Sorry, I realised I'd created the pull request from and old working branch in my repo. I've updated the PR with the correct changes.

The reference to dispatch/private.h in CFInternal.h has been removed as there isn't an equivalent on Linux. There may be a few issues we'll need to work through on linking though once @dgrove-oss gets his build changes in.

@seabaylea
Copy link
Contributor Author

Thanks @dgrove-oss . Given that the reference to private.h is still protected under __HAS_DISPATCH__ (which isn't enabled yet) then I'll revert to including dispatch/private.h as it won't cause a breakage out of the box, and will be ready for when your pending overlay pull requests come in.

@seabaylea
Copy link
Contributor Author

@phausler Changes made and commits squashed in place. Could you take another look?

@phausler
Copy link
Contributor

looks good to me

phausler added a commit that referenced this pull request Feb 11, 2016
Fix compilation issues with HAS_DISPATCH on Linux
@phausler phausler merged commit 6bdb074 into swiftlang:master Feb 11, 2016
@seabaylea
Copy link
Contributor Author

Thanks @phausler !

@seabaylea seabaylea deleted the runloop branch February 11, 2016 09:11
atrick pushed a commit to atrick/swift-corelibs-foundation that referenced this pull request Jan 12, 2021
[build-script] Remove hard-coded install prefix of /usr and pass it in instead
kateinoigakukun pushed a commit to kateinoigakukun/swift-corelibs-foundation that referenced this pull request Oct 11, 2023
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

Successfully merging this pull request may close these issues.

3 participants