This repository has been archived by the owner. It is now read-only.

clang-analyzer 262 (with scan-build alias) #11061

Closed
wants to merge 1 commit into
from

Conversation

Projects
None yet
9 participants
Contributor

goodell commented Mar 19, 2012

Provides the scan-build and scan-view tools.

Contributor

goodell commented Mar 19, 2012

Comments addressed by 30b4176.

The args can be "$@" now that I've changed it to bash. I've been writing too many autoconf macros and didn't think about just using a non-broken shell.

The auto-chmod feature is cool. I didn't realize it would do that.

Contributor

goodell commented Mar 26, 2012

Gentle bump. If you need me to squash those commits together or something like that, just let me know. I'm not 100% certain what the right etiquette/protocol is for history rewriting in a pull-request topic branch.

Contributor

jacknagel commented Mar 26, 2012

Yeah, squash them and force push to update the pull request.

clang-analyzer 262 (with scan-build alias)
Provides the scan-build and scan-view tools.
Contributor

goodell commented Mar 26, 2012

squashed into 1dba4aa (not sure if the push elicited a notification)

Contributor

2bits commented Mar 27, 2012

I'm still trying to learn about llvm. They offer a lot of programs. Would you explain how this is different from running

brew install --with-clang --analyzer llvm

Thanks. Also, your use of url 'http://bit.ly/xETQF0' is non-standard. You will likely be asked by the maintainers about that.

Contributor

goodell commented Mar 27, 2012

Hmm... I didn't see the --analyzer option when I checked things before creating this formula. One difference is that formula doesn't actually link correctly:

