clang 4.0 installation

Hi Don,

Thanks for the reply.

I need to compile clang 4.0 in our environment. Below are the requested details.

$uname -a

Linux oulng127.emea.nsn-net.net 3.10.0-327.el7.x86_64 #1 SMP Thu Oct 29 17:29:29 EDT 2015 x86_64 x86_64 x86_64 GNU/Linux

$cmake --version

cmake version 3.6.2

$gcc --version

gcc (GCC) 6.2.0

Copyright (C) 2016 Free Software Foundation, Inc.

This is free software; see the source for copying conditions. There is NO

warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

$python -V

Python 2.7.5

$python3 -V

Python 3.5.2

Kindly let me know how can we proceed further.

image001.png

Thanks. It looks like you have the appropriate dependancies installed.

However, since you only provided the output, I can’t tell how you ran gcc. I really need you to follow my instructions and provide both the command and the output. As a general rule, the more information you provide, the easier it is to help.

Could you please do it again and give me the command and output? For example, if someone asked me to run gcc -v, here’s what I’d send (including clang as well):

** gcc – default compiler installed in /usr/bin

project-computing-lab-vm1:/home/d80049854 $ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.8/lto-wrapper
Target: x86_64-linux-gnu
Configured with: …/src/configure -v --with-pkgversion=‘Ubuntu 4.8.4-2ubuntu1~14.04.3’ --with-bugurl=file:///usr/share/doc/gcc-4.8/README.Bugs --enable-languages=c,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.8 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.8 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object --disable-libmudflap --enable-plugin --with-system-zlib --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-4.8-amd64/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-4.8-amd64 --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-4.8-amd64 --with-arch-directory=amd64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --enable-objc-gc --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 4.8.4 (Ubuntu 4.8.4-2ubuntu1~14.04.3)

** clang – 4.0 installed in /home/$USER/bin

project-computing-lab-vm1:/home/d80049854 $ clang -v
clang version 4.0.0 (http://llvm.org/git/clang.git 560b6b60eb83c4776255a27e23e95fef73171cf5) (http://llvm.org/git/llvm.git 3b621275428532a32a2806585282fa025af2d241)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/d80049854/usr/bin
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.6
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.6.4
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.8
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.8.4
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9.3
Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.8
Candidate multilib: .;@m64
Selected multilib: .;@m64

thanks…
don

image001.png

Assuming you have the correct version of gcc in your path, this should work for you (please note that cmake will try /usr/bin/cc first, so you may still have to explicitly set CC and CXX if alternatives aren’t set correctly):

mkdir clang && cd clang

wget http://releases.llvm.org/4.0.0/llvm-4.0.0.src.tar.xz

tar -xf llvm-4.0.0.src.tar.xz

wget http://releases.llvm.org/4.0.0/cfe-4.0.0.src.tar.xz
tar -xf cfe-4.0.0.src.tar.xz

ln -s …/…/cfe-4.0.0.src llvm-4.0.0.src/tools/clang

mkdir build && cd build

cmake
-DCMAKE_INSTALL_PREFIX=/applics/platform/clang_4_0_0
-DLLVM_ENABLE_FFI=ON
-DCMAKE_BUILD_TYPE=Release
-DLLVM_BUILD_LLVM_DYLIB=ON
-DLLVM_TARGETS_TO_BUILD=“host;AMDGPU”
…/llvm-4.0.0.src

hth…
don

image001.png

Hi Don,

Thanks a ton for the detailed steps.

image001.png