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
Linuxbrew doesn't build an optimized LLVM (or potentially other CMake packages) #11455
Comments
Could you try doing |
On Linux? Sure. It'll take a while. I've been staring at the logs for LInux for some time if there is a question I can just answer in the interim. |
Yes. Ideally without your patch in chandlerc@578fe41, but the logs from when you applied that would help too. |
This is without that patched in: https://gist.github.com/chandlerc/457312cc1d86d78c5600ad9c5fbe1934 i'd like to remove it as soon as your done though, too many details in there for me to be comfortable leaving it up long-term. I can get one with my patch applied if it helps. But each time I have to remove my complier and wait for 20-30 minutes to rebuild everything, so its somewhat disruptive to get these. I can get one for Mac, but that took >2 hours last time. |
Thanks. I've downloaded a copy of it so you can take it offline. I'll delete it when I'm done having a look. |
Hmm, ok, one thing I can see from here is that superenv should be filtering brew/Library/Homebrew/shims/super/cc Lines 175 to 179 in eeef3f4
and then injecting a replacement ( brew/Library/Homebrew/shims/super/cc Line 274 in eeef3f4
for some reason, this isn't happening on Linux (but should be happening on Mac). I'll have a closer look to see if there are hints about why this is happening here... |
Yea I think applying chandlerc@578fe41 should be fine. Ideally, we should fix the issue with the compiler shim on Linux, as I think this also has consequences for non-CMake builds. However, I don't see the issue with relying more heavily on CMake's default CC @Bo98 |
The optimisation level is set here for Linux:
|
It might be that the code in |
Turned my test commit into a PR here: #11467 Let me know what else I should do to help this land. |
The original reason for that flag was to prevent CMake passing The change should be no-op in superenv. If it isn't then there's a bit of a bigger bug that needs solving. |
I think this is the case. |
It's probably because we use |
I don't think this is the problem, since it only affects Linux and not macOS. The |
Just to fully confirm, I could see the shims being used on macOS as well in the logs. |
Reopening this, as #11467 is only a partial solution specific to CMake builds. I think the compiler shims still need fixing on Linux. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. |
brew config
outputbrew doctor
outputbrew update
and am still able to reproduce my issue.brew doctor
and that did not fix my problem.What were you trying to do (and why)?
Installing LLVM (including Clang and libc++) for use in building C++ projects.
What happened (include all command output)?
The installation of LLVM, Clang, and all related tools are completely unoptimized.
Timing any significant build with the installed clang ran about 10x slower than expected.
What did you expect to happen?
The installed tools to be optimized.
This appears to be because CMake's default flags for release builds are overridden. Removing that fixes the issue. You can see what this looks like here:
chandlerc@578fe41
I'm happy to submit that as a pull request, but wanted to first check if this is the correct direction to take. I understand that Homebrew wants to override optimization levels in some cases, but it seems like the shims already provide the tools to do that, and removing these flags from CMake seems likely to leave ~all CMake built packages on Linux unoptimized.
Note that I did check that macOS is unaffected. Also it seems macOS is unaffected with the patch above applied.
Step-by-step reproduction instructions (by running
brew
commands)brew install llvm # compile some code with `clang++`, time it, observe it is slow on linux
The text was updated successfully, but these errors were encountered: