Skip to content

swift run build-swiftly-release fails if Static Linux SDK has already been installed #262

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
kkebo opened this issue Mar 27, 2025 · 2 comments

Comments

@kkebo
Copy link
Contributor

kkebo commented Mar 27, 2025

If the same Static Linux SDK has already been installed, swift run build-swiftly-release always fails.

Swift SDK bundle archive successfully downloaded from `https://download.swift.org/swift-6.0.3-release/static-sdk/swift-6.0.3-RELEASE/swift-6.0.3-RELEASE_static-linux-0.0.1.artifactbundle.tar.gz`.
Verifying if checksum of the downloaded archive is valid...
Downloaded archive has a valid checksum.
Swift SDK bundle at `https://download.swift.org/swift-6.0.3-release/static-sdk/swift-6.0.3-RELEASE/swift-6.0.3-RELEASE_static-linux-0.0.1.artifactbundle.tar.gz` is assumed to be an archive, unpacking...
Error: Swift SDK bundle with name `swift-6.0.3-RELEASE_static-linux-0.0.1.artifactbundle` is already installed. Can't install a new bundle with the same name.
Error: /home/kebo/.local/share/swiftly/toolchains/6.0.3/usr/bin/swift exited with non-zero status: 1

Full log:

$ swift --version ; uname -a
Swift version 6.0.3 (swift-6.0.3-RELEASE)
Target: aarch64-unknown-linux-gnu
Linux Raspberry-beetle 6.6.74+rpt-rpi-2712 #1 SMP PREEMPT Debian 1:6.6.74-1+rpt1 (2025-01-27) aarch64 GNU/Linux
$ swift sdk list
DEVELOPMENT-SNAPSHOT-2025-03-17-a-wasm32-unknown-wasi
swift-6.0.3-RELEASE_static-linux-0.0.1
$ swift run build-swiftly-release --skip 1.0.0-dev
warning: 'swift-algorithms': found 1 file(s) which are unhandled; explicitly declare them as resources or exclude from the target                                                        
    /home/kebo/swiftly/.build/checkouts/swift-algorithms/Sources/Algorithms/Documentation.docc                                                                                           
Building for debugging...                                                                                                                                                                
[507/507] Linking swift-openapi-generator-tool                                                                                                                                           
Build of product 'swift-openapi-generator' complete! (62.19s)                                                                                                                            
warning: 'swiftly': found 1 file(s) which are unhandled; explicitly declare them as resources or exclude from the target                                                                 
    /home/kebo/swiftly/Tools/build-swiftly-release/musl-clang                                                                                                                            
Building for debugging...                                                                                                                                                                
/home/kebo/swiftly/Tools/build-swiftly-release/BuildSwiftlyRelease.swift:299:29: warning: result of call to 'changeCurrentDirectoryPath' is unused                                       
297 |                                                                                                                                                                                    
298 |         let cwd = FileManager.default.currentDirectoryPath                                                                                                                         
299 |         FileManager.default.changeCurrentDirectoryPath(libArchivePath)                                                                                                             
    |                             `- warning: result of call to 'changeCurrentDirectoryPath' is unused                                                                                   
300 |                                                                                                                                                                                    
301 |         let swiftVerRegex: Regex<(Substring, Substring)> = try! Regex("Swift version (\\d+\\.\\d+\\.\\d+) ")                                                                       
                                                                                                                                                                                         
/home/kebo/swiftly/Tools/build-swiftly-release/BuildSwiftlyRelease.swift:360:29: warning: result of call to 'changeCurrentDirectoryPath' is unused                                       
358 |         try runProgram(make, "install")                                                                                                                                            
359 |                                                                                                                                                                                    
360 |         FileManager.default.changeCurrentDirectoryPath(cwd)                                                                                                                        
    |                             `- warning: result of call to 'changeCurrentDirectoryPath' is unused                                                                                   
361 |                                                                                                                                                                                    
362 |         try runProgram(swift, "build", "--swift-sdk", "\(arch)-swift-linux-musl", "--product=swiftly", "--pkg-config-path=\(pkgConfigPath)/lib/pkgconfig", "--static-swift-stdlib",
 "--configuration=release")                                                                                                                                                              
