swiftlang / swift

The Swift Programming Language
https://swift.org
Apache License 2.0
67.67k stars 10.38k forks source link

[SR-5800] Ubuntu 14.04 with upgraded clang requires swiftdoc file to import a module #48370

Open aciidgh opened 7 years ago

aciidgh commented 7 years ago
Previous ID SR-5800
Radar rdar://problem/34188554
Original Reporter @aciidb0mb3r
Type Bug
Environment swift-DEVELOPMENT-SNAPSHOT-2017-08-21-a-ubuntu14.04
Additional Detail from JIRA | | | |------------------|-----------------| |Votes | 1 | |Component/s | Compiler | |Labels | Bug, Linux, Serialization | |Assignee | None | |Priority | Medium | md5: 741e76216c715a881c7f217db42ea78c

Issue Description:

Importing a module without its swiftdoc fails on Ubuntu 14.04 if clang is updated using apt-get. This doesn't happen on macOS or Ubuntu 16.04. This is what I did:

sudo apt-add-repository "deb http://llvm.org/apt/trusty/ llvm-toolchain-trusty-3.8 main"
sudo apt-get update
sudo apt-get install clang-3.8
sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-3.8 380
sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-3.8 380

This works on all platform:

touch hello.swift
echo "import hello" > main.swift
swiftc -module-name hello -emit-module -parse-as-library -c hello.swift
swiftc -I. main.swift 

This fails on Ubuntu 14.04 with clang from apt-get but works on Ubuntu 16.04/macOS:

rm -rf hello.swiftdoc
swiftc -I. main.swift 
main.swift:1:8: error: no such module 'hello'
import hello
       ^

The Package Manager does not ship swiftdoc file for the PackageDescription module in the toolchain, should it start doing so? What about the existing toolchains?

https://lists.swift.org/pipermail/swift-users/Week-of-Mon-20170828/006111.html

belkadan commented 7 years ago

1. It shouldn't fail.

  1. But you should be shipping the swiftdocs, because they have the doc comments.
belkadan commented 7 years ago

I can't see what this would have to do with the updated Clang, though.

aciidgh commented 7 years ago

I don't know why we never shipped doc file. @ddunbar is there a reason or should we just start doing that?

ddunbar commented 7 years ago

No good reason, let's start. Still seems like it might be worth understanding why this fails.

belkadan commented 7 years ago

Yep, would like to keep the bug open. Need to get my hands on a 14.04 system, though.

aciidgh commented 7 years ago

I used this image on vmware: http://releases.ubuntu.com/14.04/ubuntu-14.04.5-server-amd64.iso
Let me know if I can provide any other information. This could be very annoying for Swift 4 users on release.

aciidgh commented 7 years ago

Filed https://bugs.swift.org/browse/SR-5802 for the package manager.

belkadan commented 7 years ago

@swift-ci create