xcodebuild hits "error deserializing an individual record" when building XCTest w/ Foundation

(Brian Gesiak) #1

Hello all!

I've been stumped by a compiler assertion I'm hitting in
https://github.com/apple/swift-corelibs-xctest/pull/43, and was wondering
if anyone could offer some insight.

The pull request has swift-corelibs-xctest depend upon
swift-corelibs-foundation (I'll refer to these as XCTest and Foundation in
this email).

On Linux, this works like a dream. All it takes is linking Foundation when
building XCTest:

$ swiftc -emit-library path/to/XCTest.o \
    -L path/to/Foundation \
    -lswiftGlibc -lswiftCore -lFoundation -lm

On OS X, I use an Xcode workspace that includes XCTest.xcodeproj and
Foundation.xcodeproj. In the "Link Binary with Libraries" step, I link
SwiftFoundation.framework. However, when compiling the project I encounter
the following stack trace:

The problem appears to be in swift::ModuleFile::resolveCrossReference,
where an assertion is hit: "error deserializing an individual record".
Looking at the resolveCrossReference method, it appears error() is called
when a BitstreamCursor encounters an entry that is not a kind
of lvm::BitstreamEntry::Record. I guess there's some sort of malformed
bitcode getting generated somewhere?

This is about as far as I've gotten. I seem to recall a conversation in
in which people commented that Foundation is always built in Debug mode.
Could that be causing this?

Any advice would be much appreciated!

- Brian Gesiak