% brew install --with-clang --analyzer llvm
...
Warning: Non-executables were installed to "bin".
Installing non-executables to "bin" is bad practice.
The offending files are:
/usr/local/Cellar/llvm/3.0/bin/Resources
/usr/local/Cellar/llvm/3.0/bin/scanview.css
/usr/local/Cellar/llvm/3.0/bin/ScanView.py
/usr/local/Cellar/llvm/3.0/bin/sorttable.js
Error: The linking step did not complete successfully
The formula built, but is not symlinked into /usr/local
You can try again using `brew link llvm'

The main question now is whether there should be a separate formula to provide only the "scan-build" and "scan-view" tools independently from the LLVM package. IMO this would be nice, since I don't really want a source build of clang installed in /usr/local/bin that could conflict with my xcode version. But if my formula isn't of use to the broader community, that's fine too (it does what I need right now).

The bit.ly url is just the official distribution URL posted on the clang static analyzer website. I didn't bother to dereference it in the formula, but I easily could have. curl -I http://bit.ly/xETQF0 yields:

HTTP/1.1 301 Moved
Server: nginx
Date: Tue, 27 Mar 2012 18:51:05 GMT
Content-Type: text/html; charset=utf-8
Connection: keep-alive
Set-Cookie: _bit=4f720c19-0022b-02baf-411cf10a;domain=.bit.ly;expires=Sun Sep 23 18:51:05 2012;path=/; HttpOnly
Cache-control: private; max-age=90
Location: https://attache.apple.com/AttacheWeb/AttacheDownload?BUNDLEID=ATC-7ce71809-32d8-4783-95bc-ba23f7f83840
MIME-Version: 1.0
Content-Length: 194
Contributor

2bits commented Mar 27, 2012

Thanks for the info. I too got that warning message, but mine linked okay. You might have something subtle left over. Gist of my linking step: https://gist.github.com/2219335

I understand your concerns about clang being picked up. When it comes to Homebrew, it chooses the right one in /usr/bin even if I have another clang before that in my PATH. Not sure if that was your only worry.

I can't find that link on their website. What page is it on? Have you considered just using their nightly for MacOSX listed on here? http://clang-analyzer.llvm.org/installation.html After I downloaded that, it is a nice collection of everything needed, which seems to include the clang binary.

Contributor

jacknagel commented Mar 27, 2012

Note that clang will probably be removed from the LLVM formula at some point in the near future, so having this as a separate formula will be fine.

Contributor

goodell commented Mar 27, 2012

There appears to be a bit of confusion here.

My proposed clang-analyzer formula packages exactly the nightly Mac build from http://clang-analyzer.llvm.org/installation.html (my branch has 262, the website right now lists 263 via a different bit.ly URL). This package does contain a clang binary, but my formula intentionally does not install it into /usr/local in order to avoid any conflict with a system-installed clang. The scan-build script follows the symlinks back to where it's really installed and finds the correct clang binary to use for the static analysis step.

I don't have the time right now to figure out where the llvm --analyzer and clang-analyzer formulas conflict, but I'll look into it soon.

If clang ends up in separate package then we will still have a choice of whether this should be a totally separate package or if it should be part of that new clang package. I personally would still prefer to have an option of keeping my system largely uncontaminated by non-Apple clang builds.

Contributor

jacknagel commented Mar 27, 2012

Any separate clang package would not be part of Homebrew proper, but rather a formula in Homebrew-dupes. And no need to worry about where it conflicts with the current --analyzer option to the llvm formula, that would be removed also as it wouldn't make sense to build llvm and install the analyzer, but not build an accompanying clang.

Contributor

2bits commented Mar 27, 2012

@goodell Thanks for clearing that up. You download the nightly and keep clang in the cellar so that it doesn't get picked up in your PATH. That's reasonable considering the intention of the formula. Is it possible to craft something that's flexible enough to grab the latest version too, maybe using a devel block? That would be pretty handy and save you from updating the formula a lot.

Contributor

goodell commented Mar 27, 2012

@2bits I don't see any obvious way to do that, but I'm open to concrete suggestions. AFAICS there is no way to predict the URL of the regular snapshots (bit.ly or otherwise). The closest I can figure is to do source builds of clang and then munge the build process output to match the regular snapshot layout. Not really worth my time, frankly.

Contributor

2bits commented Mar 28, 2012

Right on. Off the top of my head I thought to curl that web page and grep for bit.ly and split at the " marks, but that's pretty weak.

Ping. :)
It'd be awesome if this could be integrated.

Contributor

tcurdt commented Jun 25, 2012

Ping. I also would like to have the analyzer "brewed". Is there still a confusion on how to do it?

Contributor

2bits commented Jun 26, 2012

@goodell Do you have time to update this formula to version 267? Maybe we can get it reviewed then.
@divyekapoor @tcurdt In the meantime have you tried brew install --with-clang --analyzer --HEAD llvm?
I think that would do what you want by building the latest scan-build and scan-view binaries.

Contributor

tcurdt commented Jun 26, 2012

@2bits I've just downloaded the clang analyzer manually. Felt like a better choice than going with a HEAD formula.
But indeed - would be great to get this updated and in.

Contributor

goodell commented Jun 26, 2012

@2bits: I'll try to find some time to update the formula this week. Hopefully someone will review it and definitively accept/reject it at that point so that I don't have to update it yet another time.

Contributor

2bits commented Jun 27, 2012

I think it can only help people. So I like this formula. At three months, your turn for review is imminent.

@ghost ghost assigned adamv Oct 14, 2012

Contributor

adamv commented Oct 14, 2012

Maintainers: any reason not to pull (a cleaned up) version of this into core? Or another repo? We either need to pull this or close it out with an explanation.

Owner

MikeMcQuaid commented Oct 14, 2012

Don't like the bit.ly. Is this just clang?

Contributor

mistydemeo commented Oct 14, 2012

Yes, let's use the real URL and not a shortened one.

Contributor

mistydemeo commented Oct 14, 2012

Also the url no longer works, shortened or not:

Unable to download file
The file cannot be downloaded as it has been deleted from the system.

(The real url is https://attache.apple.com/AttacheWeb/AttacheDownload?BUNDLEID=ATC-7ce71809-32d8-4783-95bc-ba23f7f83840)

Owner

MikeMcQuaid commented Oct 14, 2012

Odd URL. Isn't there a "real" upstream?

Contributor

mistydemeo commented Oct 14, 2012

http://clang-analyzer.llvm.org/ links to a bit.ly url, which is bizarre but there you go. It's another attache.apple.com url.

This makes me a little nervous that old versions just get deleted whenever a new version comes out, but I suppose they're not entirely alone in that.

Contributor

adamv commented Oct 15, 2012

Using the "real URL", the formula does not install cleanly for me. Will need an updated pull request to re-consider this.

@adamv adamv closed this Oct 15, 2012

@kavu kavu referenced this pull request Mar 5, 2014

Closed

Add clang-analyzer formula #27229

@xu-cheng xu-cheng locked and limited conversation to collaborators Feb 16, 2016

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.