这是indexloc提供的服务,不要输入任何密码
Skip to content

Distros other than Vanilla Ubuntu have some issues #118

@felix91gr

Description

@felix91gr

I'm on Elementary OS, an Ubuntu-based Linux. The Swift binaries compiled for Ubuntu 16.04 are fully compatible with it. But if using swiftenv, I get two results depending on how I install Swift:

swiftenv install N:

It first downloads the repos:

  • swift
  • swift-llvm
  • swift-clang
  • swift-lldb
  • swift-cmark
  • swift-llbuild
  • swift-package-manager
  • swift-compiler-rt
  • swift-corelibs-xctest
  • swift-corelibs-foundation
  • swift-corelibs-dispatch

Then proceeds to compile Swift:

Building Swift
This may take a very long time...

And after that when I run swift (to invoke the REPL), I get this error:

<unknown>:0: error: unable to load standard library for target 'x86_64-unknown-linux-gnu'
swift: /home/felix/.swiftenv/tmp/swiftenv-build-4.1/swift/include/swift/AST/Module.h:1193: swift::SourceFile &swift::ModuleDecl::getMainSourceFile(swift::SourceFileKind) const: Assertion `!Files.empty() && "No files added yet"' failed.
/home/felix/.swiftenv/versions/4.1/usr/bin/swift[0x3f259a4]
/home/felix/.swiftenv/versions/4.1/usr/bin/swift[0x3f25ce6]
/lib/x86_64-linux-gnu/libpthread.so.0(+0x11390)[0x7f0a50ae4390]
/lib/x86_64-linux-gnu/libc.so.6(gsignal+0x38)[0x7f0a4f009428]
/lib/x86_64-linux-gnu/libc.so.6(abort+0x16a)[0x7f0a4f00b02a]
/lib/x86_64-linux-gnu/libc.so.6(+0x2dbd7)[0x7f0a4f001bd7]
/lib/x86_64-linux-gnu/libc.so.6(+0x2dc82)[0x7f0a4f001c82]
/home/felix/.swiftenv/versions/4.1/usr/bin/swift[0x4dd35b]
/home/felix/.swiftenv/versions/4.1/usr/bin/swift[0x4dacb8]
/home/felix/.swiftenv/versions/4.1/usr/bin/swift[0x4c146c]
/home/felix/.swiftenv/versions/4.1/usr/bin/swift[0x4bf96c]
/home/felix/.swiftenv/versions/4.1/usr/bin/swift[0x478364]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf0)[0x7f0a4eff4830]
/home/felix/.swiftenv/versions/4.1/usr/bin/swift[0x475c19]
Stack dump:
0.	Program arguments: /home/felix/.swiftenv/versions/4.1/usr/bin/swift -frontend -repl -disable-objc-interop -color-diagnostics -module-name REPL 
fish: “swift” terminated by signal SIGABRT (Abort)

swiftenv install SWIFT_BINARIES_URL

After this happened, I decided to try again with a directed binary installation:

swiftenv install https://swift.org/builds/swift-4.1-release/ubuntu1604/swift-4.1-RELEASE/swift-4.1-RELEASE-ubuntu16.04.tar.gz
Downloading https://swift.org/builds/swift-4.1-release/ubuntu1604/swift-4.1-RELEASE/swift-4.1-RELEASE-ubuntu16.04.tar.gz
/tmp/swiftenv-4.1-RELEASE-felix ~
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  171M  100  171M    0     0  3648k      0  0:00:48  0:00:48 --:--:-- 5053k
~
4.1-RELEASE has been installed.
felix@felix-X550LD ~> swift
Welcome to Swift version 4.1 (swift-4.1-RELEASE). Type :help for assistance.
  1>  

Which works no problem 👍

What can be done

I think the best alternative is to build under non-ubuntu-based distros and figure out what's wrong with the build process that doesn't let it build or configure properly the Stdlib, s.t. they can actually use swiftenv.

And under ubuntu-based distros, having a way to tell what ubuntu are they based on. Then, proceeding to just install the binaries as if they were that particular ubuntu.

What I don't know

Does building work properly under vanilla Ubuntu? Maybe the stdlib gets properly built or configured iff that's the OS swiftenv is under.

Extras

I tested this both under Swift 4.0 and 4.1, to make sure it wasn't my 4.1 PR that made swiftenv fail.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions