google / swift

The Swift Programming Language
https://swift.org/
840 stars 66 forks source link

Update to use the Swift 5.1 standalone parser. #247

Closed allevato closed 5 years ago

allevato commented 5 years ago

This change also cleans up the generate-pipeline code by refactoring it into a few separate source files, since it was getting a bit unwieldy.

The current version of SwiftSyntax in use is 2019-05-13. There isn't a May 13 trunk snapshot; the May 12 one is compatible (macOS download link).

Once you've installed that snapshot, you'll need to set the TOOLCHAINS variable to the bundle ID of that toolchain in your environment before running any swift commands on the command line; e.g.,

TOOLCHAINS=org.swift.50201905121a swift build
TOOLCHAINS=org.swift.50201905121a swift package generate-xcodeproj
TOOLCHAINS=org.swift.50201905121a swift test --parallel  # this works now!
dabelknap commented 5 years ago

The formatter builds on Ubuntu 16.04, but it crashes when you attempt to run it:

Fatal error: Unexpectedly found nil while unwrapping an Optional value: file /home/dabelknap/swift/.build/checkouts/swift-syntax/Sources/SwiftSyntax/AtomicCounter.swift, line 42
Current stack trace:
0    libswiftCore.so                    0x00007fdcc8a9e6c0 swift_reportError + 50
1    libswiftCore.so                    0x00007fdcc8b0c7f0 _swift_stdlib_reportFatalErrorInFile + 115
2    libswiftCore.so                    0x00007fdcc8a3553e <unavailable> + 3614014
3    libswiftCore.so                    0x00007fdcc8a356b7 <unavailable> + 3614391
4    libswiftCore.so                    0x00007fdcc881530d <unavailable> + 1385229
5    libswiftCore.so                    0x00007fdcc8a09d48 <unavailable> + 3435848
6    libswiftCore.so                    0x00007fdcc88146d9 <unavailable> + 1382105
7    swift-format                       0x0000559efdae6497 <unavailable> + 2606231
8    swift-format                       0x0000559efdae6359 <unavailable> + 2605913
9    libpthread.so.0                    0x00007fdcc84b4a99 <unavailable> + 60057
10   libswiftCore.so                    0x00007fdcc8abebe0 swift_once + 95
11   swift-format                       0x0000559efdae6347 <unavailable> + 2605895
12   swift-format                       0x0000559efdae6329 <unavailable> + 2605865
13   swift-format                       0x0000559efdb49d7f <unavailable> + 3014015
14   swift-format                       0x0000559efdb49d12 <unavailable> + 3013906
15   swift-format                       0x0000559efdb4b326 <unavailable> + 3019558
16   swift-format                       0x0000559efdb4bc8d <unavailable> + 3021965
17   swift-format                       0x0000559efdb4e9d5 <unavailable> + 3033557
18   swift-format                       0x0000559efdb4fb9d <unavailable> + 3038109
19   swift-format                       0x0000559efd9c01f9 <unavailable> + 1401337
20   swift-format                       0x0000559efe0c6bea <unavailable> + 8768490
21   swift-format                       0x0000559efe0c8d00 <unavailable> + 8776960
22   swift-format                       0x0000559efe0c8760 <unavailable> + 8775520
23   libc.so.6                          0x00007fdcc6254740 __libc_start_main + 240
24   swift-format                       0x0000559efd931769 <unavailable> + 817001
Illegal instruction (core dumped)

I don't know if there is anything we can do about it since the crash is in SwiftSyntax.

allevato commented 5 years ago

I don't know if there is anything we can do about it since the crash is in SwiftSyntax.

Yeah, dlsym is returning NULL for the C helper function it's trying to load at runtime. I'm not sure why that's happening, but I'm going to go ahead and merge this because I don't think it's anything we're doing.