[cfe-dev] clang 4.0 installation

don hinton via cfe-dev cfe-dev at lists.llvm.org
Mon Apr 17 23:30:36 PDT 2017


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


On Mon, Apr 17, 2017 at 6:59 AM, don hinton <hintonda at gmail.com> wrote:

> 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
>
>
> On Sun, Apr 16, 2017 at 11:56 PM, chandini.sainu at wipro.com <
> chandini.sainu at wipro.com> wrote:
>
>> 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.
>>
>>
>>
>> Thanks,
>>
>> Chandini
>>
>>
>>
>> *From:* don hinton [mailto:hintonda at gmail.com]
>> *Sent:* Friday, April 14, 2017 8:29 PM
>> *To:* Chandini Sainu (GIS) <chandini.sainu at wipro.com>
>> *Cc:* cfe-dev at lists.llvm.org
>> *Subject:* Re: [cfe-dev] clang 3.9 installation
>>
>>
>>
>> ** This mail has been sent from an external source **
>>
>> Can't help with the prebuilt versions -- they are mostly provided to test
>> new versions and not used for anything else.
>>
>>
>>
>> But I will try to help you build it, so please run the following commands
>> (and never run sudo or login as root unless you absolutely have to).
>> Please provide both the command and the output -- just cut-n-paste both
>> from your terminal:
>>
>>
>>
>> $ uname -a
>>
>> $ cmake --version
>>
>> $ gcc -v
>>
>> $ python -V
>>
>>
>>
>> This should tell you the defaults that cmake will use.  Also, as Serge
>> noted above, the cmake_error.txt file you provided showed that you were
>> using the wrong versions of both gcc and python.
>>
>>
>>
>> If you have newer versions for gcc and python installed on your box, you
>> can always use the CC and CXX environment variables to select a different
>> compiler or different version, e.g.,
>>
>>
>>
>> $ CC=gcc-6.2 CXX=g++-6.2 cmake ../llvm ........
>>
>>
>>
>> Not sure the best way to set your python version, other than symlink or
>> alias, but a google search should provide plenty of alternatives.
>>
>>
>>
>> Once you have fixed those 2 problems, we can try running cmake.
>>
>>
>>
>> hth...
>>
>> don
>>
>>
>>
>>
>>
>> On Fri, Apr 14, 2017 at 12:01 AM, chandini.sainu at wipro.com <
>> chandini.sainu at wipro.com> wrote:
>>
>> Hi,
>>
>>
>>
>> Can I have update on the below mail.
>>
>>
>>
>> Your quick reply would be highly appreciated.
>>
>>
>>
>> Thanks,
>>
>> Chandini
>>
>>
>>
>> *From:* Chandini Sainu (GIS)
>> *Sent:* Friday, March 17, 2017 12:39 PM
>> *To:* cfe-dev at lists.llvm.org
>> *Cc:* 'don hinton' <hintonda at gmail.com>
>> *Subject:* RE: [cfe-dev] clang 3.9 installation
>>
>>
>>
>> Hi,
>>
>>
>>
>> Can someone help me with the below query.
>>
>>
>>
>> Thanks,
>>
>> Chandini
>>
>>
>>
>> *From:* don hinton [mailto:hintonda at gmail.com <hintonda at gmail.com>]
>> *Sent:* Thursday, March 16, 2017 7:23 PM
>> *To:* Chandini Sainu (GIS) <chandini.sainu at wipro.com>
>> *Cc:* cfe-dev at lists.llvm.org
>>
>> *Subject:* Re: [cfe-dev] clang 3.9 installation
>>
>>
>>
>> ** This mail has been sent from an external source **
>>
>> Hi Chandini:
>>
>>
>>
>> I've never used any of the pre-built binaries, so I really don't know.
>> Perhaps someone else could give a better answer.
>>
>>
>>
>> take care...
>>
>> don
>>
>>
>>
>> On Thu, Mar 16, 2017 at 1:34 AM, chandini.sainu at wipro.com <
>> chandini.sainu at wipro.com> wrote:
>>
>> Hi Don,
>>
>>
>>
>> Greetings for the day!
>>
>>
>>
>> As the clang 4.0 been released, can you help me in selecting the correct
>> version from the pre-built binaries for RHEL7 - x86_64
>>
>>
>>
>> http://llvm.org/releases/download.html
>>
>>
>>
>> [image: cid:image001.png at 01D29E5D.C6E50290]
>>
>>
>>
>> Your quick reply would  be highly appreciated.
>>
>>
>>
>> Thanks,
>> Chandini
>>
>>
>>
>> *From:* don hinton [mailto:hintonda at gmail.com <hintonda at gmail.com>]
>> *Sent:* Tuesday, November 15, 2016 4:56 PM
>> *To:* Chandini Sainu (GIS) <chandini.sainu at wipro.com>
>> *Cc:* cfe-dev at lists.llvm.org; sepavloff at gmail.com
>>
>>
>> *Subject:* Re: [cfe-dev] clang 3.9 installation
>>
>>
>>
>> ** This mail has been sent from an external source **
>>
>> If you want to build llvm+clang from scratch, please follow these
>> instructions:
>>
>> http://clang.llvm.org/get_started.html
>>
>> But, if you just want to use it, I'd suggest you download one of the
>> pre-built binaries found here:
>>
>> http://llvm.org/releases/download.html
>>
>>
>>
>> On Tue, Nov 15, 2016 at 2:34 AM <chandini.sainu at wipro.com> wrote:
>>
>> Hi Don,
>>
>>
>>
>> Tried without sudo but still the same issue.
>>
>>
>>
>> llvm 3.9 is downloaded. Do you want me to link clang to llvm/tools?
>>
>>
>>
>> *FYI*
>>
>>
>>
>> [sainu at oulnxc55 xfer/sainu/cfe-3.9.0.src]$ls
>>
>> bindings  CMakeLists.txt   docs      include  INSTALL.txt
>> LICENSE.TXT     NOTES.txt   runtime  tools      utils
>>
>> cmake     CODE_OWNERS.TXT  examples  INPUTS   lib
>> ModuleInfo.txt  README.txt  test     unittests  www
>>
>>
>>
>> [sainu at oulnxc55 xfer/sainu/llvm-3.9.0.src/tools]$ls
>>
>> bugpoint         llvm-ar                           llvm-cov
>> llvm-extract      llvm-mcmarkup  llvm-shlib       msbuild
>> yaml2obj
>>
>> bugpoint-passes  llvm-as                           llvm-c-test
>> llvm-go           llvm-nm        llvm-size        obj2yaml
>>
>> CMakeLists.txt   llvm-as-fuzzer                    llvm-cxxdump
>> llvm-jitlistener  llvm-objdump   llvm-split       opt
>>
>> dsymutil         llvm-as-parasitic-coverage-repro  llvm-diff
>> llvm-link         llvm-pdbdump   llvm-stress      sancov
>>
>> gold             llvm-bcanalyzer                   llvm-dis
>> llvm-lto          llvm-profdata  llvm-symbolizer  sanstats
>>
>> llc              LLVMBuild.txt                     llvm-dwarfdump
>> llvm-mc           llvm-readobj   llvm-vtabledump  verify-uselistorder
>>
>> lli              llvm-config                       llvm-dwp
>> llvm-mc-fuzzer    llvm-rtdyld    lto              xcode-toolchain
>>
>> [sainu at oulnxc55 xfer/sainu/llvm-3.9.0.src/tools]$
>>
>>
>>
>> Thanks,
>>
>> Chandini
>>
>>
>>
>> *From:* don hinton [mailto:hintonda at gmail.com]
>> *Sent:* Monday, November 14, 2016 8:38 PM
>>
>>
>> *To:* Chandini Sainu (GIS) <chandini.sainu at wipro.com>
>>
>> *Cc:* sepavloff at gmail.com; clang developer list <cfe-dev at lists.llvm.org>;
>> Suryakanta Sahoo (GIS) <suryakanta.sahoo at wipro.com>
>>
>>
>> *Subject:* Re: [cfe-dev] clang 3.9 installation
>>
>>
>>
>> ** This mail has been sent from an external source **
>>
>> Btw, sudo only explains the gcc version issue.
>>
>>
>>
>> The other errors seem to indicate cmake can't find the llvm directory.
>> Did you download llvm?  Normally, you download clang under the llvm/tools
>> directory (renaming or linking cfe as clang), then run cmake like this:
>>
>>
>>
>>   cmake <options> ../llvm
>>
>>
>>
>> where ../llvm points to the llvm root directory.
>>
>>
>>
>> again, hth...
>>
>> don
>>
>>
>>
>> On Mon, Nov 14, 2016 at 6:52 AM, <chandini.sainu at wipro.com> wrote:
>>
>> Hi Hinton,
>>
>>
>>
>> Will check and revert back.
>>
>>
>>
>> Thanks,
>>
>> Chandini
>>
>>
>>
>> *From:* don hinton [mailto:hintonda at gmail.com]
>> *Sent:* Monday, November 14, 2016 8:07 PM
>> *To:* Chandini Sainu (GIS) <chandini.sainu at wipro.com>;
>> sepavloff at gmail.com
>> *Cc:* cfe-dev at lists.llvm.org; Suryakanta Sahoo (GIS) <
>> suryakanta.sahoo at wipro.com>
>>
>>
>> *Subject:* Re: [cfe-dev] clang 3.9 installation
>>
>>
>>
>> ** This mail has been sent from an external source **
>>
>> The problem is sudo.
>>
>> Once you run sudo, you are root and have a completely different
>> environment. My guess is that the newer version of gcc is installed in a
>> non-standard location. If that's the case, you may need a few more options.
>>
>> Try running cmake and make without sudo, then, if needed, run "sudo make
>> install" to actually do the installation step.
>>
>> hth...
>> don
>>
>>
>>
>> On Mon, Nov 14, 2016 at 5:35 AM via cfe-dev <cfe-dev at lists.llvm.org>
>> wrote:
>>
>> Hi Serge,
>>
>>
>>
>> Thanks for the response!
>>
>>
>>
>> We are using the latest version of gcc (6.2)and python(3.3) but the cmake
>> is picking up the server installed packages only.
>>
>>
>>
>> Kindly suggest.
>>
>>
>>
>> Regards,
>>
>> Chandini
>>
>>
>>
>> *From:* Serge Pavlov [mailto:sepavloff at gmail.com]
>> *Sent:* Monday, November 14, 2016 6:45 PM
>> *To:* Chandini Sainu (GIS) <chandini.sainu at wipro.com>
>> *Cc:* dwiberg at gmail.com; Joerg Sonnenberger <joerg at bec.de>; Clang Dev <
>> cfe-dev at lists.llvm.org>; Suryakanta Sahoo (GIS) <
>> suryakanta.sahoo at wipro.com>
>>
>>
>> *Subject:* Re: [cfe-dev] clang 3.9 installation
>>
>>
>>
>> ** This mail has been sent from an external source **
>>
>> According to the attached files you are using too old gcc (4.4.6 but 4.8+
>> is needed) and python (2.6 but 2.7+ is needed).
>>
>>
>> Thanks,
>> --Serge
>>
>>
>>
>> 2016-11-14 14:50 GMT+07:00 via cfe-dev <cfe-dev at lists.llvm.org>:
>>
>> Hi David/Joerg,
>>
>> Below are requested details.
>>
>> Your quick support is highly appreciated!
>>
>> Thanks,
>> Chandini
>>
>> -----Original Message-----
>> From: David Wiberg [mailto:dwiberg at gmail.com]
>> Sent: Monday, November 14, 2016 2:39 AM
>> To: Suryakanta Sahoo (GIS) <suryakanta.sahoo at wipro.com>
>> Cc: cfe-dev at lists.llvm.org; Chandini Sainu (GIS) <
>> chandini.sainu at wipro.com>
>> Subject: Re: [cfe-dev] clang 3.9 installation
>>
>> ** This mail has been sent from an external source **
>>
>> Hi,
>>
>> You will need to provide more information for anyone to be able to help
>> you.
>>
>> For example:
>> - Which Linux distribution/version are you running? → RHEL6.7
>> - What steps have you performed?
>>
>> GCC version → gcc_6_2_0
>> Cmake version → cmake-3_6_2
>> Python version → python3_3_2
>>
>> Command being used →  sudo cmake -DCMAKE_INSTALL_PREFIX=/applics/platform/clang_3_9_0
>> -DLLVM_ENABLE_FFI=ON -DCMAKE_BUILD_TYPE=Release -DLLVM_BUILD_LLVM_DYLIB=ON
>> -DLLVM_TARGETS_TO_BUILD="host;AMDGPU" -Wno-dev ..
>>
>> - What error messages do you receive?
>>
>> Errors attached.
>>
>>
>> Best regards
>> David
>>
>> 2016-11-11 0:15 GMT+01:00 via cfe-dev <cfe-dev at lists.llvm.org>:
>> > Hi Team,
>> >
>> >
>> >
>> > We are trying to install clang 3.9 in Linux Server. We tried
>> > installing using the steps available in the website, we are getting
>> errors.
>> >
>> >
>> >
>> > Could you please assist us with the procedure to do so.
>> >
>> >
>> >
>> >
>> >
>> > Thanks & Regards,
>> >
>> > Suryakanta Sahoo
>> >
>> > Project Engineer,
>> >
>> > Wipro Technology Services Ltd
>> >
>> >
>> >
>> > The information contained in this electronic message and any
>> > attachments to this message are intended for the exclusive use of the
>> > addressee(s) and may contain proprietary, confidential or privileged
>> > information. If you are not the intended recipient, you should not
>> > disseminate, distribute or copy this e-mail. Please notify the sender
>> > immediately and destroy all copies of this message and any
>> > attachments. WARNING: Computer viruses can be transmitted via email.
>> > The recipient should check this email and any attachments for the
>> > presence of viruses. The company accepts no liability for any damage
>> > caused by any virus transmitted by this email. www.wipro.com
>> >
>> > _______________________________________________
>> > cfe-dev mailing list
>> > cfe-dev at lists.llvm.org
>> > http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
>> >
>> The information contained in this electronic message and any attachments
>> to this message are intended for the exclusive use of the addressee(s) and
>> may contain proprietary, confidential or privileged information. If you are
>> not the intended recipient, you should not disseminate, distribute or copy
>> this e-mail. Please notify the sender immediately and destroy all copies of
>> this message and any attachments. WARNING: Computer viruses can be
>> transmitted via email. The recipient should check this email and any
>> attachments for the presence of viruses. The company accepts no liability
>> for any damage caused by any virus transmitted by this email.
>> www.wipro.com
>>
>>
>> _______________________________________________
>> cfe-dev mailing list
>> cfe-dev at lists.llvm.org
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
>>
>>
>>
>> The information contained in this electronic message and any attachments
>> to this message are intended for the exclusive use of the addressee(s) and
>> may contain proprietary, confidential or privileged information. If you are
>> not the intended recipient, you should not disseminate, distribute or copy
>> this e-mail. Please notify the sender immediately and destroy all copies of
>> this message and any attachments. WARNING: Computer viruses can be
>> transmitted via email. The recipient should check this email and any
>> attachments for the presence of viruses. The company accepts no liability
>> for any damage caused by any virus transmitted by this email.
>> www.wipro.com
>>
>> _______________________________________________
>> cfe-dev mailing list
>> cfe-dev at lists.llvm.org
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
>>
>> The information contained in this electronic message and any attachments
>> to this message are intended for the exclusive use of the addressee(s) and
>> may contain proprietary, confidential or privileged information. If you are
>> not the intended recipient, you should not disseminate, distribute or copy
>> this e-mail. Please notify the sender immediately and destroy all copies of
>> this message and any attachments. WARNING: Computer viruses can be
>> transmitted via email. The recipient should check this email and any
>> attachments for the presence of viruses. The company accepts no liability
>> for any damage caused by any virus transmitted by this email.
>> www.wipro.com
>>
>>
>>
>> The information contained in this electronic message and any attachments
>> to this message are intended for the exclusive use of the addressee(s) and
>> may contain proprietary, confidential or privileged information. If you are
>> not the intended recipient, you should not disseminate, distribute or copy
>> this e-mail. Please notify the sender immediately and destroy all copies of
>> this message and any attachments. WARNING: Computer viruses can be
>> transmitted via email. The recipient should check this email and any
>> attachments for the presence of viruses. The company accepts no liability
>> for any damage caused by any virus transmitted by this email.
>> www.wipro.com
>>
>> The information contained in this electronic message and any attachments
>> to this message are intended for the exclusive use of the addressee(s) and
>> may contain proprietary, confidential or privileged information. If you are
>> not the intended recipient, you should not disseminate, distribute or copy
>> this e-mail. Please notify the sender immediately and destroy all copies of
>> this message and any attachments. WARNING: Computer viruses can be
>> transmitted via email. The recipient should check this email and any
>> attachments for the presence of viruses. The company accepts no liability
>> for any damage caused by any virus transmitted by this email.
>> www.wipro.com
>>
>>
>>
>> The information contained in this electronic message and any attachments
>> to this message are intended for the exclusive use of the addressee(s) and
>> may contain proprietary, confidential or privileged information. If you are
>> not the intended recipient, you should not disseminate, distribute or copy
>> this e-mail. Please notify the sender immediately and destroy all copies of
>> this message and any attachments. WARNING: Computer viruses can be
>> transmitted via email. The recipient should check this email and any
>> attachments for the presence of viruses. The company accepts no liability
>> for any damage caused by any virus transmitted by this email.
>> www.wipro.com
>>
>>
>> The information contained in this electronic message and any attachments
>> to this message are intended for the exclusive use of the addressee(s) and
>> may contain proprietary, confidential or privileged information. If you are
>> not the intended recipient, you should not disseminate, distribute or copy
>> this e-mail. Please notify the sender immediately and destroy all copies of
>> this message and any attachments. WARNING: Computer viruses can be
>> transmitted via email. The recipient should check this email and any
>> attachments for the presence of viruses. The company accepts no liability
>> for any damage caused by any virus transmitted by this email.
>> www.wipro.com
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20170417/e087411e/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.png
Type: image/png
Size: 16718 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20170417/e087411e/attachment.png>


More information about the cfe-dev mailing list