erenon / bazel_clang_tidy

Run clang-tidy on Bazel C++ targets directly, efficiently, with caching enabled
MIT License
96 stars 51 forks source link

fails building targets using xcode sdkroot #60

Open joprice opened 4 months ago

joprice commented 4 months ago

When building mac or ios apps, the sysroot is set to the local xcode's directory via an identifier that gets replaced on the fly by bazel. Without this, I see errors like the following when running the clang tidy check:

error: no such sysroot directory: '__BAZEL_XCODE_SDKROOT__' [clang-diagnostic-missing-sysroot]

Unfortunately, it seems that this mechanism isn't exposed and from a few searches, I found many rules replicating the logic to discover the sdkroot such as the following: https://github.com/hedronvision/bazel-compile-commands-extractor/blob/204aa593e002cbd177d30f11f54cff3559110bb9/refresh.template.py#L758-L780