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

AwsCommonRuntimeKit depends on private headers from aws-c-http #291

Closed
jeffdav opened this issue Oct 3, 2024 · 4 comments
Closed

AwsCommonRuntimeKit depends on private headers from aws-c-http #291

jeffdav opened this issue Oct 3, 2024 · 4 comments
Labels
bug This issue is a bug. needs-triage This issue or PR still needs to be triaged.

Comments

@jeffdav
Copy link

jeffdav commented Oct 3, 2024

Describe the bug

AwsCommonRuntimeKit has a dependency on aws_http_stream:

build\debug\_deps\awscrtswift-src\Source\AwsCommonRuntimeKit\http\HTTPStream.swift:12:41: error: cannot find type 'aws_http_stream' in scope
10 |     var callbackData: HTTPStreamCallbackCore
11 |
12 |     init(rawValue: UnsafeMutablePointer<aws_http_stream>,
   |                                         `- error: cannot find type 'aws_http_stream' in scope
13 |          callbackData: HTTPStreamCallbackCore) {
14 |         self.callbackData = callbackData

This type is defined in:
aws-c-http\include\aws\http\private\request_response_impl.h

If you build aws-c-http using CMake, it does not install private headers. AwsCommonRuntimeKit is getting around this because the clang importer is slurping in all of the headers when you build with spm, since aws-c-http does not provide a modulemap.

Expected Behavior

Probably shouldn't depend on private headers.

Current Behavior

Definitely depends on private headers.

Reproduction Steps

Build aws-c-http with CMake then try to link it against AwsCommonRuntimeKit.

Possible Solution

I'm not familiar with the code, but the comments on the aws_http_stream definition imply its a base type. So use the derived types, or make the base type public in a consumable header?

Additional Information/Context

No response

aws-crt-swift version used

commit 60c0cf4acb617af5b7f5b67170f9fbf65fd2a382 (origin/main, origin/HEAD, main)

Compiler and Version used

compnerd.org Swift version 6.0-dev (LLVM a527f49f462b0d7, Swift eef85a7be270421) Target: x86_64-unknown-windows-msvc

Operating System and version

Windows 11 Version 23H2 Build 22631.4249

@jeffdav jeffdav added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Oct 3, 2024
@jeffdav
Copy link
Author

jeffdav commented Oct 3, 2024

Also aws_endpoints_request_context in aws-c-sdkutils/include/aws/sdkutils/private/endpoints_types_impl.h.

@waahm7
Copy link
Contributor

waahm7 commented Oct 3, 2024

It is defined in https://github.com/awslabs/aws-c-http/blob/main/include/aws/http/request_response.h#L24, which is in the public header. The actual definition of the struct is private, but we don't need that in crt-swift.

@DmitriyMusatkin
Copy link
Contributor

From quick check we are not relying on concrete types for either of those structures in swift. Swift is just interacting with the pointers to those types through apis exposed in public headers. And then any manipulation of the concrete type is done on crt side through the private header. This is a fairly common approach for c99, and should be fine with swift as well

@waahm7 waahm7 closed this as completed Oct 4, 2024
Copy link

github-actions bot commented Oct 4, 2024

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue is a bug. needs-triage This issue or PR still needs to be triaged.
Projects
None yet
Development

No branches or pull requests

3 participants