The llvm-toolset-7 comes with clang 5 but i need to install software that is compatible only with clang 6+. How can i install a more recent clang?
You can download the llvm source here. Then follow these steps to build from source. llvm 6+ will include clang 6+.
Install the llvm-toolset-6.0.
Related
I've just got a MacOS 2 days ago with Mojave 10.14.5 and I was trying to install the latest Clang 12.0.0 but to no avail. I can't upgrade the OS to Catalina, so when I tried the XCode route I could only get the 13.1 version, with LLVM 10.0.1 and Clang-1001.0.46.4.
Then I followed this guide :
https://embeddedartistry.com/blog/2017/02/24/installing-llvm-clang-on-osx/
which was supposed to help me upgrade the llvm and clang through brew, and I successfully did it.
I got it up to LLVM 11.0.0 (I checked it out through "brew info llvm"), nonetheless when I use the command "clang --version", it still gives me:
Apple LLVM version 10.0.1 (clang-
1001.0.46.4)
Target: x86_64-apple-darwin18.6.0
Thread model: posix
InstalledDir:/Library/Developer/CommandLineTools/u
sr/bin
So I have 2 questions:
Did I miss something in the brew installation?
Is there another way to update to clang without the OS upgrade?
P.s
In the guide I couldn't do from the "Where to find llvm/clang" and downwards, since many of those commands weren't recognized by the terminal
Repost?
homebrew installs binaries into /usr/local/bin, so you normally need to put that at the start of your PATH:
export PATH=/usr/local/bin:$PATH
You can check which clang will be run when you type clang in your Terminal by running:
type clang
If that tells you clang is /usr/bin/clang or /Applications/anything or /Library/anything, that means it is supplied by Apple.
If it contains /usr/local/anything or /opt/anything, it is probably supplied by homebrew.
For hombrew problems, try asking the good doctor:
brew doctor
I have installed LLVM via brew on macOS with the below mentioned command:
brew install --with-toolchain llvm#3.9
I would like to use clang-tidy but some checks are missing, for example misc-string-compare.
What could be the problem?
As far as I can see, misc-string-compare was introduced in LLVM 4.0
I've installed clang-3.4.2-7.el7.x86_64.rpm on RHEL 7 and it came with llvm, but i couldn't find the scan-build utility.
I have already installed gcc and cmake and all other tools that are mentioned here But unfortunately i can't execute the scan-build commands.
BTW, I want to integrate it with Clang Scan-Build Plugin.
Am I missing something in the configuration?
It's in the package clang-analyzer
Clang analyzer doesn't get installed by default, to install it with the current version of LLVM 6.0 run:
yum install llvm-toolset-6.0-clang-analyzer
You may also want to install llvm-toolset-6.0-clang-tools-extra.
How to install Clang/LLVM 6 on RHEL has this and other details.
I'm trying to build a project which is originally written for archlinux. The building process works fine on that archlinux but has a huge amount of errors when I tried to build it on my mac. The project is basically written in C++11 so it's very unstable. I think there has something to do with the compiler because the clang version in mac is 4.2(It actually shows 'Apple LLVM version 4.2 (clang-425.0.28) (based on LLVM 3.2svn)' when I type clang --version) and 3.3 for linux. So I want a different version of clang, perhaps 3.3. How Can I specify the version of my compiler when trying to build the project?
Some might argue this belongs on apple.stackexchange.com, but I'm not sure C++11 tags grab a lot of attention there:)
Xcode 5.0 is now available from the App Store. Install it, go to Preferences -> Downloads, and install the Command Line Tools. However...
First, you will need to go to Preferences -> Accounts and add your Apple ID. For some reason, the Command Line Tools download requires an account login. I don't know what the rationale for this is.
> clang -v
Apple LLVM version 5.0 (clang-500.2.75) (based on LLVM 3.3svn)
If you are willing to build from the command line, using make for example (which sounds likely given the project is from Linux), then install Macports and install whatever version of clang you would like:
$sudo port install clang-3.1
$sudo clang_select
Note that this version of clang shouldn't interfere with the Xcode Command Line package if you are will to invoke the Xcode version using xcrun clang instead of plain old clang.
I'd like to build the latest version of gcc on a mac. I have the latest xcode but I'm looking for some of the c++0x features that are in more recent versions (the lambda functions, etc).
Are there any good step-by-step tutorials on doing this?
You should look at the Homebrew project.
Homebrew allows you to do things like this:
brew install gcc
Mac homebrew installation instructions are available here.
Add GCC support to a fresh Xcode 4.2 installation using this homebrew formula:
brew install https://raw.github.com/Homebrew/homebrew-dupes/master/apple-gcc42.rb
Upgrading from Xcode 4.1 doesn't drop existing GCC support, so this formula is only useful if you're working with a fresh 4.2+ installation.
One option is to install MacPorts and install the gcc46 package:
sudo port install gcc46
Another option is to download the source code and build it as follows:
tar xzvf gcc-4.6.0.tar.gz
cd gcc-4.6.0
./configure
make
Note that GCC 4.6.0 requires as prerequisites GMP 4.2+, MPFR 2.3.1+, and MPC 0.8.0+. If ./configure fails, it's probably because you're missing one of these (though it should give you a helpful error message in any case).
Building will take a while—likely several hours, depending on your hardware.
I would suggest building it yourself (Adam details how to do so). This will give you fine control on where to install and all the options you want to select. My experience from having multiple versions of gcc is that, if care is not taken apple's version of gcc can be damaged.
To speed up gcc installation you might want to look at --enable-languages option. If there are languages you don't need installed with the new gcc then you may not want to select them.