[cfe-dev] Compiling and running clangs unit tests

Yaron Keren yaron.keren at gmail.com
Sun Jul 26 21:58:00 PDT 2015


If you checkout clang into llvm/tools/clang, configuring and building llvm
will also do the same for clang.
You cna then test everything with make -check-all.


2015-07-27 5:14 GMT+03:00 Nikola Smiljanic <popizdeh at gmail.com>:

> So I have no idea what the problem is. It might be using autotools, it
> might be the fact that you're installing llvm. Here's what I tried on my
> Ubuntu VM.
>
> Source from branches/release_37
> llvm in ~/llvm
> clang in ~/clang
> inside ~/build_llvm: cmake -g Ninja -DCMAKE_BUILD_TYPE=RelWithDebInfo
> ../llvm
> inside ~/build_llvm: ninja
> inside ~/build_clang: cmake -g Ninja -DCMAKE_BUILD_TYPE=RelWithDebInfo
> -DLLVM_CONFIG=~/build_llvm/bin/llvm-config ../clang
> inside ~/build_clang: ninja clang-test
>
> This works for me. I strongly suggest passing the following flags to both
> cmake configure steps as it makes building much faster:
>
> -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++
> -DCMAKE_C_FLAGS=-fuse-ld=gold -DCMAKE_CXX_FLAGS=-fuse-ld=gold
>
> Hope this helps.
>
> On Mon, Jul 27, 2015 at 8:40 AM, Milian Wolff <mail at milianw.de> wrote:
>
>> Sorry Nikola,
>>
>> the email I wrote was written by hand and used a made up prefix. In
>> reality, I
>> install into the prefix you see there. Here are my CMakeCache.txt files:
>>
>> llvm: https://paste.kde.org/ppcx7f0hf
>> <https://urldefense.proofpoint.com/v2/url?u=https-3A__paste.kde.org_ppcx7f0hf&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=CnzuN65ENJ1H9py9XLiRvC_UQz6u3oG6GUNn7_wosSM&m=PVxTvhqazNp3Mt9Pj5gzvmZecldhQu0mfB-MuVMV3J4&s=2lxRN5WtREqlj7_ZLjn6kzZhpCIJ6zkubt4ROUoh3a8&e=>
>> clang: https://paste.kde.org/pvseix1ut
>> <https://urldefense.proofpoint.com/v2/url?u=https-3A__paste.kde.org_pvseix1ut&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=CnzuN65ENJ1H9py9XLiRvC_UQz6u3oG6GUNn7_wosSM&m=PVxTvhqazNp3Mt9Pj5gzvmZecldhQu0mfB-MuVMV3J4&s=W6d9iPQlMVYQemJaioc-Bik7aR-vxgqJ_qlOmbhkTCs&e=>
>>
>> Sorry for the confusion, hope this is more explicit.
>>
>> Bye
>>
>> On Monday, July 27, 2015 08:36:52 AM Nikola Smiljanic wrote:
>> >    1. -- Found LLVM_CONFIG as
>> >    /home/milian/projects/compiled/other/bin/llvm-config
>> >
>> >
>> > This makes me believe your clang build is not using the llvm you just
>> > built? Do you have installed version of LLVM on your distro?
>> >
>> > I used to build Clang out of source on Windows and you had to provide
>> path
>> > to LLVM but I can't see that in CMake gui anymore (on Linux). The only
>> > thing I can suggest is to move clang inside llvm/tools and build
>> in-tree.
>> > That will work 100%
>> >
>> > On Mon, Jul 27, 2015 at 8:29 AM, Milian Wolff <mail at milianw.de> wrote:
>> > > On Monday, July 27, 2015 08:25:37 AM Nikola Smiljanic wrote:
>> > > > How did you configure? I'm a bit surprised by bulid/clang path. It
>> looks
>> > > > like you're building Clang but not LLVM?
>> > >
>> > > Yes, I'm building Clang.
>> > >
>> > > I have:
>> > >
>> > > ~/projects/src/llvm
>> > > ~/projects/src/clang
>> > > ~/projects/build/llvm
>> > > ~/projects/build/clang
>> > >
>> > > The former two are checkouts of the release_37 branches of the
>> > > corresponding
>> > > git at github.com:llvm-mirror/*.git repositories. I configured them
>> basically
>> > > with
>> > >
>> > > build/llvm$ cmake ../../src/llvm -DCMAKE_BUILD_TYPE=RelWithDebInfo -
>> > > DCMAKE_INSTALL_TYPE=$HOME/projects/compiled/llvm
>> > >
>> > > and then same for clang. Everything compiles and works just fine,
>> except
>> > > for
>> > > the unit tests. And those are only compiled for me when I run `make
>> clang-
>> > > test` manually, i.e. they are not included in the "normal" make call
>> - is
>> > > this
>> > > intended?
>> > >
>> > > Or does clang not support out of source builds?
>> > >
>> > > > On Sun, Jul 26, 2015 at 10:27 PM, Milian Wolff <mail at milianw.de>
>> wrote:
>> > > > > Hey all,
>> > > > >
>> > > > > in preparation of working on clang, I want to compile and run the
>> unit
>> > > > > tests,
>> > > > > specifically those for the clang-c part.
>> > > > >
>> > > > > I read http://clang.llvm.org/hacking.html
>> <https://urldefense.proofpoint.com/v2/url?u=http-3A__clang.llvm.org_hacking.html&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=CnzuN65ENJ1H9py9XLiRvC_UQz6u3oG6GUNn7_wosSM&m=PVxTvhqazNp3Mt9Pj5gzvmZecldhQu0mfB-MuVMV3J4&s=TG_XctQ37jJP-rHTPY27xkLFNFU4OdHdveqQ8MBejLY&e=>
>> and tried to run `make
>> > > > > clang-test`
>> > > > > in my external build folder, but that fails at link time:
>> > > > >
>> > > > > https://paste.kde.org/ptylyjsa7
>> <https://urldefense.proofpoint.com/v2/url?u=https-3A__paste.kde.org_ptylyjsa7&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=CnzuN65ENJ1H9py9XLiRvC_UQz6u3oG6GUNn7_wosSM&m=PVxTvhqazNp3Mt9Pj5gzvmZecldhQu0mfB-MuVMV3J4&s=QXoNBHNevVfvI8rSlrKz8ZrOiWiuAJ-EUDEXGz6q9Xk&e=>
>> > > > >
>> > > > > This is using the latest versions of the release_37 branches in
>> both,
>> > >
>> > > LLVM
>> > >
>> > > > > and
>> > > > > clang. Could someone tell me what's going wrong here?
>> > >
>> > > --
>> > > Milian Wolff
>> > > mail at milianw.de
>> > > http://milianw.de
>> <https://urldefense.proofpoint.com/v2/url?u=http-3A__milianw.de&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=CnzuN65ENJ1H9py9XLiRvC_UQz6u3oG6GUNn7_wosSM&m=PVxTvhqazNp3Mt9Pj5gzvmZecldhQu0mfB-MuVMV3J4&s=NgLlKRS6l1f1fA7C2CVmczfgtehXRiIunHmDAVn6n6s&e=>
>>
>> --
>> Milian Wolff
>> mail at milianw.de
>> http://milianw.de
>> <https://urldefense.proofpoint.com/v2/url?u=http-3A__milianw.de&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=CnzuN65ENJ1H9py9XLiRvC_UQz6u3oG6GUNn7_wosSM&m=PVxTvhqazNp3Mt9Pj5gzvmZecldhQu0mfB-MuVMV3J4&s=NgLlKRS6l1f1fA7C2CVmczfgtehXRiIunHmDAVn6n6s&e=>
>>
>
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20150727/f6987e9b/attachment.html>


More information about the cfe-dev mailing list