New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/qt clang integration #61348
Feature/qt clang integration #61348
Conversation
As i am still newbie to nix and nixos, i have some doubts:
|
@@ -0,0 +1,334 @@ | |||
diff --git a/tools/driver/CMakeLists.txt b/tools/driver/CMakeLists.txt |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there an upstream version of this patch? If possible it would be preferred to use fetchpatch
to avoid checking this in.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately no, qt maintain separate version of clang in their own git, and afaik deliver it through their installer package (binary .run file). It's is possible, however, to fetch patch directly from their tracker by link. Please let me know if i should do it this way.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah that works
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried using fetchpatch, but that fails (that diff is against older version of clang). I suggest leaving patch file as it is now.
For something like qtcreator it is probably okay. Usually there are tight version constraints on apps like this anyway.
This should be fine. Sometimes we can add runtime search paths for this kind of thing but llvm should be okay.
.patch should definitely be used if you have something that is upstreamable.
No, but maybe there should be. If there's an upstream version, try to keep that name though. |
Thank you for your answers. |
@@ -16,14 +16,15 @@ stdenv.mkDerivation rec { | |||
|
|||
src = fetchurl { | |||
url = "http://download.qt-project.org/official_releases/qtcreator/${baseVersion}/${version}/qt-creator-opensource-src-${version}.tar.xz"; | |||
sha256 = "1k23i1qsw6d06sy7g0vd699rbvwv6vbw211fy0nn0705a5zndbxv"; | |||
sha256 = "1a76jv1nl8fqgifk9pq5sdyrsq0ba9iwz5myz1898xhvaf91kvj6"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The updated hash should go into the commit that bumps the qtcreator version.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're right. Fixed.
d097c00
to
fb741fe
Compare
fb741fe
to
f7603a9
Compare
Removed patch for botan, it's deprecated. |
f7603a9
to
a241ce6
Compare
ping @matthewbauer |
This pull request has been mentioned on Nix community. There might be relevant details there: https://discourse.nixos.org/t/prs-ready-for-review-may-2019/3032/5 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome work! I have several questions regarding changes, see review.
diff --git a/tools/extra/clazy/CMakeLists.txt b/tools/extra/clazy/CMakeLists.txt | ||
index d61714d0..f563976f 100644 | ||
--- a/tools/extra/clazy/CMakeLists.txt | ||
+++ b/tools/extra/clazy/CMakeLists.txt |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You almost completely replace clazy
s original CMake file with this. Where does it come from and why is it needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to build clazy as clang plugin, not stand alone version, to be later invoked from clang executable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, but where does the modified file come from? Qt Creator's fork? It might be a good idea to explain it as a comment in expression along with a link to the original patch (which doesn't change this CMakeLists.txt
).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wrote it myself (actually just deleted all calls that is not needed for plugin build)
a241ce6
to
b8596bb
Compare
After thinking some more about this: @deadloko maybe we should just build Qt's Clang fork separately? I feel that all this patching is quite flaky and more problems may possibly come later (maybe Qt Creator would expect additional information from |
@abbradar This is one of possible solutions for this. I'll invest some more time to see if it's possible, cause i've never tried to build qtc with qt version of llvm. I'm still have little experience with nix expressions, but, hopefully, i won't need to to write them from scratch. I'd like to have some advice on:
|
If just an |
They have whole llvm project (llvm, clang, clang-tools-extra) forked, but i think system LLVM should do just fine. |
Little update: |
b8596bb
to
668831c
Compare
@abbradar I would appreciate if you review new changes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Small fixes and we're good to go. Now we can merge it without fearing that clang breaks somehow, thanks!
668831c
to
4a0a8f4
Compare
@deadloko I tried to build it but got invalid checksum errors for patches, which is a bad sign:
Can you try redownloading them? I think there was a better way than collecting garbage and building it again recently but not sure. |
4a0a8f4
to
f3a7f76
Compare
Clang code model provides user with services: code completion, syntactic and semantic highlighting, diagnostics, outline of symbols, tooltips, renaming of local symbols. It's naturally depends on llvm and clang. To make it work with nixos: 1. Add qt version of clang as build dependency. 2. Added patch for clang libc++ regexp trunk regexp not including path like "libc++-version". 3. Fixed paths to llvm/clang libraries and includes. 4. Fixed name of clazy clang plugin.
f3a7f76
to
3d80880
Compare
@abbradar I fixed hashes for patches, but it's strange behavior. |
@abbradar I've tested build on another machine (NixOS too). Build still succeedes. |
Sadly I lost ability to build this because I needed to RMA my CPU :D If someone could just build it and verify it starts at least I'd merge.
…On June 7, 2019 11:49:29 AM GMT+03:00, Andrew Newman ***@***.***> wrote:
@abbradar I've tested build on another machine (NixOS too). Build still
succeedes.
--
You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub:
#61348 (comment)
--
Nikolay.
|
@abbradar Well, that's unfortunate, hope your cpu replacement soon. =) Also can't you ask borg bot to build this one? |
I'd just like to run it too but as I can't and you tested it - let's just check that it builds @GrahamcOfBorg build qtcreator |
Bot's timeout kicked in ;_; Can someone try to build this? |
Let's not keep this stalled - you tested it on two machines so this should be enough. Merging, thanks! |
@deadloko I'm trying to update qtc to 4.10.0 but I'm not sure what all needs to change here. Could you list some expected changes and tests (I see one detailed testing procedure you've mentioned in the original comment) that would help me change with enough confidence to create a PR? Some info if it helps- currently just downloading 4.10.0 gives me a |
@SRGOM There was 3 patches (and some substitutions in nix expressions):
More info on linking error (console output) would help to solve problem. |
Motivation for this change
Starting with version 4.7 clang code model is the default method for supporting QOL services as is:
code completion, syntactic and semantic highlighting, diagnostics with fixits and integrated Clang-Tidy and Clazy checks, follow symbol, outline of symbols, tooltips, renaming of local symbols.
For future releases of qtc clang code model support is esssential need.
Things done
sandbox
innix.conf
on non-NixOS)nix-shell -p nix-review --run "nix-review wip"
./result/bin/
)nix path-info -S
before and after)How clang-tools and clang-code-model functionallity was tested
nix-shell -I nixpkgs=../nixpkgs --pure --keep LD_LIBRARY_PATH
nixpkgs path is path to my nixpkgs fork with this changes.
qtcreator
, if debug of clang-model is needed:QT_LOGGING_RULES=qtc.clang*=true LIBCLANG_TIMING=1 qtcreator
11:40:47: Clang-Tidy and Clazy finished: Processed 3 files successfully, 0 failed.
.Update:
Rebased and tested on 03 june 2019 - reason is qtcreator was updated to 4.9.1 in master.
Update2:
As @abbradar adviced, i removed all changes that was made to system clang, added qt vendor clang version as build dependency. After testing all looks good: clang code model working with both clang and gcc compilers set in project kit. Clang-tidy and clazy checks also works like they should.