![[personal profile]](https://www.dreamwidth.org/img/silk/identity/user.png)
Появилась новая версия компилятора Swift. На маке с ним всё понятно, а здесь покажу как установить под Линуксом. Для определённости Ubuntu 24.04 x86_64.
После этого в файле ~/.bashrc устанавливаем алиас:cd /opt
wget https://download.swift.org/swift-6.0-release/ubuntu2404/swift-6.0-RELEASE/swift-6.0-RELEASE-ubuntu24.04.tar.gz
tar xf swift-6.0-RELEASE-ubuntu24.04.tar.gz
Проверяем:alias swift='/opt/swift-6.0-RELEASE-ubuntu24.04/usr/bin/swift'
Скомпилируем простейший пример:$ swift --version
Swift version 6.0 (swift-6.0-RELEASE)
Target: x86_64-unknown-linux-gnu
Глянем зависимости в бинарнике:$ cd ~
$ mkdir hello-swift
$ cd hello-swift
$ swift package init --type executable
Creating executable package: hello-swift
Creating Package.swift
Creating .gitignore
Creating Sources/
Creating Sources/main.swift
$ swift build
Building for debugging...
[8/8] Linking hello-swift
Build complete! (2.35s)
$ swift run
Building for debugging...
[1/1] Write swift-version-31DF0DBC1A6B63B8.txt
Build of product 'hello-swift' complete! (0.17s)
Hello, world!
Предыдущие посты про Swift:$ ldd .build/debug/hello-swift
linux-vdso.so.1 (0x00007ffdf2398000)
libswiftSwiftOnoneSupport.so => /opt/swift-6.0-RELEASE-ubuntu24.04/usr/lib/swift/linux/libswiftSwiftOnoneSupport.so (0x00007d08b5ee6000)
libswiftCore.so => /opt/swift-6.0-RELEASE-ubuntu24.04/usr/lib/swift/linux/libswiftCore.so (0x00007d08b5800000)
libswift_Concurrency.so => /opt/swift-6.0-RELEASE-ubuntu24.04/usr/lib/swift/linux/libswift_Concurrency.so (0x00007d08b5769000)
libswift_StringProcessing.so => /opt/swift-6.0-RELEASE-ubuntu24.04/usr/lib/swift/linux/libswift_StringProcessing.so (0x00007d08b568e000)
libswift_RegexParser.so => /opt/swift-6.0-RELEASE-ubuntu24.04/usr/lib/swift/linux/libswift_RegexParser.so (0x00007d08b557b000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007d08b5200000)
libstdc++.so.6 => /lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007d08b4e00000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007d08b546f000)
libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007d08b5442000)
/lib64/ld-linux-x86-64.so.2 (0x00007d08b5f33000)
libdispatch.so => /opt/swift-6.0-RELEASE-ubuntu24.04/usr/lib/swift/linux/libdispatch.so (0x00007d08b51a0000)
libswiftGlibc.so => /opt/swift-6.0-RELEASE-ubuntu24.04/usr/lib/swift/linux/libswiftGlibc.so (0x00007d08b5ecf000)
libBlocksRuntime.so => /opt/swift-6.0-RELEASE-ubuntu24.04/usr/lib/swift/linux/libBlocksRuntime.so (0x00007d08b5eca000)