Building a custom swift toolchain

Hi all,

I’m trying to build a custom swift toolchain (e.g. to try out @dynamicMemberLookup in playgrounds). I’ve got the toolchain to build and installed it and Xcode will pick it up. However, playgrounds isn’t working right and I’m getting these library validation errors in the console (also for libclang):

Library Validation failed: Rejecting ‘/Library/Developer/Toolchains/swift-LOCAL-2018-03-13-a.xctoolchain/usr/lib/sourcekitd.framework/Versions/A/sourcekitd’ (Team ID: none, platform: no) for process ‘Xcode(88611)’ (Team ID: none, platform: yes), reason: mapped file has no cdhash (unsigned or signature broken?)

I’m also getting file access sandbox violations in a trivial playground:

Sandbox: mdworker(46933) deny file-read-data /Users/clattner/Desktop/test.playground ()
Violation: deny file-read-data /Users/clattner/Desktop/test.playground ()
MetaData: {“build”:“Mac OS X 10.13.3 (17D47)”,“action”:“deny”,“target”:[“Users”,“clattner”,“Desktop”,“test.playground”],“note”:"",“hardware”:“Mac”,“platform_binary”:“yes”,“profile”:“unknown”,“process”:“mdworker”,“op”:“file-read-data”}

Are there some useful tips and tricks for how to debug this or what to do to fix this? Also, is there an environment variable or some other setting that I can use to get lldb to spit out its logging or other information? I’d really appreciate any advice on how to debug failures with open source swift toolchains,

Thanks!

-Chris

Of the top of my head, is this because Xcode will refuse to load non-Apple signed code due to library validation? Xcode is a platform binary and your custom toolchain’s binaries are not, so I don’t think it will let you load them.

Ok, I figured out how to get past code signing, by following these detailed instructions (thanks LLDB folks!). The problem now is that I have a toolchain that loads and seems like it is trying to work, but Playgrounds still just silently fails (a manual run never finishes). Is there any additional logging or other way to debug this? I probably broke something in the compiler code.

-Chris