[swift-users] SwiftPM on Linux Failed

adelzhang at qq.com adelzhang at qq.com
Wed Aug 30 02:56:56 CDT 2017


Hi,

`swift build -v` output:

lsb_release -r
clang --version
which clang
/opt/swift/4.0-dev/usr/bin/swiftc --driver-mode=swift -L  
/opt/swift/4.0-dev/usr/lib/swift/pm/4 -lPackageDescription -swift-version  
4 -I /opt/swift/4.0-dev/usr/lib/swift/pm/4 -sdk /  
/home/vagrant/hello/Package.swift -fileno 5
error: manifest parse error(s):
/home/vagrant/hello/Package.swift:4:8: error:  no such module  
'PackageDescription'
import PackageDescription
        ^
`opt/swift/4.0-dev/usr/lib/swift/pm/4` directory has two files,  
libPackageDescription.so and PackageDescription.swiftmodule

The steps I have took:

1) [Success] Install dependencies , download swift binary release and  
verify thhe PGP signature.
`$ sudo apt-get install clang libicu-dev`

2) [Success] Extract the archive and add swift path to PATH in `.bashrc`
```
export SWIFT_HOME=/opt/swift/4.0-dev
export PATH="$SWIFT_HOME/usr/bin":"${PATH}"
```

3) [Failed][Solved] Try using the REPL, enter the expression 1 + 1
maybe encounter https://bugs.swift.org/browse/SR-2783, fixed by change  
permissions of CoreFoundation headers

4) [Failed][Solved] Try using the REPL, import Glibc
maybe encounter https://bugs.swift.org/browse/SR-5524, fixed by setting  
C_INCLUDE_PATH and CPLUS_INCLUDE_PATH

5) [Failed][Solved] `swift build` said clang version is too low
Add ppa http://apt.llvm.org/

```
sudo apt-get upgrade clang
```

And now
```
$ clang --version
clang --version
clang version 6.0.0-svn311088-1~exp1 (trunk)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
```

6) [Failed][no clue] `swift build` output no such module  
'PackageDescription'


在 Wed, 30 Aug 2017 01:59:39 +0800,Ankit Aggarwal  
<ankit_aggarwal at apple.com> 写道:

> Hey,
>
> Can you post the steps you followed to install the Swift toolchain?
>
> Also, can you post the output of:
> $ swift build -v
>
> Thanks!
>
> On Tue, Aug 29, 2017 at 8:14 PM, adelzhang via swift-users <
> swift-users at swift.org> wrote:
>
>>
>> Hi, everyone.
>>
>> Installing swift on linux is not that easy. Following
>> https://swift.org/getting-started/#using-the-package-manager  
>> instruction,
>> but `swift build` failed:
>>
>> ```
>> error: manifest parse error(s):
>> /home/vagrant/hello/Package.swift:4:8: error: no such module
>> 'PackageDescription'
>> import PackageDescription
>>        ^
>> ```
>>
>> I installed Swift 4.0
>>
>> ```
>> $swift version
>> Swift version 4.0-dev (LLVM 2dedb62a0b, Clang b9d76a314c, Swift  
>> 0899bd328a)
>> Target: x86_64-unknown-linux-gnu
>> ```
>>
>> Ubuntu 14.04 is running on VirtualBox using vagrant.
>>
>> ```
>> $lsb_release -a
>> No LSB modules are available.
>> Distributor ID: Ubuntu
>> Description:    Ubuntu 14.04.5 LTS
>> Release:        14.04
>> Codename:       trusty
>> ```
>>
>> Does someone happen to know the work-around?
>>
>> --
>> Regards
>>
>> adelzhang
>>
>>
>> _______________________________________________
>> swift-users mailing list
>> swift-users at swift.org
>> https://lists.swift.org/mailman/listinfo/swift-users
>>


-- 
Regards

--adel




More information about the swift-users mailing list