I build Clang from sources to ensure I get the latest analysis tools and sanitizers. The tarballs I download are Clang Source Code, LLVM Source Code, Compiler-RT Source Code and LLDB Source Code. The LLVM Download Page also lists a Clang Tools Extra download.
What is in Clang Tools Extra tarball?
You can check it in the official documentation:
extra clang tools documentation
Related
I was experimenting with different compilers, build managers and IDEs for my new project in C++. I am using VSCode(v1.52) on a windows 10 machine. I installed VS build tools 2019 and also included C++ Clang Compiler for Windows and C++ Clang-cl for v142 build tools (x64/x86). The project uses CMake as build manager and a plug-in CMake tools have been installed as well. Setup works fine as it is now.
However, I just want to know what are the differences to include Clang compiler from VSCode build tools 2019 and from LLVM. Does Clang that comes with VSCode build tools uses its own headers or the headers from VS? I do not want to use if Clang uses headers from VS..!
VSCode build tools (C++ Clang tools for Windows) will link the Clang compiler with Microsoft implementation of the Standard Library
Also, VSCode build tools has a component called: "C++ Clang-cl for v142" that gives you the freedom of using your own Compiler/Settings
Regarding header files, on Windows you should use clang with either GCC (Open Source) or MSVC header files.
I could not find the exact source of the header files in VS Build tools. However, as said above, it will link the compiler with Microsoft STL.
To install Clang with GCC header files (Works on VsCode):
go to https://www.msys2.org/ and install mysys2
then open mysys2 terminal and copy those commands to install Clang:
pacman -S mingw-w64-x86_64-clang
pacman -S mingw-w64-x86_64-clang-tools-extra
dont forget to add \msys64\mingw64\bin to the SYSTEM PATH variable
I have also made a video, with step by step: https://youtu.be/5OSO8IRlyXc
In 16.0, the Intel C++ Compiler provided two compilers (one based on EDG, another based on Clang).
From the 16.0 documentation:
Using the Command Line
To invoke the compiler from the command line, use a command similar to
the following:
For C source files: icc my_source_file.c or icl my_source_file.c
For C++ source files: icpc my_source_file.cpp or icl++
my_source_file.cpp
Following successful compilation, the compiler creates an executable
file in the current directory.
icl/icl++ is a Clang-based front-end. You can use Clang options with this compiler. icc/icpc is an EDG-based front-end. You cannot use Clang options with icc/icpc.
But I'm not seeing a similar description now.
If Intel is using icl/icl++ to denote Clang-based front-end and icc/icpc to denote EDG-based front-end in 19.0 as well, then both these are available but on different platforms.
icc/icpc is available in Linux and macOS and icl is available in Windows.
From the documentation of 19.0:
Linux*:
Invoke the compiler using icc/icpc to compile C/C++ source files.
macOS*:
Invoke the compiler using icc/icpc to compile C/C++ source files.
Windows*:
You can invoke the IntelĀ® C++ Compiler on the command line using the
icl command.
In the current version for Linux, which is Intel oneAPI Base Toolkit for Linux 2021.1.8.1970, I could find clang, but neither icc nor icpc. So, just in case, I searched for ~/intel/oneapi/**/ic*(*) with zsh (i.e. executable files starting with ic, recursively), and found icx and icpx. The output of icx --help says "Intel(R) C++ Compiler Help" and still mentions the executables icc and icpc, so the executables have apparently been renamed, but Intel forgot to update the documentation.
One can see both ICC and ICX mentioned on: https://software.intel.com/content/www/us/en/develop/articles/oneapi-c-compiler-system-requirements.html
From llvm's site, I can dowload the prebuilt binary of LLVM 4.0. After having installed the prebuilt binary on Windows with Visual Studio 2017, I can easily switch the compiler between VC++ and Clang 4.0 via Platform Toolset options.
From Getting Started with the LLVM System using Microsoft Visual Studio, I can also build LLVM toolchain (result in many executables) on Windows. However, I don't know how to make a prebuilt installer and get the same effects as the official version provided.
Because llvm's site doesn't provide prebuilt binary for LLVM 5.0 (SVN), so I have to do it myself.
Is there a tutorial telling me how to build the installer of LLVM 5.0 (SVN) from LLVM's source code?
Thanks in advance.
==================
Why LLVM 5.0
The following C++17's features are available in LLVM 5.0 only:
Template argument deduction for class templates
constexpr lambda expressions
As a quick hack you can overwrite prebuilt binaries with those you've compiled. Or take a look at <LLVMInstallDir>/tools/msbuild directory, it contains bat scripts to install LLVM toolchain. You can alter and run them to add another toolchain that would use SVN versions.
You can use the Clang Power Tools extension to add any custom LLVM versions directly from Visual Studio. It comes with the latest LLVM version support(now its LLVM 11) and you can install any version you want from the extension settings panel.
To do that open CPT Settings -> select the LLVM Tab -> choose the version you want to install and press the install button. Now the setup is complete, no other configuration is needed.
This feature is better described in this blog post.
PS: I'm one of the developers of this extension and the project is open source.
I need to build KLEE on my Ubuntu 12.04. I followed KLEE website's instructions step by step. I had LLVM 2.9 built. But when I need to install klee-uclibc, and in the process of configuring, it complained that it failed to find a working LLVM bitcode compiler. Does this mean that my LLVM built was unsuccessful? I am new to Linux and new to the testing tool. Any help is greatly appreciated.
I ran into the same problem, but a closer look in klee document helped me fix it. Especially look at step (02)(01):
Install llvm-gcc:
Download and install the LLVM 2.9 release of llvm-gcc from here. On an x86-64 Linux platform you are going to need the archive LLVM-GCC 4.2 Front End Binaries for Linux x86-64.
Add llvm-gcc to your PATH. It is important to do this first so that llvm-gcc is found in subsequent configure steps. llvm-gcc will be used later to compile programs that KLEE can execute. Forgetting to add llvm-gcc to your PATH at this point is by far the most common source of build errors reported by new users.
Hence, make sure that llvm-gcc is installed and a PATH is provided to the executable.
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.