Description
Is it reproducible with SwiftPM command-line tools: swift build
, swift test
, swift package
etc?
- Confirmed reproduction steps with SwiftPM CLI. The description text must include reproduction steps with either of command-line SwiftPM commands,
swift build
,swift test
,swift package
etc.
Description
If you attempt to run swift test --sanitize
address in SPM on linux, you will get a number of linker errors where some of the shared objects, but the executables that load the shared objects are not built with asan and do not provide the address sanitizer linked into the executable.
Expected behavior
It should be possible to run the tests with the address sanitizer enabled.
Actual behavior
Test Case 'CFamilyTargetTestCase.testCLibraryWithSpaces' started at 2025-06-25 10:52:58.664 /home/ryan_mansfield/swift/swiftpm/Tests/FunctionalTests/CFamilyTargetTests.swift:40: error: CFamilyTargetTestCase.testCLibraryWithSpaces : XCTAssertNoThrow failed: threw error "executionFailure(underlying: terminated(1): /home/ryan_mansfield/swift/swiftpm/.build/x86_64-unknown-linux-gnu/debug/swift-package-manager --package-path /tmp/CFamilyTargets_CLibraryWithSpaces.UIl3sm/CFamilyTargets_CLibraryWithSpaces --configuration release --build-system native output: error: 'cfamilytargets_clibrarywithspaces': Invalid manifest (compiled with: ["/home/ryan_mansfield/swift-DEVELOPMENT-SNAPSHOT-2025-06-22-a-ubuntu22.04/usr/bin/swiftc", "-vfsoverlay", "/tmp/TemporaryDirectory.UqGjtV/vfs.yaml", "-L", "/home/ryan_mansfield/swift/swiftpm/.build/x86_64-unknown-linux-gnu/debug", "-lPackageDescription", "-Xlinker", "-rpath", "-Xlinker", "/home/ryan_mansfield/swift/swiftpm/.build/x86_64-unknown-linux-gnu/debug", "-swift-version", "4.2", "-I", "/home/ryan_mansfield/swift/swiftpm/.build/x86_64-unknown-linux-gnu/debug/Modules", "-package-description-version", "4.2.0", "-module-cache-path", "/home/ryan_mansfield/swift/swiftpm/.build/x86_64-unknown-linux-gnu/debug", "/tmp/CFamilyTargets_CLibraryWithSpaces.UIl3sm/CFamilyTargets_CLibraryWithSpaces/Package.swift", "-o", "/tmp/TemporaryDirectory.ZGy17L/cfamilytargets_clibrarywithspaces-manifest"]) error: link command failed with exit code 1 (use -v to see invocation) /home/ryan_mansfield/swift/swiftpm/.build/x86_64-unknown-linux-gnu/debug/libPackageDescription.so: error: undefined reference to '__asan_report_store4' /home/ryan_mansfield/swift/swiftpm/.build/x86_64-unknown-linux-gnu/debug/libPackageDescription.so: error: undefined reference to '__asan_handle_no_return' /home/ryan_mansfield/swift/swiftpm/.build/x86_64-unknown-linux-gnu/debug/libPackageDescription.so: error: undefined reference to '__asan_stack_malloc_4' /home/ryan_mansfield/swift/swiftpm/.build/x86_64-unknown-linux-gnu/debug/libPackageDescription.so: error: undefined reference to '__asan_stack_free_5' /home/ryan_mansfield/swift/swiftpm/.build/x86_64-unknown-linux-gnu/debug/libPackageDescription.so: error: undefined reference to '__asan_stack_malloc_5' /home/ryan_mansfield/swift/swiftpm/.build/x86_64-unknown-linux-gnu/debug/libPackageDescription.so: error: undefined reference to '__asan_memcpy' /home/ryan_mansfield/swift/swiftpm/.build/x86_64-unknown-linux-gnu/debug/libPackageDescription.so: error: undefined reference to '__asan_unregister_elf_globals' /home/ryan_mansfield/swift/swiftpm/.build/x86_64-unknown-linux-gnu/debug/libPackageDescription.so: error: undefined reference to '__asan_report_load1' /home/ryan_mansfield/swift/swiftpm/.build/x86_64-unknown-linux-gnu/debug/libPackageDescription.so: error: undefined reference to '__asan_report_store_n' /home/ryan_mansfield/swift/swiftpm/.build/x86_64-unknown-linux-gnu/debug/libPackageDescription.so: error: undefined reference to '__asan_stack_malloc_2' /home/ryan_mansfield/swift/swiftpm/.build/x86_64-unknown-linux-gnu/debug/libPackageDescription.so: error: undefined reference to '__asan_stack_malloc_0' /home/ryan_mansfield/swift/swiftpm/.build/x86_64-unknown-linux-gnu/debug/libPackageDescription.so: error: undefined reference to '__asan_stack_malloc_1' /home/ryan_mansfield/swift/swiftpm/.build/x86_64-unknown-linux-gnu/debug/libPackageDescription.so: error: undefined reference to '__asan_register_elf_globals' /home/ryan_mansfield/swift/swiftpm/.build/x86_64-unknown-linux-gnu/debug/libPackageDescription.so: error: undefined reference to '__asan_version_mismatch_check_v8' /home/ryan_mansfield/swift/swiftpm/.build/x86_64-unknown-linux-gnu/debug/libPackageDescription.so: error: undefined reference to '__asan_init' /home/ryan_mansfield/swift/swiftpm/.build/x86_64-unknown-linux-gnu/debug/libPackageDescription.so: error: undefined reference to '__asan_set_shadow_f5' /home/ryan_mansfield/swift/swiftpm/.build/x86_64-unknown-linux-gnu/debug/libPackageDescription.so: error: undefined reference to '__asan_allocas_unpoison' /home/ryan_mansfield/swift/swiftpm/.build/x86_64-unknown-linux-gnu/debug/libPackageDescription.so: error: undefined reference to '__asan_report_load4' /home/ryan_mansfield/swift/swiftpm/.build/x86_64-unknown-linux-gnu/debug/libPackageDescription.so: error: undefined reference to '__asan_report_store1' /home/ryan_mansfield/swift/swiftpm/.build/x86_64-unknown-linux-gnu/debug/libPackageDescription.so: error: undefined reference to '__asan_report_store8' /home/ryan_mansfield/swift/swiftpm/.build/x86_64-unknown-linux-gnu/debug/libPackageDescription.so: error: undefined reference to '__asan_alloca_poison' /home/ryan_mansfield/swift/swiftpm/.build/x86_64-unknown-linux-gnu/debug/libPackageDescription.so: error: undefined reference to '__asan_report_load8' /home/ryan_mansfield/swift/swiftpm/.build/x86_64-unknown-linux-gnu/debug/libPackageDescription.so: error: undefined reference to '__asan_memset' /home/ryan_mansfield/swift/swiftpm/.build/x86_64-unknown-linux-gnu/debug/libPackageDescription.so: error: undefined reference to '__asan_stack_malloc_3' /home/ryan_mansfield/swift/swiftpm/.build/x86_64-unknown-linux-gnu/debug/libPackageDescription.so: error: undefined reference to '__asan_option_detect_stack_use_after_return' clang: error: linker command failed with exit code 1 (use -v to see invocation) error: 'cfamilytargets_clibrarywithspaces': Invalid manifest (compiled with: ["/home/ryan_mansfield/swift-DEVELOPMENT-SNAPSHOT-2025-06-22-a-ubuntu22.04/usr/bin/swiftc", "-vfsoverlay", "/tmp/TemporaryDirectory.wRZ6Yn/vfs.yaml", "-L", "/home/ryan_mansfield/swift/swiftpm/.build/x86_64-unknown-linux-gnu/debug", "-lPackageDescription", "-Xlinker", "-rpath", "-Xlinker", "/home/ryan_mansfield/swift/swiftpm/.build/x86_64-unknown-linux-gnu/debug", "-swift-version", "4.2", "-I", "/home/ryan_mansfield/swift/swiftpm/.build/x86_64-unknown-linux-gnu/debug/Modules", "-package-description-version", "4.2.0", "-module-cache-path", "/home/ryan_mansfield/swift/swiftpm/.build/x86_64-unknown-linux-gnu/debug", "/tmp/CFamilyTargets_CLibraryWithSpaces.UIl3sm/CFamilyTargets_CLibraryWithSpaces/Package.swift", "-o", "/tmp/TemporaryDirectory.hu6gVY/cfamilytargets_clibrarywithspaces-manifest"]) error: link command failed with exit code 1 (use -v to see invocation) /home/ryan_mansfield/swift/swiftpm/.build/x86_64-unknown-linux-gnu/debug/libPackageDescription.so: error: undefined reference to '__asan_report_store4' /home/ryan_mansfield/swift/swiftpm/.build/x86_64-unknown-linux-gnu/debug/libPackageDescription.so: error: undefined reference to '__asan_handle_no_return' /home/ryan_mansfield/swift/swiftpm/.build/x86_64-unknown-linux-gnu/debug/libPackageDescription.so: error: undefined reference to '__asan_stack_malloc_4' /home/ryan_mansfield/swift/swiftpm/.build/x86_64-unknown-linux-gnu/debug/libPackageDescription.so: error: undefined reference to '__asan_stack_free_5' /home/ryan_mansfield/swift/swiftpm/.build/x86_64-unknown-linux-gnu/debug/libPackageDescription.so: error: undefined reference to '__asan_stack_malloc_5' /home/ryan_mansfield/swift/swiftpm/.build/x86_64-unknown-linux-gnu/debug/libPackageDescription.so: error: undefined reference to '__asan_memcpy' /home/ryan_mansfield/swift/swiftpm/.build/x86_64-unknown-linux-gnu/debug/libPackageDescription.so: error: undefined reference to '__asan_unregister_elf_globals' /home/ryan_mansfield/swift/swiftpm/.build/x86_64-unknown-linux-gnu/debug/libPackageDescription.so: error: undefined reference to '__asan_report_load1' /home/ryan_mansfield/swift/swiftpm/.build/x86_64-unknown-linux-gnu/debug/libPackageDescription.so: error: undefined reference to '__asan_report_store_n' /home/ryan_mansfield/swift/swiftpm/.build/x86_64-unknown-linux-gnu/debug/libPackageDescription.so: error: undefined reference to '__asan_stack_malloc_2' /home/ryan_mansfield/swift/swiftpm/.build/x86_64-unknown-linux-gnu/debug/libPackageDescription.so: error: undefined reference to '__asan_stack_malloc_0' /home/ryan_mansfield/swift/swiftpm/.build/x86_64-unknown-linux-gnu/debug/libPackageDescription.so: error: undefined reference to '__asan_stack_malloc_1' /home/ryan_mansfield/swift/swiftpm/.build/x86_64-unknown-linux-gnu/debug/libPackageDescription.so: error: undefined reference to '__asan_register_elf_globals' /home/ryan_mansfield/swift/swiftpm/.build/x86_64-unknown-linux-gnu/debug/libPackageDescription.so: error: undefined reference to '__asan_version_mismatch_check_v8' /home/ryan_mansfield/swift/swiftpm/.build/x86_64-unknown-linux-gnu/debug/libPackageDescription.so: error: undefined reference to '__asan_init' /home/ryan_mansfield/swift/swiftpm/.build/x86_64-unknown-linux-gnu/debug/libPackageDescription.so: error: undefined reference to '__asan_set_shadow_f5' /home/ryan_mansfield/swift/swiftpm/.build/x86_64-unknown-linux-gnu/debug/libPackageDescription.so: error: undefined reference to '__asan_allocas_unpoison' /home/ryan_mansfield/swift/swiftpm/.build/x86_64-unknown-linux-gnu/debug/libPackageDescription.so: error: undefined reference to '__asan_report_load4' /home/ryan_mansfield/swift/swiftpm/.build/x86_64-unknown-linux-gnu/debug/libPackageDescription.so: error: undefined reference to '__asan_report_store1' /home/ryan_mansfield/swift/swiftpm/.build/x86_64-unknown-linux-gnu/debug/libPackageDescription.so: error: undefined reference to '__asan_report_store8' /home/ryan_mansfield/swift/swiftpm/.build/x86_64-unknown-linux-gnu/debug/libPackageDescription.so: error: undefined reference to '__asan_alloca_poison' /home/ryan_mansfield/swift/swiftpm/.build/x86_64-unknown-linux-gnu/debug/libPackageDescription.so: error: undefined reference to '__asan_report_load8' /home/ryan_mansfield/swift/swiftpm/.build/x86_64-unknown-linux-gnu/debug/libPackageDescription.so: error: undefined reference to '__asan_memset' /home/ryan_mansfield/swift/swiftpm/.build/x86_64-unknown-linux-gnu/debug/libPackageDescription.so: error: undefined reference to '__asan_stack_malloc_3' /home/ryan_mansfield/swift/swiftpm/.build/x86_64-unknown-linux-gnu/debug/libPackageDescription.so: error: undefined reference to '__asan_option_detect_stack_use_after_return' clang: error: linker command failed with exit code 1 (use -v to see invocation) =================================================================
Steps to reproduce
On linux in the SPM directory, type swift test --sanitize address
Swift Package Manager version/commit hash
Swift & OS version (output of swift --version ; uname -a
)
$ swift --version; uname -a
Swift version 6.2-dev (LLVM 4197ac1672a278c, Swift acbdfef4f4d71b1)
Target: x86_64-unknown-linux-gnu
Build config: +assertions
Linux ThinkStation-06db 5.15.0-139-generic #149-Ubuntu SMP Fri Apr 11 22:06:13 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux