-
-
Notifications
You must be signed in to change notification settings - Fork 12.4k
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
libclang 6.0.1 (new formula) #30229
libclang 6.0.1 (new formula) #30229
Conversation
Provides a way to install libclang without installing the whole llvm bottle. It reduces build times and bottle sizes (~280 MB vs 1.3 GB). It avoids potential library conflicts when only libclang.dylib is required (see Homebrew#29699). Useful for building qt without downloading llvm (see Homebrew#29415).
The test code is taken from this gist. If possible, I would like @quarnster to authorize the use of his code in this repository and its potential release under the BSD-2-Clause license. Otherwise, we can stick with more traditional llvm-config based tests. |
P.S. I stripped the |
Given that we did not get an answer from the gist author, I changed the test block with a new code heavily adapted by myself and inspired by a code released under the MIT license. This eliminates any potential license issues. |
This is pretty amazing, thank you. I have limited HD space. I hope this gets merged! :) |
Some formulas that can be built and used with
|
@BrewTestBot test this please |
Is it possible for |
I'm leaning towards a 👍 here but I'll give it another day or two to let other maintainers discuss/comment as they wish to. The idea that 5/7 of the formulae that currently mandate a runtime |
IIRC |
Formula/libclang.rb
Outdated
fails_with :gcc | ||
("4.3".."4.6").each do |n| | ||
fails_with :gcc => n | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All those versions of GCC are very old and not carried by recent macOS and recent Homebrew anymore. Remove the whole block.
Formula/libclang.rb
Outdated
-DLLVM_INCLUDE_DOCS=OFF | ||
-DLLVM_TARGETS_TO_BUILD=all | ||
] | ||
args << "-DLIBOMP_ARCH=x86_64" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Inline all arguments below, no temporary args
variable. (I am surprised -DLIBOMP_ARCH=x86_64
is not auto-detected.)
clang_disposeIndex(index); | ||
return 0; | ||
} | ||
EOS |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we maybe trim down that example C source a bit?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
Formula/libclang.rb
Outdated
"libclangtest.cpp", "-o", "libclangtest" | ||
testresult = shell_output("./libclangtest sample.cpp") | ||
|
||
sorted_testresult = testresult.split("\n").sort.join("\n") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why split, sort, and join if the result is a single line?
My only concern is that the name is misleading… we’re not only installing libclang, but also an actual clang binary, and more |
Aye, fair comment 👍. Open to suggestions if anyone has anything. |
The name ' |
Personally I'm 👎 on this. It's annoying to have the extra disk space used but I don't think we should be optimising package management around disk space usage. Additionally, if you need to have something that depends on |
This new |
@fxcoudert
To be honest, I do not know if any of the existing formulas actually need llvm. I am on vacation at the moment and I only have my MacBook Air with me, so I tested only the formulas that I posted before. It might be that other formulas can be built and used with libclang instead of llvm, and there is a strong chance that none of the current formulas actually need full llvm. In any case, reducing the number of formulas that use llvm reduces also the number of users that need to install it, also reducing the probability that someone needs to have both libclang and llvm in their disk.
It's not just about disk space but also bandwidth and data usage, especially if llvm becomes a dependency of qt. |
To me that points to removing the option rather than adding a new, duplicated formula.
Currently that probability is 0% because there is no
The same argument applies. If you have a formula that does need to depend on LLVM and another that depends on this formula: you've just increased the disk, bandwidth and data usage for that user. |
Sorry this might be a stupid question but why is llvm the primary resource here and not a build dependency ? |
That's true, but the vast majority of users will save disk space, bandwidth, and data usage. Also, does anyone know if there is any Formula that currently needs the full |
I already mentioned #29469, where @ilovezfs did just that for now. Regardless, this involves/affects not just Qt's documentation, but
Maybe
Besides, @albertosottile has provided other examples for which a minimal Off-Topic Note Addition: Y'know, @sjackman and @DomT4 discussing the following…:
…reminds me of an old item on my to-do list that I still haven't gotten around to: experimenting with modularizing all of the LLVM suite's components into their own individual formulas in a personal tap. That can wait until after I've closed all my currently open Homebrew issues, though… |
Update on other formulas compatibility with libclang:
There are two other formulas with an optional About the name, I understand that libclang could appear confusing because a clang binary is included, even though I saw this name used by other parties for the same package (Qt in the first place). I like the proposed alternatives and I suggest also |
I apologize, I looked more carefully at sizes now that I am back at work and, apparently, I was comparing apples to oranges. While there is indeed a size reduction, is not as dramatic as I thought.
Looking only at those numbers, I have to agree with @MikeMcQuaid and concede that the size benefits alone do not justify the added hassle of maintaining two similar formulas. However, as mentioned before, In addition, I personally find quite puzzling that apparently none of the existing formulas need all the resources currently embedded in the |
Thanks for doing the research and being so open about this @albertosottile. I'm afraid as a result I definitely think it's worth closing this as-is.
Generally if this only applies to a few formulae we consider vendoring (e.g. using a
I'm afraid we're moving in exactly the opposite direction here: |
I think the best bet here is for you to create your own tap in which you maintain a stripped down/option heavy LLVM. Sorry! |
To be honest, I do not need a stripped down LLVM, personally. With this PR, I was trying to solve the issue experienced by |
There's absolutely no need to apologise @albertosottile; that you've done the research you have and it's all publicly documented is a genuinely useful contribution for future reference ❤️ |
Thanks for the hard work here @albertosottile. I appreciate the time you put into this, despite the end result. |
Provides a way to install just libclang without downloading and installing the whole llvm bottle.
It reduces build times and bottle sizes (270 MB vs 410 MB on Sierra).
Being keg-only it does not interfere with system or with full llvm installations.
It avoids potential library conflicts when only libclang.dylib and clang headers are required (see #29699).
Useful for building (and maybe using) qt and pyside without downloading llvm (see #29415).
brew install --build-from-source <formula>
, where<formula>
is the name of the formula you're submitting?brew audit --strict <formula>
(after doingbrew install <formula>
)?