Skip to content
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

clang-tidy broken with llvm v19.1.3 #196344

Open
4 tasks done
lukeshingles opened this issue Nov 1, 2024 · 6 comments
Open
4 tasks done

clang-tidy broken with llvm v19.1.3 #196344

lukeshingles opened this issue Nov 1, 2024 · 6 comments
Labels
bug Reproducible Homebrew/homebrew-core bug

Comments

@lukeshingles
Copy link
Contributor

lukeshingles commented Nov 1, 2024

brew gist-logs <formula> link OR brew config AND brew doctor output

https://gist.github.com/lukeshingles/b1477f4b5eaf327af99940ec848213b4

Verification

  • My brew doctor output says Your system is ready to brew. and am still able to reproduce my issue.
  • I ran brew update and am still able to reproduce my issue.
  • I have resolved all warnings from brew doctor and that did not fix my problem.
  • I searched for recent similar issues at https://github.com/Homebrew/homebrew-core/issues?q=is%3Aissue and found no duplicates.

What were you trying to do (and why)?

clang-tidy is no longer finding system headers since the llvm 19.1.3 update (#196094)

What happened (include all command output)?

$ clang-tidy helloworld.cpp
4 warnings and 1 error generated.
Error while processing /Users/luke/test/helloworld.cpp.
warning: -lunwind: 'linker' input unused [clang-diagnostic-unused-command-line-argument]
warning: argument unused during compilation: '-L/opt/homebrew/opt/llvm/lib' [clang-diagnostic-unused-command-line-argument]
warning: argument unused during compilation: '-L/opt/homebrew/opt/llvm/lib/c++' [clang-diagnostic-unused-command-line-argument]
warning: argument unused during compilation: '-L/opt/homebrew/opt/llvm/lib/unwind' [clang-diagnostic-unused-command-line-argument]
helloworld.cpp:1:10: error: 'iostream' file not found [clang-diagnostic-error]
    1 | #include <iostream>
      |          ^~~~~~~~~~
Found compiler error(s).

What did you expect to happen?

Using llvm 19.1.2 formula, the output is:

$ clang-tidy helloworld.cpp
4 warnings generated.
warning: -lunwind: 'linker' input unused [clang-diagnostic-unused-command-line-argument]
warning: argument unused during compilation: '-L/opt/homebrew/opt/llvm/lib' [clang-diagnostic-unused-command-line-argument]
warning: argument unused during compilation: '-L/opt/homebrew/opt/llvm/lib/c++' [clang-diagnostic-unused-command-line-argument]
warning: argument unused during compilation: '-L/opt/homebrew/opt/llvm/lib/unwind' [clang-diagnostic-unused-command-line-argument]

(Some warnings but no error finding <iostream>).

Step-by-step reproduction instructions (by running brew commands)

// helloworld.cpp
#include <iostream>

int main() {
  std::cout << "Hello World!";
  return 0;
}
pip install compiledb
compiledb make helloworld
clang-tidy helloworld.cpp
@lukeshingles lukeshingles added the bug Reproducible Homebrew/homebrew-core bug label Nov 1, 2024
@lukeshingles lukeshingles changed the title clang-tidy v19.1.3 broken clang-tidy broken with llvm v19.1.3 Nov 1, 2024
@lukeshingles
Copy link
Contributor Author

I get the same errors when I run clang-tidy from pip (latest version is 19.1.0) when brew llvm 19.1.3 is installed.

@carlocab
Copy link
Member

carlocab commented Nov 1, 2024

Oh, that's annoying. Looks like clang-tidy does not use Clang config files.

As a workaround, try

xcrun clang-tidy helloworld.cpp

@Congyuwang
Copy link

Congyuwang commented Nov 2, 2024

Similar problem, but with clang. With 19.1.3, clang can't find stuff like #include<string>.

Now I'll have to manually add --sysroot=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk for things to work.

I wonder if this is as expected. Or what is the right way to fix this system-header-missing problem?

@lukeshingles
Copy link
Contributor Author

lukeshingles commented Nov 2, 2024

For me, I didn’t have any problem compiling with clang++. Does my simple example compile?

@Congyuwang
Copy link

Congyuwang commented Nov 2, 2024

I am compiling with a rust-c++ program. Simple examples like this certainly won't have any problem. But I think it is quite improper to make such a potential breaking change, without any major versioning. Moreover, now you can brew install llvm@19 but not [email protected]. So there isn't even a simple way to rollback.

@carlocab
Copy link
Member

carlocab commented Nov 2, 2024

@Congyuwang, I can't reproduce your issue so I'll need to know:

  • the output of your brew config
  • the output of your brew doctor
  • the output of ls -la /Library/Developer/CommandLineTools
  • the exact steps needed to reproduce the failure you're seeing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Reproducible Homebrew/homebrew-core bug
Projects
None yet
Development

No branches or pull requests

3 participants