Swift compiler building error after cloning the repo

Hi everyone,
I have some problems with building swift compiler
first i cloned the repo

git clone https://github.com/ziad-ashraf7/swift.git
cd swift

and then ran this command to install the dependencies

utils/update-checkout --clone-with-ssh

after that i ran this command to build the project

utils/build-script \
    --release \
    --debug-swift -j6

and after a while i got some error (and after getting these error the build is still continuing)

prefix/lib/libdispatch.so" to "$ORIGIN"
[1505/1688][ 89%][1923.545s] Linking CXX executable bin/swift-refactor
FAILED: bin/swift-refactor
....
/home/ziad/GSoC/Swift/swift/lib/ASTGen/Sources/ASTGen/StableHasher.swift:291: error: undefined reference to '$sSlss16IndexingIteratorVyxG0B0RtzrlE04makeB0ACyFSnySiG_Tg5'
/home/ziad/GSoC/Swift/swift/lib/ASTGen/Sources/ASTGen/StableHasher.swift:291: error: undefined reference to '$ss16IndexingIteratorV4next7ElementQzSgyFSnySiG_Tg5'
/home/ziad/GSoC/Swift/swift-experimental-string-processing/Sources/_RegexParser/Regex/Printing/DumpAST.swift:61: error: undefined reference to '$sSa5countSivgSS_Tg5'
/home/ziad/GSoC/Swift/swift-experimental-string-processing/Sources/_RegexParser/Regex/Printing/DumpAST.swift:62: error: undefined reference to '$sSayxSicigSS_Tg5'
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
[1506/1688][ 89%][1923.766s] Linking CXX executable bin/swift-ast-script
FAILED: bin/swift-ast-script
.....
/home/ziad/GSoC/Swift/swift/lib/ASTGen/Sources/ASTGen/StableHasher.swift:291: error: undefined reference to '$sSlss16IndexingIteratorVyxG0B0RtzrlE04makeB0ACyFSnySiG_Tg5'
/home/ziad/GSoC/Swift/swift/lib/ASTGen/Sources/ASTGen/StableHasher.swift:291: error: undefined reference to '$ss16IndexingIteratorV4next7ElementQzSgyFSnySiG_Tg5'
/home/ziad/GSoC/Swift/swift-experimental-string-processing/Sources/_RegexParser/Regex/Printing/DumpAST.swift:61: error: undefined reference to '$sSa5countSivgSS_Tg5'
/home/ziad/GSoC/Swift/swift-experimental-string-processing/Sources/_RegexParser/Regex/Printing/DumpAST.swift:62: error: undefined reference to '$sSayxSicigSS_Tg5'
clang++: error: linker command failed with exit code 1 (use -v to see invocation)

after getting these logs and errors , the build is not interrupted yet.
then at the end of it I got this last error


[#StrictMemorySafety]: <file:///home/ziad/GSoC/Swift/build/Ninja-ReleaseAssert+swift-DebugAssert/swift-linux-x86_64/share/doc/swift/diagnostics/strict-memory-safety.md>
ninja: build stopped: subcommand failed.
ERROR: command `['/home/ziad/GSoC/Swift/swift/utils/build-script-impl', '--workspace', '/home/ziad/GSoC/Swift', '--build-dir', '/home/ziad/GSoC/Swift/build/Ninja-ReleaseAssert+swift-DebugAssert', '--install-prefix', '/usr', '--host-target', 'linux-x86_64', '--stdlib-deployment-targets=linux-x86_64', '--host-cc', '/usr/bin/clang', '--host-cxx', '/usr/bin/clang++', '--darwin-xcrun-toolchain', 'default', '--darwin-deployment-version-osx=13.0', '--darwin-deployment-version-ios=16.0', '--darwin-deployment-version-tvos=16.0', '--darwin-deployment-version-watchos=6.0', '--darwin-deployment-version-xros=1.0', '--cmake', '/usr/bin/cmake', '--llvm-build-type', 'Release', '--swift-build-type', 'Debug', '--swift-stdlib-build-type', 'Release', '--lldb-build-type', 'Release', '--foundation-build-type', 'Release', '--libdispatch-build-type', 'Release', '--xctest-build-type', 'Release', '--llbuild-build-type', 'Release', '--swift-enable-assertions', 'true', '--swift-stdlib-enable-assertions', 'true', '--swift-analyze-code-coverage', 'false', '--llbuild-enable-assertions', 'true', '--lldb-assertions', 'true', '--cmake-generator', 'Ninja', '--cross-compile-append-host-target-to-destdir', 'true', '--build-jobs', '6', '--lit-jobs', '6', '--common-cmake-options=-G Ninja -DCMAKE_C_COMPILER:PATH=/usr/bin/clang -DCMAKE_CXX_COMPILER:PATH=/usr/bin/clang++ -DCMAKE_Swift_COMPILER:PATH=/usr/bin/swiftc -DCMAKE_LIBTOOL:PATH=/usr/bin/libtool -DCMAKE_AR:PATH=/usr/bin/ar -DCMAKE_RANLIB:PATH=/usr/bin/ranlib -DLLVM_VERSION_MAJOR:STRING=17 -DLLVM_VERSION_MINOR:STRING=0 -DLLVM_VERSION_PATCH:STRING=0 -DCLANG_VERSION_MAJOR:STRING=17 -DCLANG_VERSION_MINOR:STRING=0 -DCLANG_VERSION_PATCH:STRING=0 -DCMAKE_MAKE_PROGRAM=/usr/bin/ninja', '--build-args=-j6', '--dsymutil-jobs', '1', '--build-swift-libexec', 'true', '--swift-enable-backtracing', 'true', '--build-swift-clang-overlays', 'true', '--build-swift-remote-mirror', 'true', '--swift-source-dirname', 'swift', '--swift-cmake-options=-DCMAKE_EXPORT_COMPILE_COMMANDS=TRUE -DSWIFT_FORCE_OPTIMIZED_TYPECHECKER:BOOL=FALSE -DSWIFT_STDLIB_ENABLE_STDLIBCORE_EXCLUSIVITY_CHECKING:BOOL=FALSE -DSWIFT_ENABLE_EXPERIMENTAL_DIFFERENTIABLE_PROGRAMMING:BOOL=TRUE -DSWIFT_ENABLE_EXPERIMENTAL_CONCURRENCY:BOOL=TRUE -DSWIFT_ENABLE_EXPERIMENTAL_CXX_INTEROP:BOOL=TRUE -DSWIFT_ENABLE_CXX_INTEROP_SWIFT_BRIDGING_HEADER:BOOL=TRUE -DSWIFT_ENABLE_EXPERIMENTAL_DISTRIBUTED:BOOL=TRUE -DSWIFT_ENABLE_BACKTRACING:BOOL=TRUE -DSWIFT_ENABLE_EXPERIMENTAL_OBSERVATION:BOOL=TRUE -DSWIFT_ENABLE_SYNCHRONIZATION:BOOL=TRUE -DSWIFT_ENABLE_VOLATILE:BOOL=TRUE -DSWIFT_ENABLE_RUNTIME_MODULE:BOOL=TRUE -DSWIFT_STDLIB_STATIC_PRINT=FALSE -DSWIFT_FREESTANDING_IS_DARWIN:BOOL=FALSE -DSWIFT_STDLIB_BUILD_PRIVATE:BOOL=TRUE -DSWIFT_STDLIB_ENABLE_UNICODE_DATA=TRUE -DSWIFT_SHOULD_BUILD_EMBEDDED_STDLIB=TRUE -DSWIFT_SHOULD_BUILD_EMBEDDED_STDLIB_CROSS_COMPILING=FALSE -DSWIFT_STDLIB_BUILD_SYMBOL_GRAPHS:BOOL=FALSE -DSWIFT_TOOLS_LD64_LTO_CODEGEN_ONLY_FOR_SUPPORTING_TARGETS:BOOL=FALSE -DSWIFT_ENABLE_EXPERIMENTAL_PARSER_VALIDATION:BOOL=TRUE -USWIFT_DEBUGINFO_NON_LTO_ARGS -DSWIFT_ENABLE_NEW_RUNTIME_BUILD:BOOL=FALSE', '--build-stdlib-deployment-targets', 'all', '--ninja-bin=/usr/bin/ninja', '--install-destdir', '/home/ziad/GSoC/Swift/build/Ninja-ReleaseAssert+swift-DebugAssert/toolchain-linux-x86_64', '--skip-build-foundation', '--skip-build-xctest', '--skip-build-lldb', '--skip-build-llbuild', '--skip-build-libcxx', '--skip-build-libdispatch', '--skip-build-libxml2', '--skip-build-zlib', '--skip-build-curl', '--build-swift-dynamic-stdlib', '--build-swift-dynamic-sdk-overlay', '--skip-build-android', '--skip-test-swift', '--skip-test-lldb', '--skip-test-llbuild', '--skip-test-xctest', '--skip-test-foundation', '--skip-test-libdispatch', '--skip-test-benchmarks', '--android-deploy-device-path', '/data/local/tmp', '--host-libtool', '/usr/bin/libtool', '--extra-cmake-options=-USWIFT_DARWIN_SUPPORTED_ARCHS -DSWIFT_PATH_TO_SWIFT_SYNTAX_SOURCE:PATH=/home/ziad/GSoC/Swift/swift-syntax -DSWIFT_BUILD_SWIFT_SYNTAX:BOOL=TRUE -DSWIFTSYNTAX_ENABLE_ASSERTIONS:BOOL=TRUE -DSWIFT_EARLY_SWIFT_DRIVER_BUILD=/home/ziad/GSoC/Swift/build/Ninja-ReleaseAssert+swift-DebugAssert/earlyswiftdriver-linux-x86_64/debug/bin', '--llvm-lit-args=-sv --param color_output', '--llvm-install-components=llvm-ar;llvm-cov;llvm-profdata;IndexStore;clang;clang-resource-headers;compiler-rt;clangd;LTO;lld', '--musl-path=/usr/local/musl', '--linux-static-archs=x86_64;aarch64', '--only-execute', 'linux-x86_64-swift-build']` terminated with a non-zero exit status 1, aborting

and then the build has finished.
How to solve this error?

OS : Manjaro Linux
if you need any further information about the errors and my system please let me know.

Thank you in advance!

First thing that caught my eye was that you're using --clone-with-ssh for update-checkout even though you've cloned via HTTPS. Using just --clone would be the first thing I would try

I had some problem with cloning the with --clone
like this

So, I used --clone-with-ssh and i think it worked fine.

Hm, then maybe try cloning via SSH and continuing to use --clone-with-ssh just to rule out the possibility that this https/ssh mismatch isn't to blame for the error

okay I'll try it now , what do you think else will be the cause of the problem at the end?

Hi @janjan , i got the same errors

prefix/lib/libdispatch.so" to "$ORIGIN"
[1507/1689][ 89%][1757.472s] Linking CXX executable bin/swift-refactor
FAILED: bin/swift-refactor
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
[1508/1689][ 89%][1758.400s] Linking CXX executable bin/swift-ast-script
FAILED: bin/swift-ast-script
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
[1509/1689][ 89%][1774.386s] Linking CXX executable bin/swift-remoteast-test
FAILED: bin/swift-remoteast-test
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
[1510/1689][ 89%][2864.574s] Generating /home/ziad/GSoC/Swift/build/Ninja-Rele...6_64/lib/swift/embedded/Swift.swiftmodule/x86_64-unknown-linux-gnu.swiftmodule
<unknown>:0: warning: using (deprecated) legacy driver, Swift installation does not contain swift-driver at: '/home/ziad/GSoC/Swift/build/Ninja-ReleaseAssert+swift-DebugAssert/swift-linux-x86_64/bin/swift-driver-new'
/home/ziad/GSoC/Swift/swift/stdlib/public/core/NativeDictionary.swift:642:8: warning: expression uses unsafe constructs but is not marked with 'unsafe' [#StrictMemorySafety]
ninja: build stopped: subcommand failed.
ERROR: command `['/home/ziad/GSoC/Swift/swift/utils/build-script-impl', '--workspace', '/home/ziad/GSoC/Swift', '--build-dir', '/home/ziad/GSoC/Swift/build/Ninja-ReleaseAssert+swift-DebugAssert', '--install-prefix', '/usr', '--host-target', 'linux-x86_64', '--stdlib-deployment-targets=linux-x86_64', '--host-cc', '/usr/bin/clang', '--host-cxx', '/usr/bin/clang++', '--darwin-xcrun-toolchain', 'default', '--darwin-deployment-version-osx=13.0', '--darwin-deployment-version-ios=16.0', '--darwin-deployment-version-tvos=16.0', '--darwin-deployment-version-watchos=6.0', '--darwin-deployment-version-xros=1.0', '--cmake', '/usr/bin/cmake', '--llvm-build-type', 'Release', '--swift-build-type', 'Debug', '--swift-stdlib-build-type', 'Release', '--lldb-build-type', 'Release', '--foundation-build-type', 'Release', '--libdispatch-build-type', 'Release', '--xctest-build-type', 'Release', '--llbuild-build-type', 'Release', '--swift-enable-assertions', 'true', '--swift-stdlib-enable-assertions', 'true', '--swift-analyze-code-coverage', 'false', '--llbuild-enable-assertions', 'true', '--lldb-assertions', 'true', '--cmake-generator', 'Ninja', '--cross-compile-append-host-target-to-destdir', 'true', '--build-jobs', '6', '--lit-jobs', '6', '--common-cmake-options=-G Ninja -DCMAKE_C_COMPILER:PATH=/usr/bin/clang -DCMAKE_CXX_COMPILER:PATH=/usr/bin/clang++ -DCMAKE_Swift_COMPILER:PATH=/usr/bin/swiftc -DCMAKE_LIBTOOL:PATH=/usr/bin/libtool -DCMAKE_AR:PATH=/usr/bin/ar -DCMAKE_RANLIB:PATH=/usr/bin/ranlib -DLLVM_VERSION_MAJOR:STRING=17 -DLLVM_VERSION_MINOR:STRING=0 -DLLVM_VERSION_PATCH:STRING=0 -DCLANG_VERSION_MAJOR:STRING=17 -DCLANG_VERSION_MINOR:STRING=0 -DCLANG_VERSION_PATCH:STRING=0 -DCMAKE_MAKE_PROGRAM=/usr/bin/ninja', '--build-args=-j6', '--dsymutil-jobs', '1', '--build-swift-libexec', 'true', '--swift-enable-backtracing', 'true', '--build-swift-clang-overlays', 'true', '--build-swift-remote-mirror', 'true', '--swift-source-dirname', 'swift', '--swift-cmake-options=-DCMAKE_EXPORT_COMPILE_COMMANDS=TRUE -DSWIFT_FORCE_OPTIMIZED_TYPECHECKER:BOOL=FALSE -DSWIFT_STDLIB_ENABLE_STDLIBCORE_EXCLUSIVITY_CHECKING:BOOL=FALSE -DSWIFT_ENABLE_EXPERIMENTAL_DIFFERENTIABLE_PROGRAMMING:BOOL=TRUE -DSWIFT_ENABLE_EXPERIMENTAL_CONCURRENCY:BOOL=TRUE -DSWIFT_ENABLE_EXPERIMENTAL_CXX_INTEROP:BOOL=TRUE -DSWIFT_ENABLE_CXX_INTEROP_SWIFT_BRIDGING_HEADER:BOOL=TRUE -DSWIFT_ENABLE_EXPERIMENTAL_DISTRIBUTED:BOOL=TRUE -DSWIFT_ENABLE_BACKTRACING:BOOL=TRUE -DSWIFT_ENABLE_EXPERIMENTAL_OBSERVATION:BOOL=TRUE -DSWIFT_ENABLE_SYNCHRONIZATION:BOOL=TRUE -DSWIFT_ENABLE_VOLATILE:BOOL=TRUE -DSWIFT_ENABLE_RUNTIME_MODULE:BOOL=TRUE -DSWIFT_STDLIB_STATIC_PRINT=FALSE -DSWIFT_FREESTANDING_IS_DARWIN:BOOL=FALSE -DSWIFT_STDLIB_BUILD_PRIVATE:BOOL=TRUE -DSWIFT_STDLIB_ENABLE_UNICODE_DATA=TRUE -DSWIFT_SHOULD_BUILD_EMBEDDED_STDLIB=TRUE -DSWIFT_SHOULD_BUILD_EMBEDDED_STDLIB_CROSS_COMPILING=FALSE -DSWIFT_STDLIB_BUILD_SYMBOL_GRAPHS:BOOL=FALSE -DSWIFT_TOOLS_LD64_LTO_CODEGEN_ONLY_FOR_SUPPORTING_TARGETS:BOOL=FALSE -DSWIFT_ENABLE_EXPERIMENTAL_PARSER_VALIDATION:BOOL=TRUE -USWIFT_DEBUGINFO_NON_LTO_ARGS -DSWIFT_ENABLE_NEW_RUNTIME_BUILD:BOOL=FALSE', '--build-stdlib-deployment-targets', 'all', '--ninja-bin=/usr/bin/ninja', '--install-destdir', '/home/ziad/GSoC/Swift/build/Ninja-ReleaseAssert+swift-DebugAssert/toolchain-linux-x86_64', '--skip-build-foundation', '--skip-build-xctest', '--skip-build-lldb', '--skip-build-llbuild', '--skip-build-libcxx', '--skip-build-libdispatch', '--skip-build-libxml2', '--skip-build-zlib', '--skip-build-curl', '--build-swift-dynamic-stdlib', '--build-swift-dynamic-sdk-overlay', '--skip-build-android', '--skip-test-swift', '--skip-test-lldb', '--skip-test-llbuild', '--skip-test-xctest', '--skip-test-foundation', '--skip-test-libdispatch', '--skip-test-benchmarks', '--android-deploy-device-path', '/data/local/tmp', '--host-libtool', '/usr/bin/libtool', '--extra-cmake-options=-USWIFT_DARWIN_SUPPORTED_ARCHS -DSWIFT_PATH_TO_SWIFT_SYNTAX_SOURCE:PATH=/home/ziad/GSoC/Swift/swift-syntax -DSWIFT_BUILD_SWIFT_SYNTAX:BOOL=TRUE -DSWIFTSYNTAX_ENABLE_ASSERTIONS:BOOL=TRUE -DSWIFT_EARLY_SWIFT_DRIVER_BUILD=/home/ziad/GSoC/Swift/build/Ninja-ReleaseAssert+swift-DebugAssert/earlyswiftdriver-linux-x86_64/debug/bin', '--llvm-lit-args=-sv --param color_output', '--llvm-install-components=llvm-ar;llvm-cov;llvm-profdata;IndexStore;clang;clang-resource-headers;compiler-rt;clangd;LTO;lld', '--musl-path=/usr/local/musl', '--linux-static-archs=x86_64;aarch64', '--only-execute', 'linux-x86_64-swift-build']` terminated with a non-zero exit status 1, aborting

Do you have any suggested solutions ?

Any reason you are using --debug-swift? That flag is not tested much and has had regressions over the years. Unless you're really sure you need it for your work to have a Swift compiler frontend built in debug mode, you may be better off building with --release-debuginfo or one of the other build options to start off with.

Ok, so I believe the linker errors might be due to insufficient RAM on your system. That’s my guess, as I ran into the same issue when building with WSL on a machine with only 16GB. After switching to a Mac with 32GB, the debug build compiled without linker errors.

Do you really see error: undefined reference when running out of RAM? I don't think I've seen that.

That I do not recall, I do have a snippet of one of the linker errors from trying to debug the issue with someone in the past. The snippet did not include the undefined reference now that I look at it

(sharing as an image to avoid the horizontal scroll)

@Ashraf If you haven't already checked this out, The getting started guide explicitly states RAM requirements for different machines. If there is a mismatch, that would explain the linker errors

@janjan , I checked the RAM requirements and I have 16GB RAM on my machine.
the only mismatch is that I'm trying to build the repo on Manjaro Linux not macOS, Ubuntu Linux as the OS requirements says:
"Operating system: The supported operating systems for developing the Swift toolchain are: macOS, Ubuntu Linux LTS, and the latest Ubuntu Linux release. At the moment, Windows is not supported as a host development operating system."

so do you think that i should make a swap file to make it help the RAM and avoid the out of memory error?
Or the problem is that i use different OS from the supported ones.

You could give the first option a try (never tried so not too familiar with how that'd work), but I think changing the OS would likely be what you'd want to do

So do you think if I should change the OS to Ubuntu that i should work on it natively or i can use it with Docker? they already have some Dockerfiles for Ubuntu.
I'll try the swap file to give some help to the RAM, and if its not working I'll try the OS option.

I highly doubt it is the OS, if you got this far. People build the compiler and full toolchain on everything from BSD to Gentoo to Android, albeit likely without --debug-swift mostly. I'd try first without that flag, then only add it later if you need it.

for now i tried again with this flag --release-debuginfo
and got this error

[380/1689][ 22%][111.339s] Building swift module AST
<unknown>:0: warning: 'import_owned' swift attribute ignored on type 'vector': type is not copyable or destructible
[405/1689][ 23%][122.465s] Building swift module SIL
FAILED: SwiftCompilerSources/SIL.o /home/ziad/GSoC/Swift/build/Ninja-RelWithDebInfoAssert/swift-linux-x86_64/SwiftCompilerSources/SIL.o
cd /home/ziad/GSoC/Swift/swift/SwiftCompilerSources && /usr/bin/swiftc -c -o /home/ziad/GSoC/Swift/build/Ninja-RelWithDebInfoAssert/swift-linux-x86_64/SwiftCompilerSources/SIL.o -I /usr/bin/../lib -I /usr/lib -target x86_64-unknown-linux-gnu -module-name SIL -emit-module -emit-module-path /home/ziad/GSoC/Swift/build/Ninja-RelWithDebInfoAssert/swift-linux-x86_64/SwiftCompilerSources/SIL.swiftmodule -parse-as-library /home/ziad/GSoC/Swift/swift/SwiftCompilerSources/Sources/SIL/ApplySite.swift /home/ziad/GSoC/Swift/swift/SwiftCompilerSources/Sources/SIL/Argument.swift /home/ziad/GSoC/Swift/swift/SwiftCompilerSources/Sources/SIL/ASTExtensions.swift /home/ziad/GSoC/Swift/swift/SwiftCompilerSources/Sources/SIL/BasicBlock.swift /home/ziad/GSoC/Swift/swift/SwiftCompilerSources/Sources/SIL/Builder.swift /home/ziad/GSoC/Swift/swift/SwiftCompilerSources/Sources/SIL/DeclRef.swift /home/ziad/GSoC/Swift/swift/SwiftCompilerSources/Sources/SIL/Effects.swift /home/ziad/GSoC/Swift/swift/SwiftCompilerSources/Sources/SIL/ForwardingInstruction.swift /home/ziad/GSoC/Swift/swift/SwiftCompilerSources/Sources/SIL/Function.swift /home/ziad/GSoC/Swift/swift/SwiftCompilerSources/Sources/SIL/FunctionConvention.swift /home/ziad/GSoC/Swift/swift/SwiftCompilerSources/Sources/SIL/GlobalVariable.swift /home/ziad/GSoC/Swift/swift/SwiftCompilerSources/Sources/SIL/Instruction.swift /home/ziad/GSoC/Swift/swift/SwiftCompilerSources/Sources/SIL/Linkage.swift /home/ziad/GSoC/Swift/swift/SwiftCompilerSources/Sources/SIL/Location.swift /home/ziad/GSoC/Swift/swift/SwiftCompilerSources/Sources/SIL/Operand.swift /home/ziad/GSoC/Swift/swift/SwiftCompilerSources/Sources/SIL/Registration.swift /home/ziad/GSoC/Swift/swift/SwiftCompilerSources/Sources/SIL/SILStage.swift /home/ziad/GSoC/Swift/swift/SwiftCompilerSources/Sources/SIL/Type.swift /home/ziad/GSoC/Swift/swift/SwiftCompilerSources/Sources/SIL/Value.swift /home/ziad/GSoC/Swift/swift/SwiftCompilerSources/Sources/SIL/VTable.swift /home/ziad/GSoC/Swift/swift/SwiftCompilerSources/Sources/SIL/WitnessTable.swift /home/ziad/GSoC/Swift/swift/SwiftCompilerSources/Sources/SIL/Utilities/AccessUtils.swift /home/ziad/GSoC/Swift/swift/SwiftCompilerSources/Sources/SIL/Utilities/SequenceUtilities.swift /home/ziad/GSoC/Swift/swift/SwiftCompilerSources/Sources/SIL/Utilities/SmallProjectionPath.swift /home/ziad/GSoC/Swift/swift/SwiftCompilerSources/Sources/SIL/Utilities/WalkUtils.swift -wmo -color-diagnostics -Xfrontend -validate-tbd-against-ir=none -Xfrontend -disable-target-os-checking -Xcc -std=c++17 -Xcc -DCOMPILED_WITH_SWIFT -Xcc -DSWIFT_TARGET -Xcc -UIBOutlet -Xcc -UIBAction -Xcc -UIBInspectable -cxx-interoperability-mode=default -O -cross-module-optimization -Xcc -UNDEBUG -Xcc -I -Xcc /home/ziad/GSoC/Swift/llvm-project/llvm/include -Xcc -I -Xcc /home/ziad/GSoC/Swift/build/Ninja-RelWithDebInfoAssert/llvm-linux-x86_64/include -Xcc -I -Xcc /home/ziad/GSoC/Swift/llvm-project/clang/include -Xcc -I -Xcc /home/ziad/GSoC/Swift/build/Ninja-RelWithDebInfoAssert/llvm-linux-x86_64/tools/clang/include -Xcc -I -Xcc /home/ziad/GSoC/Swift/swift/include -Xcc -I -Xcc /home/ziad/GSoC/Swift/build/Ninja-RelWithDebInfoAssert/swift-linux-x86_64/SwiftCompilerSources/../include -I /home/ziad/GSoC/Swift/build/Ninja-RelWithDebInfoAssert/swift-linux-x86_64/SwiftCompilerSources
<module-includes>:1:10: note: in file included from <module-includes>:1:
1 | #include "swift/SIL/SILBridging.h"
  |          `- note: in file included from <module-includes>:1:
2 |

/home/ziad/GSoC/Swift/swift/include/swift/SIL/SILBridging.h:1298:10: note: in file included from /home/ziad/GSoC/Swift/swift/include/swift/SIL/SILBridging.h:1298:
1296 | // included in the header file. This is because they rely on C++ headers that
1297 | // we don't want to pull in when using "pure bridging mode".
1298 | #include "SILBridgingImpl.h"
     |          `- note: in file included from /home/ziad/GSoC/Swift/swift/include/swift/SIL/SILBridging.h:1298:
1299 | #endif
1300 |

/home/ziad/GSoC/Swift/swift/include/swift/SIL/SILBridgingImpl.h:32:10: note: in file included from /home/ziad/GSoC/Swift/swift/include/swift/SIL/SILBridgingImpl.h:32:
  30 | #include "swift/SIL/ApplySite.h"
  31 | #include "swift/SIL/InstWrappers.h"
  32 | #include "swift/SIL/SILBuilder.h"
     |          `- note: in file included from /home/ziad/GSoC/Swift/swift/include/swift/SIL/SILBridgingImpl.h:32:
  33 | #include "swift/SIL/SILDefaultWitnessTable.h"
  34 | #include "swift/SIL/SILFunctionConventions.h"

/home/ziad/GSoC/Swift/swift/include/swift/SIL/SILBuilder.h:23:10: note: in file included from /home/ziad/GSoC/Swift/swift/include/swift/SIL/SILBuilder.h:23:
  21 | #include "swift/SIL/SILFunction.h"
  22 | #include "swift/SIL/SILInstruction.h"
  23 | #include "swift/SIL/SILModule.h"
     |          `- note: in file included from /home/ziad/GSoC/Swift/swift/include/swift/SIL/SILBuilder.h:23:
  24 | #include "swift/SIL/SILUndef.h"
  25 | #include "llvm/ADT/PointerUnion.h"

/home/ziad/GSoC/Swift/swift/include/swift/SIL/SILModule.h:42:10: note: in file included from /home/ziad/GSoC/Swift/swift/include/swift/SIL/SILModule.h:42:
  40 | #include "swift/SIL/SILVTable.h"
  41 | #include "swift/SIL/SILWitnessTable.h"
  42 | #include "swift/SIL/TypeLowering.h"
     |          `- note: in file included from /home/ziad/GSoC/Swift/swift/include/swift/SIL/SILModule.h:42:
  43 | #include "llvm/ADT/ArrayRef.h"
  44 | #include "llvm/ADT/FoldingSet.h"

/home/ziad/GSoC/Swift/swift/include/swift/SIL/TypeLowering.h:16:10: note: in file included from /home/ziad/GSoC/Swift/swift/include/swift/SIL/TypeLowering.h:16:
  14 | #define SWIFT_SIL_TYPELOWERING_H
  15 |
  16 | #include "swift/ABI/ProtocolDispatchStrategy.h"
     |          `- note: in file included from /home/ziad/GSoC/Swift/swift/include/swift/SIL/TypeLowering.h:16:
  17 | #include "swift/AST/CaptureInfo.h"
  18 | #include "swift/AST/Module.h"

/home/ziad/GSoC/Swift/swift/include/swift/ABI/ProtocolDispatchStrategy.h:22:10: note: in file included from /home/ziad/GSoC/Swift/swift/include/swift/ABI/ProtocolDispatchStrategy.h:22:
20 | #define SWIFT_ABI_PROTOCOLDISPATCHSTRATEGY_H
21 |
22 | #include "swift/Basic/Unreachable.h"
   |          `- note: in file included from /home/ziad/GSoC/Swift/swift/include/swift/ABI/ProtocolDispatchStrategy.h:22:
23 | #include <cstdint>
24 |

/home/ziad/GSoC/Swift/swift/include/swift/Basic/Unreachable.h:36:10: note: in file included from /home/ziad/GSoC/Swift/swift/include/swift/Basic/Unreachable.h:36:
34 | #include <stdlib.h>
35 |
36 | #include "swift/Runtime/Config.h"
   |          `- note: in file included from /home/ziad/GSoC/Swift/swift/include/swift/Basic/Unreachable.h:36:
37 |
38 | SWIFT_RUNTIME_ATTRIBUTE_NORETURN SWIFT_ALWAYS_INLINE

/home/ziad/GSoC/Swift/swift/include/swift/Runtime/Config.h:179:10: error: 'swift/shims/Visibility.h' file not found
177 |
178 | // Bring in visibility attribute macros
179 | #include "swift/shims/Visibility.h"
    |          `- error: 'swift/shims/Visibility.h' file not found
180 |
181 | // Temporary definitions to allow compilation on clang-15.

/home/ziad/GSoC/Swift/swift/SwiftCompilerSources/Sources/SIL/ApplySite.swift:14:8: error: could not build C module 'SILBridging'
 12 |
 13 | import AST
 14 | import SILBridging
    |        `- error: could not build C module 'SILBridging'
 15 |
 16 | /// Argument conventions indexed on an apply's operand.
[410/1689][ 24%][231.479s] Linking Swift shared library lib/swift/host/compiler/lib_CompilerSwiftSyntax.so
ninja: build stopped: subcommand failed.
ERROR: command `['/home/ziad/GSoC/Swift/swift/utils/build-script-impl', '--workspace', '/home/ziad/GSoC/Swift', '--build-dir', '/home/ziad/GSoC/Swift/build/Ninja-RelWithDebInfoAssert', '--install-prefix', '/usr', '--host-target', 'linux-x86_64', '--stdlib-deployment-targets=linux-x86_64', '--host-cc', '/usr/bin/clang', '--host-cxx', '/usr/bin/clang++', '--darwin-xcrun-toolchain', 'default', '--darwin-deployment-version-osx=13.0', '--darwin-deployment-version-ios=16.0', '--darwin-deployment-version-tvos=16.0', '--darwin-deployment-version-watchos=6.0', '--darwin-deployment-version-xros=1.0', '--cmake', '/usr/bin/cmake', '--llvm-build-type', 'RelWithDebInfo', '--swift-build-type', 'RelWithDebInfo', '--swift-stdlib-build-type', 'RelWithDebInfo', '--lldb-build-type', 'RelWithDebInfo', '--foundation-build-type', 'RelWithDebInfo', '--libdispatch-build-type', 'RelWithDebInfo', '--xctest-build-type', 'RelWithDebInfo', '--llbuild-build-type', 'RelWithDebInfo', '--swift-enable-assertions', 'true', '--swift-stdlib-enable-assertions', 'true', '--swift-analyze-code-coverage', 'false', '--llbuild-enable-assertions', 'true', '--lldb-assertions', 'true', '--cmake-generator', 'Ninja', '--cross-compile-append-host-target-to-destdir', 'true', '--build-jobs', '6', '--lit-jobs', '6', '--common-cmake-options=-G Ninja -DCMAKE_C_COMPILER:PATH=/usr/bin/clang -DCMAKE_CXX_COMPILER:PATH=/usr/bin/clang++ -DCMAKE_Swift_COMPILER:PATH=/usr/bin/swiftc -DCMAKE_LIBTOOL:PATH=/usr/bin/libtool -DCMAKE_AR:PATH=/usr/bin/ar -DCMAKE_RANLIB:PATH=/usr/bin/ranlib -DLLVM_VERSION_MAJOR:STRING=17 -DLLVM_VERSION_MINOR:STRING=0 -DLLVM_VERSION_PATCH:STRING=0 -DCLANG_VERSION_MAJOR:STRING=17 -DCLANG_VERSION_MINOR:STRING=0 -DCLANG_VERSION_PATCH:STRING=0 -DCMAKE_MAKE_PROGRAM=/usr/bin/ninja', '--build-args=-j6', '--dsymutil-jobs', '1', '--build-swift-libexec', 'true', '--swift-enable-backtracing', 'true', '--build-swift-clang-overlays', 'true', '--build-swift-remote-mirror', 'true', '--swift-source-dirname', 'swift', '--swift-cmake-options=-DCMAKE_EXPORT_COMPILE_COMMANDS=TRUE -DSWIFT_FORCE_OPTIMIZED_TYPECHECKER:BOOL=FALSE -DSWIFT_STDLIB_ENABLE_STDLIBCORE_EXCLUSIVITY_CHECKING:BOOL=FALSE -DSWIFT_ENABLE_EXPERIMENTAL_DIFFERENTIABLE_PROGRAMMING:BOOL=TRUE -DSWIFT_ENABLE_EXPERIMENTAL_CONCURRENCY:BOOL=TRUE -DSWIFT_ENABLE_EXPERIMENTAL_CXX_INTEROP:BOOL=TRUE -DSWIFT_ENABLE_CXX_INTEROP_SWIFT_BRIDGING_HEADER:BOOL=TRUE -DSWIFT_ENABLE_EXPERIMENTAL_DISTRIBUTED:BOOL=TRUE -DSWIFT_ENABLE_BACKTRACING:BOOL=TRUE -DSWIFT_ENABLE_EXPERIMENTAL_OBSERVATION:BOOL=TRUE -DSWIFT_ENABLE_SYNCHRONIZATION:BOOL=TRUE -DSWIFT_ENABLE_VOLATILE:BOOL=TRUE -DSWIFT_ENABLE_RUNTIME_MODULE:BOOL=TRUE -DSWIFT_STDLIB_STATIC_PRINT=FALSE -DSWIFT_FREESTANDING_IS_DARWIN:BOOL=FALSE -DSWIFT_STDLIB_BUILD_PRIVATE:BOOL=TRUE -DSWIFT_STDLIB_ENABLE_UNICODE_DATA=TRUE -DSWIFT_SHOULD_BUILD_EMBEDDED_STDLIB=TRUE -DSWIFT_SHOULD_BUILD_EMBEDDED_STDLIB_CROSS_COMPILING=FALSE -DSWIFT_STDLIB_BUILD_SYMBOL_GRAPHS:BOOL=FALSE -DSWIFT_TOOLS_LD64_LTO_CODEGEN_ONLY_FOR_SUPPORTING_TARGETS:BOOL=FALSE -DSWIFT_ENABLE_EXPERIMENTAL_PARSER_VALIDATION:BOOL=TRUE -USWIFT_DEBUGINFO_NON_LTO_ARGS -DSWIFT_ENABLE_NEW_RUNTIME_BUILD:BOOL=FALSE', '--build-stdlib-deployment-targets', 'all', '--ninja-bin=/usr/bin/ninja', '--install-destdir', '/home/ziad/GSoC/Swift/build/Ninja-RelWithDebInfoAssert/toolchain-linux-x86_64', '--skip-build-foundation', '--skip-build-xctest', '--skip-build-lldb', '--skip-build-llbuild', '--skip-build-libcxx', '--skip-build-libdispatch', '--skip-build-libxml2', '--skip-build-zlib', '--skip-build-curl', '--build-swift-dynamic-stdlib', '--build-swift-dynamic-sdk-overlay', '--skip-build-android', '--skip-test-swift', '--skip-test-lldb', '--skip-test-llbuild', '--skip-test-xctest', '--skip-test-foundation', '--skip-test-libdispatch', '--skip-test-benchmarks', '--android-deploy-device-path', '/data/local/tmp', '--host-libtool', '/usr/bin/libtool', '--extra-cmake-options=-USWIFT_DARWIN_SUPPORTED_ARCHS -DSWIFT_PATH_TO_SWIFT_SYNTAX_SOURCE:PATH=/home/ziad/GSoC/Swift/swift-syntax -DSWIFT_BUILD_SWIFT_SYNTAX:BOOL=TRUE -DSWIFTSYNTAX_ENABLE_ASSERTIONS:BOOL=TRUE -DSWIFT_EARLY_SWIFT_DRIVER_BUILD=/home/ziad/GSoC/Swift/build/Ninja-RelWithDebInfoAssert/earlyswiftdriver-linux-x86_64/release/bin', '--llvm-lit-args=-sv --param color_output', '--llvm-install-components=llvm-ar;llvm-cov;llvm-profdata;IndexStore;clang;clang-resource-headers;compiler-rt;clangd;LTO;lld', '--musl-path=/usr/local/musl', '--linux-static-archs=x86_64;aarch64', '--only-execute', 'linux-x86_64-swift-build']` terminated with a non-zero exit status 1, aborting

Hmm, this isn't even getting as far as the previous flag: did you also update the source in the interim? I would stick with the latest trunk snapshot tag, currently swift-DEVELOPMENT-SNAPSHOT-2025-03-17-a, and not touch that source while you're trying various build flags.

What prebuilt host Swift compiler version are you building with? Does it have a /usr/lib/swift/shims/Visibility.h? The build appears to be looking there and doesn't find it.

@Finagolfin I think that the problem with the path , the Visability.h file is on this path
image
Not /usr/lib/swift/shims/Visibility.h .
what do you think could be the reason for this ?
i just installed Swift from the AUR package

paru -S swift-bin

The reason people use —debug-swift is because we tell them so in the GettingStarted.md.(docs/HowToGuides/GettingStarted.md).
It even promises a fruitful debugging experience.

I see two ways to get around this:

Option 1:
Keep —debug-swift stable

Option 2:
Remove —debug-swift from the guide.

What do you think about this? @Finagolfin

Not sure, but that seems an incorrect install, whether because of AUR itself or the way your distro is using it. You can compare the file layout in one of the official prebuilt toolchains for linux to see what it should be. If one of those runs on Manjaro, I recommend you use it instead for your host toolchain: just add it to your PATH and the trunk compiler build will pick it up.

I don't think I've used that flag in years myself, so no real opinion. It should probably have a sporadic CI that somebody looks at for these regressions, if that's what the problem is.

How about we have a full debug build on CI using all the debug flags which runs like once a week(sporadic)? @Finagolfin