SwiftPM on Linux Failed

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

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@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@swift.org
https://lists.swift.org/mailman/listinfo/swift-users

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@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@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@swift.org
https://lists.swift.org/mailman/listinfo/swift-users

--
Regards

--adel

Thanks for the detailed info. I was able to reproduce this. There seems to be some problem with importing modules without their swiftdoc in Ubuntu 14.04. I've filed https://bugs.swift.org/browse/SR-5800

···

On 30-Aug-2017, at 1:26 PM, adelzhang@qq.com wrote:

export SWIFT_HOME=/opt/swift/4.0-dev
export PATH="$SWIFT_HOME/usr/bin":"${PATH}"

--
Ankit

It seems like the only way is upgrading to Ubuntu 16.04 for now?

···

在 Wed, 30 Aug 2017 18:09:53 +0800,Ankit Aggarwal <ankit_aggarwal@apple.com> 写道:

Thanks for the detailed info. I was able to reproduce this. There seems to be some problem with importing modules without their swiftdoc in Ubuntu 14.04. I've filed https://bugs.swift.org/browse/SR-5800

On 30-Aug-2017, at 1:26 PM, adelzhang@qq.com wrote:

export SWIFT_HOME=/opt/swift/4.0-dev
export PATH="$SWIFT_HOME/usr/bin":"${PATH}"

--
Ankit

--
Regards

--adel