[59/59] Linking build-swiftly-release                                                                                                                                                    
Build of product 'build-swiftly-release' complete! (81.47s)                                                                                                                              
getent passwd                                                                                                                                                                            
/bin/bash -c which which                                                                                                                                                                 
getent passwd                                                                                                                                                                            
/bin/bash -c which curl                                                                                                                                                                  
getent passwd                                                                                                                                                                            
/bin/bash -c which which                                                                                                                                                                 
getent passwd                                                                                                                                                                            
/bin/bash -c which tar                                                                                                                                                                   
getent passwd                                                                                                                                                                            
/bin/bash -c which which                                                                                                                                                                 
getent passwd                                                                                                                                                                            
/bin/bash -c which make                                                                                                                                                                  
getent passwd                                                                                                                                                                            
/bin/bash -c which which                                                                                                                                                                 
getent passwd                                                                                                                                                                            
/bin/bash -c which git                                                                                                                                                                   
getent passwd                                                                                                                                                                            
/bin/bash -c which which                                                                                                                                                                 
getent passwd                                                                                                                                                                            
/bin/bash -c which strip                                                                                                                                                                 
getent passwd                                                                                                                                                                            
/bin/bash -c which which                                                                                                                                                                 
getent passwd                                                                                                                                                                            
/bin/bash -c which sha256sum                                                                                                                                                             
getent passwd                                                                                                                                                                            
/bin/bash -c which which                                                                                                                                                                 
getent passwd                                                                                                                                                                            
/bin/bash -c which swift                                                                                                                                                                 
/home/kebo/.local/share/swiftly/toolchains/6.0.3/usr/bin/swift package reset                                                                                                             
/usr/bin/curl -o /home/kebo/swiftly/.build/checkouts/libarchive-3.7.4.tar.gz --remote-name --location https://github.com/libarchive/libarchive/releases/download/v3.7.4/libarchive-3.7.4.
tar.gz                                                                                                                                                                                   
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current                                                                                                          
                                 Dload  Upload   Total   Spent    Left  Speed                                                                                                            
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0                                                                                                           
100 7464k  100 7464k    0     0  5592k      0  0:00:01  0:00:01 --:--:-- 11.6M                                                                                                           
Warning: Got more output options than URLs                                                                                                                                               
/usr/bin/sha256sum /home/kebo/swiftly/.build/checkouts/libarchive-3.7.4.tar.gz                                                                                                           
/usr/bin/tar --directory=/home/kebo/swiftly/.build/checkouts -xzf /home/kebo/swiftly/.build/checkouts/libarchive-3.7.4.tar.gz                                                            
/home/kebo/.local/share/swiftly/toolchains/6.0.3/usr/bin/swift --version                                                                                                                 
/usr/bin/curl https://www.swift.org/api/v1/install/releases.json                                                                                                                         
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current                                                                                                          
                                 Dload  Upload   Total   Spent    Left  Speed                                                                                                            
100 34754  100 34754    0     0  58007      0 --:--:-- --:--:-- --:--:-- 57923                                                                                                           
/home/kebo/.local/share/swiftly/toolchains/6.0.3/usr/bin/swift sdk install https://download.swift.org/swift-6.0.3-release/static-sdk/swift-6.0.3-RELEASE/swift-6.0.3-RELEASE_static-linux
-0.0.1.artifactbundle.tar.gz --checksum 67f765e0030e661a7450f7e4877cfe008db4f57f177d5a08a6e26fd661cdd0bd                                                                                 
Downloading a Swift SDK bundle archive from `https://download.swift.org/swift-6.0.3-release/static-sdk/swift-6.0.3-RELEASE/swift-6.0.3-RELEASE_static-linux-0.0.1.artifactbundle.tar.gz`.
..                                                                                                                                                                                       
                                                                                       Downloading                                                                                       
100% [======================================================================================================================================================================]            
Downloading swift-6.0.3-RELEASE_static-linux-0.0.1.artifactbundle.tar.gz                                                                                                                 
                                                                                                                                                                                         
Swift SDK bundle archive successfully downloaded from `https://download.swift.org/swift-6.0.3-release/static-sdk/swift-6.0.3-RELEASE/swift-6.0.3-RELEASE_static-linux-0.0.1.artifactbundl
e.tar.gz`.                                                                                                                                                                               
Verifying if checksum of the downloaded archive is valid...                                                                                                                              
Downloaded archive has a valid checksum.                                                                                                                                                 
Swift SDK bundle at `https://download.swift.org/swift-6.0.3-release/static-sdk/swift-6.0.3-RELEASE/swift-6.0.3-RELEASE_static-linux-0.0.1.artifactbundle.tar.gz` is assumed to be an arch
ive, unpacking...                                                                                                                                                                        
Error: Swift SDK bundle with name `swift-6.0.3-RELEASE_static-linux-0.0.1.artifactbundle` is already installed. Can't install a new bundle with the same name.                           
Error: /home/kebo/.local/share/swiftly/toolchains/6.0.3/usr/bin/swift exited with non-zero status: 1

swiftly release/1.0 branch 400e6a9

@cmcgee1024
Copy link
Member

The build script does make some assumptions here, one of them being that it has control over the installed SDK's. PR's are welcome to make it more resilient when running on a dev machine where things like an SDK is already installed.

In retrospect, I believe that there is a way that one can pass a untarred SDK path directly to swift build and maybe that's the way that this script should work so that it doesn't impact the user's environment.

@xtremekforever
Copy link

In retrospect, I believe that there is a way that one can pass a untarred SDK path directly to swift build and maybe that's the way that this script should work so that it doesn't impact the user's environment.

FYI, you can pass --swift-sdks-path to the swift build invocation to tell it where your Swift SDKs are at. So if you download the static SDK locally in some temp folder, you can do:

swift build --swift-sdks-path /path/to/tmp/directory --swift-sdk <arch>-swift-linux-musl

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

No branches or pull requests

3 participants