Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SR-7801] Ubuntu developer snapshot requires Foundation for standard library symbols #4368

Closed
martinr448 opened this issue May 30, 2018 · 13 comments
Assignees

Comments

@martinr448
Copy link

Previous ID SR-7801
Radar rdar://problem/40650604
Original Reporter @martinr448
Type Bug
Status Closed
Resolution Done
Environment

Ubuntu 16.04, running under VirtualBox

Additional Detail from JIRA
Votes 0
Component/s LLDB for Swift
Labels Bug, 4.2Regression, Linux
Assignee @shahmishal
Priority Medium

md5: 20a7246232fbec5b362321af1a1ed528

Issue Description:

With the current developer snapshot for Ubuntu 16.04, symbols from the standard library are not found unless Foundation is imported first:

# cd swift-DEVELOPMENT-SNAPSHOT-2018-05-29-a-ubuntu16.04/
# usr/bin/swift
Welcome to Swift version 4.2-dev (LLVM 6a6f279fed, Clang 8c9b467e0e, Swift 1a317f4712). Type :help for assistance.
  1>  
  2> import Swift
  3>  
  4> print(1)
error: Couldn't lookup symbols:
  type metadata for Swift.Int
  Swift.print(_: Any..., separator: Swift.String, terminator: Swift.String) -> ()
  Swift._allocateUninitializedArray<A>(Builtin.Word) -> (Swift.Array<A>, Builtin.RawPointer)
  swift_bridgeObjectRelease
  default argument 1 of Swift.print(_: Any..., separator: Swift.String, terminator: Swift.String) -> ()
  default argument 2 of Swift.print(_: Any..., separator: Swift.String, terminator: Swift.String) -> ()
  swift_release
  type metadata for Any
  swift_retain

  4>  
  5> let a = min(1.0, 2.0)
a: Double = <extracting data from value failed>

error: Couldn't lookup symbols:
  protocol witness table for Swift.Double : Swift.Comparable in Swift
  type metadata for Swift.Double
  Swift.min<A where A: Swift.Comparable>(A, A) -> A

  5>  
  6> import Foundation
  7> print(1)
1
  8> let a = min(1.0, 2.0)
a: Double = 1
  9>

Tested with the swift-DEVELOPMENT-SNAPSHOT-2018-05-29-a-ubuntu16.04.tar.gz snapshot for Ubuntu 16.04.

The problem does not occur with swift-4.1.1:

# cd swift-4.1.1-RELEASE-ubuntu16.04/
# usr/bin/swift
Welcome to Swift version 4.1.1 (swift-4.1.1-RELEASE). Type :help for assistance.
  1>  
  2> print(1)
1
  3> let a = min(1.0, 2.0)
a: Double = 1
  4>  

Related discussion in the Swift forum: Ubuntu developer snapshot requires Foundation for print statement

@gottesmm
Copy link
Member

When this is resolved, it is important that an integration test is added to the swift-integration-testsuite:

https://github.com/apple/swift-integration-tests

Whoever fixes this, just follow the example of the import glibc test.

@jckarter
Copy link
Member

@swift-ci create

@dcci
Copy link
Mannequin

dcci mannequin commented May 30, 2018

Reduced (broken also on MacOS):

dtdebugger2:bin davide$ echo 'public func f() { print("patatino") }' > x.swift
dtdebugger2:bin davide$ ./swiftc -emit-library -emit-module -module-link-name x  x.swift
dtdebugger2:bin davide$ ../../lldb-macosx-x86_64/bin/lldb --repl="-I ."
Welcome to Swift version 4.2-dev (LLVM fb6c0e5a49, Clang 5bae8c2e73, Swift 1a317f4712). Type :help for assistance.
  1> import x
  2> f()
error: Couldn't lookup symbols:
  x.f() -> ()

@dcci
Copy link
Mannequin

dcci mannequin commented May 30, 2018

That's a different issue. In fact, this works on ToT:

$ ./build/Ninja-ReleaseAssert/lldb-linux-x86_64/bin/lldb --repl
Welcome to Swift version 4.2-dev (LLVM 3c04b0ea85, Clang 197a5d4e3b, Swift daeaaf8d91). Type :help for assistance.
  1> import Swift
  2> print(5)
5
  3> let a = min(1.0, 2.0)
a: Double = 1
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 16.04.1 LTS
Release:        16.04
Codename:       xenial

@dcci
Copy link
Mannequin

dcci mannequin commented May 30, 2018

Can you please try building a ToT version of swift and letting me know whether it's fixed?

Thanks!

(you can use. a cmdline like

@martinr448
Copy link
Author

Confirmed:

$ ./build/Ninja-ReleaseAssert/lldb-linux-x86_64/bin/lldb --repl
 Welcome to Swift version 4.2-dev (LLVM 58850e66ae, Clang 8c059b98e4, Swift cd5acad1b5). Type :help for assistance.
 1> print(5)
 5
 2> let a = min(1.0, 2.0)
 a: Double = 1
 3> print(a)
 1.0

@martinr448
Copy link
Author

Is the fix contained in the latest snapshot? I downloaded and extracted swift-DEVELOPMENT-SNAPSHOT-2018-06-05-a-ubuntu16.04, and still get the same error message as reported above.

@dcci
Copy link
Mannequin

dcci mannequin commented Jun 7, 2018

If this works on ToT, but it doesn't work on a snapshot generated from ToT, then the bug is probably in the way the snapshot is generated (I Think). @shahmishal, as you're responsible for these ,can you please take a look?

@martinr448
Copy link
Author

It does now work correctly with swift-DEVELOPMENT-SNAPSHOT-2018-08-10-a-ubuntu16.04, but the above problem still occurs with swift-4.2-DEVELOPMENT-SNAPSHOT-2018-08-10-a-ubuntu16.04.

@gottesmm
Copy link
Member

@martinr448 I am not sure if the fix can be cherry-picked into 4.2. friss (JIRA User). Your thoughts?

@gottesmm
Copy link
Member

This was cherry-picked into 4.2:

apple/swift-lldb#822

@gottesmm
Copy link
Member

@martinr448 can you check when another snapshot comes around that it works for you?

@martinr448
Copy link
Author

Works now, tested on Ubuntu 16.04 with

  • swift-DEVELOPMENT-SNAPSHOT-2018-08-15-a-ubuntu16.04

  • swift-4.2-DEVELOPMENT-SNAPSHOT-2018-08-15-a-ubuntu16.04

Thanks!

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@shahmishal shahmishal transferred this issue from apple/swift May 5, 2022
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants