gradle / gradle-native

The home of Gradle's support for natively compiled languages
https://blog.gradle.org/introducing-the-new-cpp-plugins
Apache License 2.0
92 stars 8 forks source link

Investigate Absolute Paths in .swiftmodule files #131

Open eljobe opened 7 years ago

eljobe commented 7 years ago

swiftc emits some absolute paths in to the .swiftmodule files for executables it builds in both debug and release configurations.

For the full story on why this causes us problems when considering caching these outputs, read this email thread on the swift-evolution mailing list.

We need to answer two main questions:

  1. What would happen if we cached and reused these outputs even though they contain absolute paths?
  2. Is there a way to make the swiftc compiler generate relative paths instead?

So, far the only hopeful thing we've found is: https://github.com/apple/swift/blob/6607ff73ce7a039fe76e45e5870f21ce6b524f60/lib/Frontend/CompilerInvocation.cpp#L1178-L1179

eljobe commented 7 years ago

@lptr I think you might want to subscribe to this issue.

Everyone, it seems like Bazel is struggling with this same problem for C++ builds with clang: https://github.com/bazelbuild/bazel/issues/1000#issuecomment-285332074

There is an issue on the swift issue tracker here: https://bugs.swift.org/browse/SR-5694

It looks like we might not be able to solve this in any short order. I'm particularly interested in the general claim that using relative paths would break the lldb debugger. It's also interesting that the bazel team is talking about post-processing the compiler outputs just prior to caching to rewrite the paths.

eljobe commented 7 years ago

Oh, and the conversation has moved from the swift-evolution mailing list to the swift-dev mailing list. Seems like that's where the action is. https://lists.swift.org/pipermail/swift-dev/Week-of-Mon-20170911/005325.html