-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
'stddef.h' file not found #121
Comments
We are still trying to understand why this is happening, but we are aware of this. The only known workaround that we can recommend is to use the cpp-linter pkg manually via
and ensure the version of clang-tidy and/or clang-format is installed before using the |
Are you using the latest version of cpp-linter-action? Like v2 or v2.2.0 Could you please share your cpp-linter configuration here? |
Currently using @main, but V2 had the same issue. It's strange that one of my repos works fine with the linter while the other one gives this error. Repo with error has a submodule to the repo thag works and just a hello world file, so nothing exciting there |
I will try that in a bit. Any chance you have a GitHub action file I can CTRL + C ;) |
Its a bit old (untested for a few months), but it should still work with any runner on github: Try this code snippet in the README on master. You'll still have to tweak it for your project (obviously), but its a good start. |
Keep in mind that the Ubuntu runner already comes with v12 of clang tools, so you may only need the stuff specific to |
Thanks! Will try that one out. Just thinking, could it have something to do with git submodules? Because the referenced .h file is only used in one of my submodules. I tried to ignore the entire folder, but it didn't help sadly.. |
Like I said we've looked into it and got stumped. This problem has been reported from repos that don't use submodules. Our test repo also uses a submodule, but any submodule's path is automatically ignored by cpp-linter. It wouldn't make sense to tell cpp-linter to analyze someone else's repo that your using in your repo, although it could be done with the The problem that I see is that clang-tidy doesn't know where to find stddef.h when analyzing any header that includes it in the C std libs. The fact that this doesn't happen locally makes this problem hard to diagnose. |
Its not specific to Ubuntu runners either. Windows runners show the problem too. It does seem to happen with clang-tidy-12 more than others, but it still does happen with other clang-tidy versions. My best guess is that the runner's C std lib is not the version that clang-tidy was built for (??) 🤷🏼 |
We could be a bit more helpful if the repo was public and you provided a link. |
Sadly the repo is private and I am unable to make it public |
That's unfortunate here but understandable in the bigger picture. |
I think this issue should have been fixed in the latest release, #103 (comment) |
Please feel free to reopen if this problem still exists or you could provide your cpp-linter YAML config file. |
I am having the same issue of |
This still eludes me... I think it has something to do with certain versions of clang-tidy and the installed C std libs. A while back, I found a stackoverflow suggestion that recommended using the C std lib from LLVM project (instead of the OS-specific PPA), but I don't think that solution is the right approach here. |
@GewoonJaap did you find a fix for your private repository? Because with this error the cpp-linter is not really usable as it flags basically every file. @2bndy5 Additionally we have other problems with the linter. Multiple header files are not found, although the compiler does not have a problem with it and we do a complete build within the pipeline, so that the compile_commands.json can be used. Probably in correlation with this error, some functions are marked as "can be made static" which are already declared static in the corresponding header file. So there seems to be a general problem with finding the correct headers. Do you have any idea how to fix this? |
From the output of the above problematic job, it looks like cpp-linter-action doesn't use native binaries. Found a installed version of clang-format: 12.0.1 at /usr/lib/llvm-12/bin/clang-format
downloading clang-format (version 12)
Installing clang-format-12 to /home/runner/.local/bin/
symbolic link created /home/runner/.local/bin/clang-format
Found a installed version of clang-tidy: 12.0.1 at /usr/lib/llvm-12/bin/clang-tidy
downloading clang-tidy (version 12)
Installing clang-tidy-12 to /home/runner/.local/bin/
symbolic link created /home/runner/.local/bin/clang-tidy Try adding - name: Lint CPP
uses: cpp-linter/cpp-linter-action@v2
id: linter
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
style: file
tidy-checks: ''
version: '14'
files-changed-only: false
thread-comments: true
database: 'build/'
ignore: 'build | protobuf-3.15.8 | .github' |
TBH, our python script doesn't do anything special. It simply finds source files and feeds them to clang-format and/or clang-tidy. The problems you're reporting here sound more like problems with clang-tidy. Since I didn't author anything in the clang project, I can't confidently make any sound suggestions. It would be better to be able to reproduce this locally, but we've been unsuccessful on that front. That said, have you tried using a different version of clang-tidy?
You're PR covers so many files, its not good to assume that the problems are related. In fact, this is the first I'm hearing about this error. My first impression makes me think there's a discrepancy between the implementation file and the header, but IDK. We currently don't have a plan to support filtering the output captured from clang-tidy, and we cannot support using a special set of rules for certain files (which should be possible with multiple .clang-tidy config files).
Good catch @shenxianpeng ! If using the native v12 binary is desired, then the version option should specify |
Specifying to use clang version 14 did fix the stddef.h error! Thank you for the suggestion! The other errors remain, but I will try to replicate them offline. |
I'm closing this. Its worth opening a new issue to track the "could be made static" problem. |
I am trying to run the clang-tidy action however I am getting the following error:
I am not getting this error on my local PC or with any of my GH Actions build scripts, only the clang-tidy action throws this error. How to fix/ignore this?
The text was updated successfully, but these errors were encountered: