Skip to content

[stdlib] Properly identify assert.h. #59987

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

Closed
wants to merge 1 commit into from

Conversation

3405691582
Copy link
Member

This should be qualified with GLIBC_INCLUDE_PATH, otherwise it will look
for assert.h relative to the modulemap file, which is likely not what was
intended.

Partially buildfixes OpenBSD and FreeBSD.

This should be qualified with GLIBC_INCLUDE_PATH, otherwise it will look
for assert.h relative to the modulemap file, which is likely not what was
intended.

Partially buildfixes OpenBSD and FreeBSD.
@3405691582
Copy link
Member Author

cc @egorzhdan

3405691582 added a commit to 3405691582/swift that referenced this pull request Jul 9, 2022
Bring drexin's FreeBSD support patch up to date with main. Resolved
conflicts in prior merge commit and made some minor buildfixes. Still
requires some other more general fixes outside this pr to have this build
properly at HEAD but have verified only this builds OK with those fixes
possibly TK including swiftlang#59987 on FreeBSD 12.3.

Note: I don't intend to support this platform as a priority.
3405691582 added a commit to 3405691582/swift that referenced this pull request Jul 9, 2022
Bring drexin's FreeBSD support patch up to date with main. Resolved
conflicts in prior merge commit and made some minor buildfixes. Still
requires some other more general fixes outside this pr to have this build
properly at HEAD but have verified only this builds OK with those fixes
possibly TK including swiftlang#59987 and bootstrapping disabled on FreeBSD 12.3.

Note: I don't intend to support this platform as a priority.
Copy link
Member

@finagolfin finagolfin left a comment

Choose a reason for hiding this comment

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

I don't know enough C modules to know why we're putting this here and not in SwiftGlibc.h, but this include path is definitely needed on Android too.

Copy link
Contributor

@egorzhdan egorzhdan left a comment

Choose a reason for hiding this comment

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

it will look for assert.h relative to the modulemap file, which is likely not what was
intended.

This was intended: the modulemap file is now injected into the Glibc include path (see getClangInvocationFileMapping), so the headers can be referenced directly from the modulemap.

This works by calling into Clang driver to extract include paths (clangToolchain.AddClangSystemIncludeArgs) and find the include path with Glibc. Perhaps Clang returns incorrect include paths on Android/OpenBSD?

I was actually going to remove GLIBC_INCLUDE_PATH from the build entirely to improve portability of the toolchains, I won't do that now to avoid breaking more of Android/OpenBSD, but I don't think we should accumulate more usages of it.

@finagolfin
Copy link
Member

Perhaps Clang returns incorrect include paths on Android/OpenBSD?

Yes, that change probably doesn't work when cross-compiling with the Android NDK- looking into it today- though it does work when building natively on Android itself.

I was actually going to remove GLIBC_INCLUDE_PATH from the build entirely to improve portability of the toolchains, I won't do that now to avoid breaking more of Android/OpenBSD, but I don't think we should accumulate more usages of it.

I agree with removing that path, once we figure this last issue out, and Android had already disabled the last use of it.

@finagolfin
Copy link
Member

It appears I was wrong to say this is needed on Android, as this line depends on #59846 working, and I had reverted that pull when natively building on Android earlier. After applying that pull again and testing locally, it turns out this pull is not needed on Android, and as you both discussed elsewhere, probably won't be needed on OpenBSD either once this mistake is corrected.

@egorzhdan
Copy link
Contributor

Awesome, thanks @buttaface for checking that!

@3405691582
Copy link
Member Author

OpenBSD still needs the underlying VFS changes to make this work, but that's another issue. I'll close this for now.

@3405691582 3405691582 closed this Jul 13, 2022
@finagolfin
Copy link
Member

OpenBSD still needs the underlying VFS changes to make this work

Does #59846 not work for you? It works for me when natively compiling on Android but not when cross-compiling with the NDK, going to look into why.

@3405691582
Copy link
Member Author

No -- this requires https://reviews.llvm.org/D129654 plus the isOSLinux() change.

@finagolfin
Copy link
Member

Got it, I don't think it passes the right include paths when cross-compiling, think it's remapping /usr/include instead of the Android NDK sysroot passed in with -sdk.

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