Skip to content

Conversation

@qiweiii
Copy link
Contributor

@qiweiii qiweiii commented Aug 22, 2025

There are inconsistency between debug and release build behavior (release build cannot pass tests), and disabling some optimization in release build makes it work

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

The changes introduce a workaround to fix the release build by disabling compiler optimizations. This will negatively impact performance and should be addressed by finding the root cause of the build failure rather than shipping unoptimized code.

# Build Swift release binary with our static libraries
swift build -c release \
swift build -c release -Xswiftc -Onone -Xswiftc -whole-module-optimization -Xswiftc -package-cmo -Xswiftc -unavailable-decl-optimization=complete \

Choose a reason for hiding this comment

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

Disabling Swift compiler optimizations with -Xswiftc -Onone for a release build is a significant concern. While it may resolve the immediate build failure, it will result in a binary with substantially worse performance. The underlying code or dependency issue that causes failures with optimization should be investigated and fixed, rather than shipping an unoptimized release artifact.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

WORKDIR /boka/Boka

RUN swift build -c release
RUN swift build -c release -Xswiftc -Onone -Xswiftc -whole-module-optimization -Xswiftc -package-cmo -Xswiftc -unavailable-decl-optimization=complete

Choose a reason for hiding this comment

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

Similar to the workflow change, this disables Swift compiler optimizations (-Onone) for the Docker release build. This will negatively impact the performance of the application running in the container. The root cause of the optimization-related build failure should be identified to allow for a properly optimized release build.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@qiweiii qiweiii marked this pull request as ready for review August 22, 2025 02:52
@qiweiii qiweiii requested a review from xlc August 22, 2025 02:53
@xlc xlc merged commit 668d64a into master Aug 22, 2025
3 of 4 checks passed
@xlc xlc deleted the fix-build branch August 22, 2025 08:57
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