Closed dave-moser closed 2 years ago
attached is the output from the swift build in the Docker container if it is helpful. I do not see any specific error aws-sdk-iot-errors.txt .
Thanks for the detailed bug report. I did not try building on docker, but I tried compiling on an AL2 instance with swift tools 5.4.3 and I was able to get my project to compile.
Despite having the same version of Swift, I did have a couple differences in my dev environment:
platforms: [
.macOS(.v10_15), .iOS(.v13)
],
For your use case, is it critical that you build in a docker container, or would it be possible if you just work on an AL2 instance?
With regards to "why this doesn't work in a container" -- I suspect there is some difference in compiling within a container which makes the swift compiler "unhappy". For example, Dynamo's DynmaoDBClient.swift is 217kb, where IoT's client.swift is 770kb. Similarly, Dynamo's "Models.swift" file is 1.34MB while IoT's is at 3.52MB -- One theory is that swift isn't giving you an error because these files are just too large and swift is just segfaulting.
Let me know if running a container is critical to your application -- if so, i can try some to break up these files and see where things are failing.
Thanks fo looking into it. Using Docker for the builds is crucial. Most of the work we do is with Server Side Swift and developing on a Mac. For example, deploying Lambda functions to AWS. Using Docker is really the only practical way to compile the Swift code on your Mac for a deployment to AWS.
Thanks for the info John. I bumped the RAM allocated to Docker on my machine from the default of 2GB up to 4GB and the compile worked. Good to know. Thanks!
Description
Attempting to compile an SPM project using version 0.0.15 of the AWSSwiftSDK and adding the AWSIoT module. During the compile, an error is thrown stopping the compile. I am performing the compile on Linux in the swift:5.4.3-amazonlinux2 docker image. I built a similar project in Xcode and did NOT get an error. I was able to build.
Context
I am ultimately attempting to write a Lambda function in Swift that interacts with AWS IoT Core.
Environment
Reproduction Steps
Dockerfile FROM swift:5.4.3-amazonlinux2 as builder
RUN yum -y install git jq tar zip openssl-devel WORKDIR /build-lambda RUN mkdir -p /Sources/swift-lambda-function/ RUN mkdir -p /Tests/swift-lambda-function/ ADD /Sources/ ./Sources/ ADD /Tests/ ./Tests/ COPY Package.swift . RUN cd /build-lambda && swift package clean && swift build -c release
Observed Behavior
The compile throws an error. I do not see a specific error message. There are many warnings, though, regarding 'additionalMetricsToRetain' is deprecated: Use additionalMetricsToRetainV2.
It does not look like that is the error, but I do not see any specific error.
I have seen this in the past with prior reported compilation issues on Linux that were a segfault with not much info displayed.
If I change the dependency to something else like AWSDynamoDB, it compiles without error.
Expected Behavior
app should compile
Possible Solution