swiftlang / swift

The Swift Programming Language
https://swift.org
Apache License 2.0
67.3k stars 10.34k forks source link

Linux compilation crash #72417

Open MahdiBM opened 5 months ago

MahdiBM commented 5 months ago

Description

Project fails to build on linux.

Reproduction

Try to compile this project anyhow you want, on any Swift version.

project-manager-cms-server.zip

The compilation seems to consistently fail with:

623.2 error: compile command failed due to signal 9 (use -v to see invocation)

Multiple people have tried compiling or cross-compiling the same project and no one has had success. See this thread in Vapor's Discord server for the full discussion.

Expected behavior

Compilation should go successfully.

Environment

Tested with on different environments. On EC2 instances or swift:5.10 image (not cross-compiling) and on a few different environments cross-compiling from Apple Silicon to amd.

I personally tried cross-compiling with Swift 5.10, on macOS 14.3 (or was it 14.2?) and Docker 4.27.1. Those seem to pretty much the latest as of writing this issue. Docker 4.28 seems to be out as well.

Additional information

No response

MahdiBM commented 5 months ago

(Reworked the issue to better point out the actual issue with the compilation)

finagolfin commented 5 months ago

Most people are not going to try building first. Cut and paste your error into the original post, which will help others searching for similar errors too.

MahdiBM commented 5 months ago

The error is in just that "compile failed with signal 9", nothing more. It just randomly prints that when building and stops the process.

finagolfin commented 5 months ago

OK, try building with swift build -v and see if that gives you any more info.

caiocs commented 5 months ago

Here is the docker log from the build:

docker_log.txt

caiocs commented 4 months ago

Any thoughts?

caiocs commented 2 months ago

Hi everyone,

Just wanted to let you know that I was able to resolve my issue. I used SwiftLint to review my code and one of the things it flagged was "files with too many lines." I never thought this would be an issue, as some of my files had up to 4k lines. I tried creating new files as extensions and limiting the size to no more than 500 lines per file. And like magic, the build went from 4 hours to 12 minutes on Linux. Thanks to everyone for the help!