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

support building with swift static linux sdk #1785

Open
2 tasks
marcelo-paredes opened this issue Oct 9, 2024 · 1 comment
Open
2 tasks

support building with swift static linux sdk #1785

marcelo-paredes opened this issue Oct 9, 2024 · 1 comment
Labels
feature-request A feature should be added or improved.

Comments

@marcelo-paredes
Copy link

Describe the feature

building a project using the SDK with swift build --swift-sdk aarch64-swift-linux-musl will fail because aws-crt-swift/aws-common-runtime/aws-c-common/source/posix/system_info.c tries to include execinfo.h

After removing this manually, it fails again in .build/checkouts/smithy-swift/Sources/ClientRuntime/Networking/Http/CRT/CRTClientEngine.swift since it only checks for Glibc on Linux, which is not available using the static Linux SDK. When canImport(Musl), that should be imported instead.

#if canImport(Glibc)
    import Glibc
#elseif canImport(Musl)
    import Musl
#endif

Use Case

This is necessary to be able to build a binary using the aws swift sdk in a machine (running either Linux or macOS) and then install the binaries to be used in some other linux machine without the need of copying (possibly incompatible) dynamic libraries/shared objects along with it.

Proposed Solution

  • allow fort the system to not have execinfo.h
  • In swift files, also check for canImport(Musl), not only Glibc

both steps may have other consequences in code that requires Darwin or Glibc

Other Information

No response

Acknowledgements

  • I may be able to implement this feature request
  • This feature might incur a breaking change
@marcelo-paredes marcelo-paredes added feature-request A feature should be added or improved. needs-triage This issue or PR still needs to be triaged. labels Oct 9, 2024
@jbelkins
Copy link
Contributor

Hi @marcelo-paredes! Thanks for bringing this up. Until now, we hadn't really looked at statically-linked Linux binaries.

aws-crt-swift is maintained by a different team, their repo is at https://github.com/awslabs/aws-crt-swift . I suggest you file an issue there for the best response.

In the meantime, I'll start looking at this project and https://github.com/smithy-lang/smithy-swift to see what we can do to get statically linked binaries to work.

@sichanyoo sichanyoo removed the needs-triage This issue or PR still needs to be triaged. label Oct 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request A feature should be added or improved.
Projects
None yet
Development

No branches or pull requests

3 participants