On 12/12/16 11:28, Eike Ziller wrote:

On Dec 12, 2016, at 3:13 AM, Andrzej Telszewski <[email protected]> wrote:
When it comes to build_clang.py, this script expects some environment 
variables, like PKG_NODE_ROOT, CLANG_BRANCH, and more:
1. Where do they come from? How can I get them? :-)

They are defined as part of our build setup which is not publicly shared.


Well, maybe one day you'll release it :-)

2. How can I determine which exact versions of software and any other flags you 
used to create the given QTC release?

It would probably be nice to define LLVM_REVISION and CLANG_REVISION within the 
Qt Creator repository. These will usually be the release sha1s from a 
llvm/clang release.


That's a good idea.
You could also provide information on other important components (if there are any, qbs definitely).

I know it's possible to gather this information, but it's really frustrating having to dig through all the different sources.

A file or release notes section containing the list of different components together with actual versions would be invaluable. And when I say a list, I mean it ;-) Having to read different sections of release notes to pick the versions is not pleasant at all ;-)

I believe you could automate such a process without bigger pain (or do you? ;-)).

Questions:
1. In deployqt.py, you tweak rpath-s, but I found that simply copying libclang 
into /tmp/qtc-ins/usr/lib/qtcreator just works. So is this step necessary?

It was necessary once upon a time, I haven’t checked if it still is.


OK. It works for me without any rpath voodoo.

That is what it looks like (from installed package):
$ patchelf --print-rpath /usr/libexec/qtcreator/clangbackend
$ORIGIN/../../lib64/qtcreator:$ORIGIN/../../lib64/qtcreator/plugins:$ORIGIN:$ORIGIN/..:$ORIGIN/../lib64/qtcreator:/tmp/slackrepo-desktop/qt-creator-opensource-src-4.2.0-rc1/llvm-ins/lib

My guess is that libclang.so is immediately found by means of:
$ORIGIN/../../lib64/qtcreator

General question:
Have I missed something? ;-)

I don’t see anything obviously wrong ;)


Nice to hear :-)

On 12/12/16 11:39, Nikolai Kosjar wrote:
On 12/12/2016 03:13 AM, Andrzej Telszewski wrote:
*1) Configure, build and temporarily install LLVM:*

$ cmake \
    -DCMAKE_INSTALL_PREFIX=/tmp/llvm-ins \
    -DCMAKE_BUILD_TYPE=Release \
    -G "Unix Makefiles" \
    -DLLVM_BUILD_TOOLS=OFF \
    -DLLVM_INCLUDE_EXAMPLES=OFF \
    -DLLVM_INCLUDE_TESTS=OFF \
    -DLLVM_ENABLE_RTTI=ON \
    -DLLVM_TARGETS_TO_BUILD="X86" \
    ..
  $ make
  $ make install
  $ # We disabled building of all the tools, but we still need some.
  $ make llvm-config
  $ cp -a bin/llvm-config /tmp/llvm-ins/bin

Questions:
2. As you can see, I passed some additional flags (not found in
build_clang.py), like -DLLVM_BUILD_TOOLS=OFF, mainly to shorten the
build time. Can you think of any troubles I might get with the cmake
configuration as you see above?

I'm not know what exactly LLVM_BUILD_TOOLS=OFF excludes. But at least the clang soures 
are located in a "tools" directory within LLVM (${LLVM_SOURCE}/tools/clang), so 
you might want to double check whether the clang executable was really build (needed for 
the clang static analyzer).


Neither do I know exactly what is excluded, but:
1) clang executable (and library) *is* built,
2) llvm-config *is not* built.

For llvm-config you can see that I actually had to invoke separate make and also had to install it by hand.

After a bit of testing, I ended up with the following:
$ cmake \
    -DCMAKE_C_FLAGS:STRING="$SLKCFLAGS" \
    -DCMAKE_CXX_FLAGS:STRING="$SLKCFLAGS" \
    -DCMAKE_INSTALL_PREFIX=$LLVM_INSTALL_ROOT \
    -DCMAKE_BUILD_TYPE=Release \
    -G "Unix Makefiles" \
    -DLLVM_ENABLE_RTTI=ON \
    -DLLVM_TARGETS_TO_BUILD="X86" \
    ..

It turns out that LLVM_BUILD_TOOLS=OFF, LLVM_INCLUDE_EXAMPLES=OFF and LLVM_INCLUDE_TESTS=OFF saves me only ~5 minutes out of the ~60 minutes total build time of LLVM/Clang. So it's not worth specifying those and having to perform "by hand" steps later on.

SLKCFLAGS="-O2 -march=i586 -mtune=i686" for i586 arch
and
SLKCFLAGS="-O2 -fPIC" for x86_64 arch

(I'm on Slackware).

Note also that nowadays Qt Creator's README.md includes instructions to 
get/build llvm/clang:

  http://code.qt.io/cgit/qt-creator/qt-creator.git/tree/README.md
  Section "## Get LLVM/Clang for the Clang Code Model"


Good to know (well, I should know it already, shouldn't I? ;-)).
Thanks.

4. Are there any other flags that would be worth adding? Please note
that I removed -DCMAKE_C_FLAGS and -DCMAKE_CXX_FLAGS for clarity, I
actually have them in my real build/packaging script.

If you find other flags worth adding, share them with us :)


Surely ;-) I did a bit of reading, but haven't found anything interesting (other than what I have already mentioned).


Thanks for the help!

--
Best regards,
Andrzej Telszewski
_______________________________________________
Qt-creator mailing list
[email protected]
http://lists.qt-project.org/mailman/listinfo/qt-creator

Reply via email to