Hello! I'm new to Kythe and am exploring using it to index an iOS project composed of Objective-C & Swift. I'm starting with just the Objective-C code for now.For the Objective-C code, I'm having a hard time getting things to index fully. Below are some issues I encountered:
- There seems to be no equivalent to the cxx_extractor binary that works with Objective-C. I got a portion of it to work by forwarding `--ObjC` flags through various parts of the process while using the cxx_extractor but I'm guessing this is not the intended workflow.
- The Bazel Objc extractor isn't built along with //kythe/release. I was able to add it myself manually. If the maintainers are open to it I'd be happy to put this change into a pull request.
- While trying to use the Bazel Objc extractor I saw that any file that requires objc module support via "-fmodules" is skipped. Almost any iOS project requires module support. Is there information on why modules aren't supported and what it would take to support it?
- VFS overlays are not taken into account when indexing extracted compilations and therefore header and module imports fail to resolve.
I assume that Kythe is used internally for iOS repositories, so I'm wondering if there's some workflow that isn't publicized here or perhaps some documentation that I missed.Regards,Eric Amorde
--
You received this message because you are subscribed to the Google Groups "Kythe" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kythe+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/kythe/7e576bd7-11cf-4240-8867-5b53804dbd32n%40googlegroups.com.
> The C++ and Objective-C/C++ extractor are identical.
I can't recall exactly what issues I ran into here but it might be related to the binary hard-coding the cpp option here https://github.com/kythe/kythe/blob/7881f8fb2d7ddba79f9291c5e4b0a328f9a1a433/kythe/cxx/extractor/cxx_extractor_main.cc#L50I know the data ends up being recorded as cxx but the Bazel Objective-C extractor provides the objc value.> As Kythe generally requires a version of Clang which is close-ish to HEAD, the version used to build a given project is very rarely compatible with the version against which Kythe has been compiled.
Yes I did realize this and I suspect this is causing issues in my case. We are using the clang version included with Xcode which is much older than what Kythe expects. Does this mean that it's effectively not possible to run the Kythe extractors on an iOS codebase?
Re: VFS overlays - I don't yet understand why it doesn't work, but manually running the exact clang invocation provided in the compilation_commands.json works but when the cxx_extractor runs the same command (I also added some debugging prints to get the final arguments that Kythe provides to the clang tooling) it fails as if the VFS is not included.
To view this discussion on the web visit https://groups.google.com/d/msgid/kythe/8c12a0c4-0098-43be-a146-7e09bbd0b5b4n%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/kythe/bf651cab-a160-4428-8270-b3ef7bd65f8fn%40googlegroups.com.
I am getting some results but am frequently hitting errors during indexing. The errors are either:
- Unable to find a header
- Unable to find a module imported via `@import SomeModule;`
- Unable to find compiler built-ins and/or system frameworks like `Foundation` / `CoreFoundation`
There are other errors that seem to not actually affect the indexing but still get printed as an error. These are usually from running the clang tooling with arguments that it doesn't recognize when running in "analysis" mode via -fsyntax-only, such as -index-store-path andI've done a bunch of debugging with custom builds of the indexer + extractor to try to figure out where its going wrong. The exact arguments passed to the clang tooling invocation work correctly when run outside of Kythe. Some guesses as to what the issues might be:
- Mismatch of clang versions - our project currently builds using Xcode 15.1 which includes clang-1500.1.0.2.5. I'm not sure how a version mismatch would lead to the errors I'm seeing, however.
- VFS overlays - when I run into errors importing modules they are from our own code that uses VFS overlays to define frameworks and their headers. The arguments are picked up correctly by the extractor and passed through the indexer though.
- Execution directory mismatch. When compiling locally outside of Kythe Bazel runs clang inside its execution root which is something like `/tmp/some_id/execroot/repo_name`. I've noticed that some of our clang arguments pass "." as include paths, and our VFS overlays have "../../" directory traversals that appear to be relative to the execroot. I attempted to correct for this by running the indexer in the same execroot but that didn't seem to resolve anything.
> The exact objc extractor that is in the repository isn't used by us. We needed to make some minor tweaks to make it work in our environment. So I am not surprised that it did not work immediately.
Any plans to generalize the changes and merge them in? I suspect if you needed something custom maybe others would too :) Happy to help however I can, though I'm a Bazel and C++ novice. I've definitely got the local development environment setup for Kythe so I'm familiar enough to try tweaks on my own.
To view this discussion on the web visit https://groups.google.com/d/msgid/kythe/bc3c9ad5-adfb-47fa-a5af-440e5382ea0bn%40googlegroups.com.