* Qt Creator for Linux Kernel Development @ 2016-11-23 5:51 Jason A. Donenfeld 2016-11-23 7:45 ` [Qt-creator] " Konstantin Tokarev ` (2 more replies) 0 siblings, 3 replies; 13+ messages in thread From: Jason A. Donenfeld @ 2016-11-23 5:51 UTC (permalink / raw) To: qt-creator; +Cc: WireGuard mailing list Hello Eike & Qt Creator mailing list, I'm insane and decided to try using an IDE for Linux kernel development. Much to my delight, it actually works well. (Everybody on the mailing list to which this message is cross-posted just vomited a little bit in their mouth and swallowed, but fear not: I'm a competent VIM user too. It's just that sometimes clickity clicking around Qt Creator is buttery nice. Here's a screenshot [2].) I'm working on a small kernel module [1], and for it I made a very minimal .pro file to import its files into Qt Creator. I even hooked the build/run commands up to my qemu testing rig. Seems to work pretty well. Here's the .pro I use: CONFIG -= qt INCLUDEPATH = /usr/src/linux/arch/x86/include /usr/src/linux/arch/x86/include/generated/uapi /usr/src/linux/ arch/x86/include/generated /usr/src/linux/include /usr/src/linux/arch/x86/include/uapi /usr/src/linux/arch/x 86/include/generated/uapi /usr/src/linux/include/uapi /usr/src/linux/include/generated/uapi DEFINES = __KERNEL__ DEBUG MODULE SOURCES = $$system(find -L . -type f -iname $$system_quote(*.c) -and -not -path $$system_quote(./tests/*)) $ $system(find -L . -type f -iname $$system_quote(*.S) -and -not -path $$system_quote(./tests/*)) HEADERS = $$system(find -L . -type f -iname $$system_quote(*.h) -and -not -path $$system_quote(./tests/*)) As you can see, it's a real hack. I also do development on the main Linux kernel tree, and similarly for that, I have a .pro file that works well: CONFIG -= qt INCLUDEPATH = $$system(find -L include/ -type d) SOURCES = $$system(find -L . -type f -iname \'*.c\') HEADERS = $$system(find -L . -type f -iname \'*.h\') INCLUDEPATH = include/ arch/x86/include Download the linux sources, put that in the tree, and load it up in Qt Creator. It works. Amazing! But don't get too excited. Unfortunately, there are two issues that make things unbearable: (A) Qt Creator doesn't seem to parse the C correctly. Things like designated initializers and a few other C features here and there just don't get parsed correctly, and the IDE stops being useful. I suspect this is because things are actually being parsed in C++ mode. Bummer. Developers: any interest in improving C support in Qt Creator? (B) There is no way to tell Qt Creator that a particular header file is included in every file -- that is, that gcc's "-include" is in use. There is a way of messing with the "C++ Code Model" on a file-by-file basis, for the duration of the time that the file is open, but no way to automatically have it included in every file of the project. This is a major hindrance. It means that every ifdef for every kconfig option is a grayed out unclickable region, rendering most things useless. Developers: any interest in fixing this? I spoke to a few of you in IRC several months ago about this, and there was interest, but it seems to have evaporated. So, anyway, if you think it would be cool to be able to say, "Qt Creator is used for Linux Kernel Development!", then maybe we can work together to actually get things working properly. It's already 85% there, and the remaining chunk seems well within reach. Not only that, but if Qt Creator becomes generally usable for ordinary C projects, it would most likely become a regular tool during my professional activities, namely, auditing large code bases for vulnerabilities and improving the security of systems. Let me know if you are interested in assisting with this. Thanks, Jason [1] https://www.wireguard.io/ [2] https://data.zx2c4.com/qt-creator-wireguard-development.png ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [Qt-creator] Qt Creator for Linux Kernel Development 2016-11-23 5:51 Qt Creator for Linux Kernel Development Jason A. Donenfeld @ 2016-11-23 7:45 ` Konstantin Tokarev 2016-11-28 18:03 ` Jason A. Donenfeld 2016-11-29 8:56 ` Nikolai Kosjar 2016-11-23 7:58 ` Orgad Shaneh 2016-11-23 9:21 ` Eike Ziller 2 siblings, 2 replies; 13+ messages in thread From: Konstantin Tokarev @ 2016-11-23 7:45 UTC (permalink / raw) To: Jason A. Donenfeld, qt-creator; +Cc: WireGuard mailing list 23.11.2016, 08:51, "Jason A. Donenfeld" <jason@zx2c4.com>: > Hello Eike & Qt Creator mailing list, > > I'm insane and decided to try using an IDE for Linux kernel > development. Much to my delight, it actually works well. (Everybody on > the mailing list to which this message is cross-posted just vomited a > little bit in their mouth and swallowed, but fear not: I'm a competent > VIM user too. It's just that sometimes clickity clicking around Qt > Creator is buttery nice. Here's a screenshot [2].) > > I'm working on a small kernel module [1], and for it I made a very > minimal .pro file to import its files into Qt Creator. I even hooked > the build/run commands up to my qemu testing rig. Seems to work pretty > well. Here's the .pro I use: > > CONFIG -= qt > INCLUDEPATH = /usr/src/linux/arch/x86/include > /usr/src/linux/arch/x86/include/generated/uapi /usr/src/linux/ > arch/x86/include/generated /usr/src/linux/include > /usr/src/linux/arch/x86/include/uapi /usr/src/linux/arch/x > 86/include/generated/uapi /usr/src/linux/include/uapi > /usr/src/linux/include/generated/uapi > DEFINES = __KERNEL__ DEBUG MODULE > SOURCES = $$system(find -L . -type f -iname $$system_quote(*.c) -and > -not -path $$system_quote(./tests/*)) $ > $system(find -L . -type f -iname $$system_quote(*.S) -and -not -path > $$system_quote(./tests/*)) > HEADERS = $$system(find -L . -type f -iname $$system_quote(*.h) -and > -not -path $$system_quote(./tests/*)) > > As you can see, it's a real hack. > > I also do development on the main Linux kernel tree, and similarly for > that, I have a .pro file that works well: > > CONFIG -= qt > INCLUDEPATH = $$system(find -L include/ -type d) > SOURCES = $$system(find -L . -type f -iname \'*.c\') > HEADERS = $$system(find -L . -type f -iname \'*.h\') > INCLUDEPATH = include/ arch/x86/include > > Download the linux sources, put that in the tree, and load it up in Qt > Creator. It works. Amazing! > > But don't get too excited. Unfortunately, there are two issues that > make things unbearable: > > (A) Qt Creator doesn't seem to parse the C correctly. Things like > designated initializers and a few other C features here and there just > don't get parsed correctly, and the IDE stops being useful. I suspect > this is because things are actually being parsed in C++ mode. Bummer. > Developers: any interest in improving C support in Qt Creator? > > (B) There is no way to tell Qt Creator that a particular header file > is included in every file -- that is, that gcc's "-include" is in use. > There is a way of messing with the "C++ Code Model" on a file-by-file > basis, for the duration of the time that the file is open, but no way > to automatically have it included in every file of the project. This > is a major hindrance. It means that every ifdef for every kconfig > option is a grayed out unclickable region, rendering most things > useless. BTW, I'm facing similar issue with QtWebKit: config.h is included into all source files, but never in headers, so all #if's in headers are disabled and code model does not function properly. > Developers: any interest in fixing this? I spoke to a few of > you in IRC several months ago about this, and there was interest, but > it seems to have evaporated. > > So, anyway, if you think it would be cool to be able to say, "Qt > Creator is used for Linux Kernel Development!", then maybe we can work > together to actually get things working properly. It's already 85% > there, and the remaining chunk seems well within reach. > > Not only that, but if Qt Creator becomes generally usable for ordinary > C projects, it would most likely become a regular tool during my > professional activities, namely, auditing large code bases for > vulnerabilities and improving the security of systems. > > Let me know if you are interested in assisting with this. > > Thanks, > Jason > > [1] https://www.wireguard.io/ > [2] https://data.zx2c4.com/qt-creator-wireguard-development.png > _______________________________________________ > Qt-creator mailing list > Qt-creator@qt-project.org > http://lists.qt-project.org/mailman/listinfo/qt-creator -- Regards, Konstantin ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [Qt-creator] Qt Creator for Linux Kernel Development 2016-11-23 7:45 ` [Qt-creator] " Konstantin Tokarev @ 2016-11-28 18:03 ` Jason A. Donenfeld 2016-11-28 19:49 ` Marco Bubke ` (2 more replies) 2016-11-29 8:56 ` Nikolai Kosjar 1 sibling, 3 replies; 13+ messages in thread From: Jason A. Donenfeld @ 2016-11-28 18:03 UTC (permalink / raw) To: qt-creator; +Cc: WireGuard mailing list Hello All, Responses to each of you are inline below. Sounds to me like there's a lot of work to be done, still, and I haven't received any enthusiastic responses from the Qt team of, "yes! we'd love to work on this and make Qt Creator suitable for kernel development!" Bummer. Seems like a great opportunity to increase the tool's user appeal. On Wed, Nov 23, 2016 at 8:45 AM, Konstantin Tokarev <annulen@yandex.ru> wro= te: > BTW, I'm facing similar issue with QtWebKit: config.h is included into al= l > source files, but never in headers, so all #if's in headers are disabled > and code model does not function properly. Yep, this is pretty much entirely broken. It's not implemented in the Qt C++ model, and it straight up does not work in the clang mode model. The lack of good support for this feature -- project wide -include file -- is pretty limiting. On Wed, Nov 23, 2016 at 8:58 AM, Orgad Shaneh <orgads@gmail.com> wrote: > Which version do you use? Designated initializers support was added in 3.= 2 > (c56b999ffff249d4cb7dc7e8026a3297b63ff56d). > > I now see that the members are not detected correctly (for e.g. Find > Usages), but parsing looks ok. I'm using 4.1. No, it still does not work. Here's a screenshot: https://data.zx2c4.com/designated-init-broken-qt-creator-49b6f51f.png > You can set PRECOMPILED_HEADER =3D header.h in your pro file. It should b= e > applied to all sources. Nope, that's certainly not what that field does. On Wed, Nov 23, 2016 at 10:21 AM, Eike Ziller <Eike.Ziller@qt.io> wrote: > Are you using the ClangCodeModel plugin? If not, you probably should. > It does not help for things like find usages and locator, since for this = we still use the built-in model, > and fixes for the built-in model will be very limited. > But for working with the individual _source_ file it should at least help= . > I can even open Objective-C++ files and get decent highlighting and even > get some completion for Objective-C ;) The clang mode model is even more buggy than the built-in one. Not only that, but it's an order of magnitude slower too, which makes Qt Creator impossible to use. The only viable usage of the IDE is through the built-in code model. Hopefully the Qt engineers will put in the time to bring it up to par with modern times with -include, and add explicit C support... > One other issue are header files - there is no way Qt Creator can automat= ically tell if a > .h file is supposed to be C, C++, Objective-C, Objective-C++, .... > One hack workaround for C might be to remove *.h from the text/x-c++hdr m= ime type in Options > Environment > Mime Types, > but that would be a big and global hack (if it worked) ;) > We could probably provide a project setting for a =E2=80=9Cdefault=E2=80= =9D language to use though, which would then also be sharable with all in t= he project sources with a .shared file. A project-wide setting would indeed be most welcome for this. On Wed, Nov 23, 2016 at 5:15 PM, Andrzej Telszewski <atelszewski@gmail.com> wrote: > I don't remember exactly, but I used some other feature of QtC (Import > Project was it?). > It allowed to easily setup QtC for kernel development. > It worked pretty well, most of the time. > Just a quick search: > http://stackoverflow.com/questions/5417732/howto-prepare-qtcreator-for-li= nux-driver-kernel-development The solution listed here is basically wrong and doesn't work. The code model won't actually parse that #include properly. > > I too remember seeing false errors when code model parsed struct members > initializers. > > But this code seems to work just fine now: Try something slightly more complicated and it totally blows up again. See the linked screenshot above. > And yes, although I'm not going to be involved in enhancing QtC, I would > love to see C receiving decent support. > QtC is my main (well, the only) IDE, and I write both C and C++ code. If only the Qt developers cared about this too. Missed opportunity IMHO. Jason ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [Qt-creator] Qt Creator for Linux Kernel Development 2016-11-28 18:03 ` Jason A. Donenfeld @ 2016-11-28 19:49 ` Marco Bubke 2016-11-29 19:21 ` Jason A. Donenfeld 2016-11-28 21:34 ` André Pönitz 2016-11-29 8:55 ` Nikolai Kosjar 2 siblings, 1 reply; 13+ messages in thread From: Marco Bubke @ 2016-11-28 19:49 UTC (permalink / raw) To: Jason A. Donenfeld, qt-creator; +Cc: WireGuard mailing list =0A= =0A= On November 28, 2016 19:03:57 "Jason A. Donenfeld" <Jason@zx2c4.com> wrote:= =0A= =0A= > Hello All,=0A= >=0A= > Responses to each of you are inline below.=0A= >=0A= > Sounds to me like there's a lot of work to be done, still, and I=0A= > haven't received any enthusiastic responses from the Qt team of, "yes!=0A= > we'd love to work on this and make Qt Creator suitable for kernel=0A= > development!" Bummer. Seems like a great opportunity to increase the=0A= > tool's user appeal.=0A= >=0A= > On Wed, Nov 23, 2016 at 8:45 AM, Konstantin Tokarev <annulen@yandex.ru> w= rote:=0A= >> BTW, I'm facing similar issue with QtWebKit: config.h is included into a= ll=0A= >> source files, but never in headers, so all #if's in headers are disabled= =0A= >> and code model does not function properly.=0A= >=0A= > Yep, this is pretty much entirely broken. It's not implemented in the=0A= > Qt C++ model, and it straight up does not work in the clang mode=0A= > model. The lack of good support for this feature -- project wide=0A= > -include file -- is pretty limiting.=0A= >=0A= > On Wed, Nov 23, 2016 at 8:58 AM, Orgad Shaneh <orgads@gmail.com> wrote:= =0A= >> Which version do you use? Designated initializers support was added in 3= .2=0A= >> (c56b999ffff249d4cb7dc7e8026a3297b63ff56d).=0A= >>=0A= >> I now see that the members are not detected correctly (for e.g. Find=0A= >> Usages), but parsing looks ok.=0A= >=0A= > I'm using 4.1. No, it still does not work. Here's a screenshot:=0A= > https://data.zx2c4.com/designated-init-broken-qt-creator-49b6f51f.png=0A= >=0A= >> You can set PRECOMPILED_HEADER =3D header.h in your pro file. It should = be=0A= >> applied to all sources.=0A= >=0A= > Nope, that's certainly not what that field does.=0A= >=0A= > On Wed, Nov 23, 2016 at 10:21 AM, Eike Ziller <Eike.Ziller@qt.io> wrote:= =0A= >> Are you using the ClangCodeModel plugin? If not, you probably should.=0A= >> It does not help for things like find usages and locator, since for this= we still use the built-in model,=0A= >> and fixes for the built-in model will be very limited.=0A= >> But for working with the individual _source_ file it should at least hel= p.=0A= >> I can even open Objective-C++ files and get decent highlighting and even= =0A= >> get some completion for Objective-C ;)=0A= >=0A= > The clang mode model is even more buggy than the built-in one. Not=0A= > only that, but it's an order of magnitude slower too, which makes Qt=0A= > Creator impossible to use. The only viable usage of the IDE is through=0A= > the built-in code model. Hopefully the Qt engineers will put in the=0A= > time to bring it up to par with modern times with -include, and add=0A= > explicit C support...=0A= =0A= What is exactly buggy? The code model can handle C but we need that informa= tion from the project management. QMake isn't differentiating between C and= C++ headers, so we simply don't get that information. Like other have wri= tten there could be workarounds. Anyway it would be interesting what is you= r environment that makes the clang code model so slow. It's quite fine for = me. There is the header guard bug which is vanishing with #pragma once. Wha= t are actually your problems? =0A= =0A= >=0A= >> One other issue are header files - there is no way Qt Creator can automa= tically tell if a=0A= >> .h file is supposed to be C, C++, Objective-C, Objective-C++, ....=0A= >> One hack workaround for C might be to remove *.h from the text/x-c++hdr = mime type in Options > Environment > Mime Types,=0A= >> but that would be a big and global hack (if it worked) ;)=0A= >> We could probably provide a project setting for a =93default=94 language= to use though, which would then also be sharable with all in the project s= ources with a .shared file.=0A= >=0A= > A project-wide setting would indeed be most welcome for this.=0A= >=0A= >=0A= > On Wed, Nov 23, 2016 at 5:15 PM, Andrzej Telszewski=0A= > <atelszewski@gmail.com> wrote:=0A= >> I don't remember exactly, but I used some other feature of QtC (Import= =0A= >> Project was it?).=0A= >> It allowed to easily setup QtC for kernel development.=0A= >> It worked pretty well, most of the time.=0A= >> Just a quick search:=0A= >> http://stackoverflow.com/questions/5417732/howto-prepare-qtcreator-for-l= inux-driver-kernel-development=0A= >=0A= > The solution listed here is basically wrong and doesn't work. The code=0A= > model won't actually parse that #include properly.=0A= >=0A= >>=0A= >> I too remember seeing false errors when code model parsed struct members= =0A= >> initializers.=0A= >>=0A= >> But this code seems to work just fine now:=0A= >=0A= > Try something slightly more complicated and it totally blows up again.=0A= > See the linked screenshot above.=0A= >=0A= >> And yes, although I'm not going to be involved in enhancing QtC, I would= =0A= >> love to see C receiving decent support.=0A= >> QtC is my main (well, the only) IDE, and I write both C and C++ code.=0A= >=0A= > If only the Qt developers cared about this too. Missed opportunity IMHO.= =0A= >=0A= > Jason=0A= > _______________________________________________=0A= > Qt-creator mailing list=0A= > Qt-creator@qt-project.org=0A= > http://lists.qt-project.org/mailman/listinfo/qt-creator=0A= ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [Qt-creator] Qt Creator for Linux Kernel Development 2016-11-28 19:49 ` Marco Bubke @ 2016-11-29 19:21 ` Jason A. Donenfeld 0 siblings, 0 replies; 13+ messages in thread From: Jason A. Donenfeld @ 2016-11-29 19:21 UTC (permalink / raw) To: Marco Bubke; +Cc: WireGuard mailing list, qt-creator Hi Marco, I'll start compiling a list for you, so that I can give you something more useful than my last message. For starters, here's one bug found within seconds: 1. Open a file in the project. All seems fine. 2. Ctrl click on a function that points to somewhere in the Linux kernel headers. 3. Close that file. Now there are all sorts of non-nonsensical clang errors in the original file. Here's a video to demonstrate: https://data.zx2c4.com/qt-creator-clang-model-bug-ff94c572-d8ff-4c54-a5ac-3aa6485251a9.mp4 Jason ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [Qt-creator] Qt Creator for Linux Kernel Development 2016-11-28 18:03 ` Jason A. Donenfeld 2016-11-28 19:49 ` Marco Bubke @ 2016-11-28 21:34 ` André Pönitz 2016-11-29 8:55 ` Nikolai Kosjar 2 siblings, 0 replies; 13+ messages in thread From: André Pönitz @ 2016-11-28 21:34 UTC (permalink / raw) To: Jason A. Donenfeld; +Cc: WireGuard mailing list, qt-creator On Mon, Nov 28, 2016 at 07:03:39PM +0100, Jason A. Donenfeld wrote: > Hello All, > > Responses to each of you are inline below. > > Sounds to me like there's a lot of work to be done, still, and I > haven't received any enthusiastic responses from the Qt team of, "yes! > we'd love to work on this and make Qt Creator suitable for kernel > development!" I didn't know the Qt Creator team was supposed to be in the cheer-leading business. Andre' ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [Qt-creator] Qt Creator for Linux Kernel Development 2016-11-28 18:03 ` Jason A. Donenfeld 2016-11-28 19:49 ` Marco Bubke 2016-11-28 21:34 ` André Pönitz @ 2016-11-29 8:55 ` Nikolai Kosjar 2016-11-29 19:23 ` Jason A. Donenfeld 2016-11-30 8:43 ` Orgad Shaneh 2 siblings, 2 replies; 13+ messages in thread From: Nikolai Kosjar @ 2016-11-29 8:55 UTC (permalink / raw) To: Jason A. Donenfeld, qt-creator; +Cc: WireGuard mailing list On 11/28/2016 07:03 PM, Jason A. Donenfeld wrote: > On Wed, Nov 23, 2016 at 8:45 AM, Konstantin Tokarev <annulen@yandex.ru> wrote: >> You can set PRECOMPILED_HEADER = header.h in your pro file. It should be >> applied to all sources. > > Nope, that's certainly not what that field does. Should work with the Clang Code Model, Qt Creator from the current 4.2 branch. The corresponding report was https://bugreports.qt.io/browse/QTCREATORBUG-15590. Nikolai ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [Qt-creator] Qt Creator for Linux Kernel Development 2016-11-29 8:55 ` Nikolai Kosjar @ 2016-11-29 19:23 ` Jason A. Donenfeld 2016-11-30 8:41 ` Nikolai Kosjar 2016-11-30 8:43 ` Orgad Shaneh 1 sibling, 1 reply; 13+ messages in thread From: Jason A. Donenfeld @ 2016-11-29 19:23 UTC (permalink / raw) To: Nikolai Kosjar; +Cc: WireGuard mailing list, qt-creator Hi Nikolai, On Tue, Nov 29, 2016 at 9:55 AM, Nikolai Kosjar <nikolai.kosjar@qt.io> wrote: > Should work with the Clang Code Model, Qt Creator from the current 4.2 > branch. > > The corresponding report was > https://bugreports.qt.io/browse/QTCREATORBUG-15590. Okay, in that case, I'll wait until 4.2 for it. One question: PRECOMPILED_HEADER -- will this take a list, or only a single value? By the way, I figured out an alternative workaround in the meantime. I add to "clang code model warnings" box the string "-include /path/to/header.h". Jason ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [Qt-creator] Qt Creator for Linux Kernel Development 2016-11-29 19:23 ` Jason A. Donenfeld @ 2016-11-30 8:41 ` Nikolai Kosjar 0 siblings, 0 replies; 13+ messages in thread From: Nikolai Kosjar @ 2016-11-30 8:41 UTC (permalink / raw) To: Jason A. Donenfeld; +Cc: WireGuard mailing list, qt-creator On 11/29/2016 08:23 PM, Jason A. Donenfeld wrote: > Hi Nikolai, > > On Tue, Nov 29, 2016 at 9:55 AM, Nikolai Kosjar <nikolai.kosjar@qt.io> wrote: >> Should work with the Clang Code Model, Qt Creator from the current 4.2 >> branch. >> >> The corresponding report was >> https://bugreports.qt.io/browse/QTCREATORBUG-15590. > > > Okay, in that case, I'll wait until 4.2 for it. One question: > PRECOMPILED_HEADER -- will this take a list, or only a single value? Providing a list, the code model gets a list :) Nikolai ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [Qt-creator] Qt Creator for Linux Kernel Development 2016-11-29 8:55 ` Nikolai Kosjar 2016-11-29 19:23 ` Jason A. Donenfeld @ 2016-11-30 8:43 ` Orgad Shaneh 1 sibling, 0 replies; 13+ messages in thread From: Orgad Shaneh @ 2016-11-30 8:43 UTC (permalink / raw) To: Nikolai Kosjar; +Cc: WireGuard mailing list, qt-creator On Tue, Nov 29, 2016 at 10:55 AM, Nikolai Kosjar <nikolai.kosjar@qt.io> wrote: > On 11/28/2016 07:03 PM, Jason A. Donenfeld wrote: >> >> On Wed, Nov 23, 2016 at 8:45 AM, Konstantin Tokarev <annulen@yandex.ru> >> wrote: >>> >>> You can set PRECOMPILED_HEADER = header.h in your pro file. It should be >>> applied to all sources. >> >> >> Nope, that's certainly not what that field does. > > > Should work with the Clang Code Model, Qt Creator from the current 4.2 > branch. > > The corresponding report was > https://bugreports.qt.io/browse/QTCREATORBUG-15590. It should also work with the built-in code model. Not sure why Jason claimed it doesn't. Did you try it? - Orgad ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [Qt-creator] Qt Creator for Linux Kernel Development 2016-11-23 7:45 ` [Qt-creator] " Konstantin Tokarev 2016-11-28 18:03 ` Jason A. Donenfeld @ 2016-11-29 8:56 ` Nikolai Kosjar 1 sibling, 0 replies; 13+ messages in thread From: Nikolai Kosjar @ 2016-11-29 8:56 UTC (permalink / raw) To: Konstantin Tokarev, Jason A. Donenfeld, qt-creator; +Cc: WireGuard mailing list On 11/23/2016 08:45 AM, Konstantin Tokarev wrote: > 23.11.2016, 08:51, "Jason A. Donenfeld" <jason@zx2c4.com>: >> Hello Eike & Qt Creator mailing list, >> >> I'm insane and decided to try using an IDE for Linux kernel >> development. Much to my delight, it actually works well. (Everybody on >> the mailing list to which this message is cross-posted just vomited a >> little bit in their mouth and swallowed, but fear not: I'm a competent >> VIM user too. It's just that sometimes clickity clicking around Qt >> Creator is buttery nice. Here's a screenshot [2].) >> >> I'm working on a small kernel module [1], and for it I made a very >> minimal .pro file to import its files into Qt Creator. I even hooked >> the build/run commands up to my qemu testing rig. Seems to work pretty >> well. Here's the .pro I use: >> >> CONFIG -= qt >> INCLUDEPATH = /usr/src/linux/arch/x86/include >> /usr/src/linux/arch/x86/include/generated/uapi /usr/src/linux/ >> arch/x86/include/generated /usr/src/linux/include >> /usr/src/linux/arch/x86/include/uapi /usr/src/linux/arch/x >> 86/include/generated/uapi /usr/src/linux/include/uapi >> /usr/src/linux/include/generated/uapi >> DEFINES = __KERNEL__ DEBUG MODULE >> SOURCES = $$system(find -L . -type f -iname $$system_quote(*.c) -and >> -not -path $$system_quote(./tests/*)) $ >> $system(find -L . -type f -iname $$system_quote(*.S) -and -not -path >> $$system_quote(./tests/*)) >> HEADERS = $$system(find -L . -type f -iname $$system_quote(*.h) -and >> -not -path $$system_quote(./tests/*)) >> >> As you can see, it's a real hack. >> >> I also do development on the main Linux kernel tree, and similarly for >> that, I have a .pro file that works well: >> >> CONFIG -= qt >> INCLUDEPATH = $$system(find -L include/ -type d) >> SOURCES = $$system(find -L . -type f -iname \'*.c\') >> HEADERS = $$system(find -L . -type f -iname \'*.h\') >> INCLUDEPATH = include/ arch/x86/include >> >> Download the linux sources, put that in the tree, and load it up in Qt >> Creator. It works. Amazing! >> >> But don't get too excited. Unfortunately, there are two issues that >> make things unbearable: >> >> (A) Qt Creator doesn't seem to parse the C correctly. Things like >> designated initializers and a few other C features here and there just >> don't get parsed correctly, and the IDE stops being useful. I suspect >> this is because things are actually being parsed in C++ mode. Bummer. >> Developers: any interest in improving C support in Qt Creator? >> >> (B) There is no way to tell Qt Creator that a particular header file >> is included in every file -- that is, that gcc's "-include" is in use. >> There is a way of messing with the "C++ Code Model" on a file-by-file >> basis, for the duration of the time that the file is open, but no way >> to automatically have it included in every file of the project. This >> is a major hindrance. It means that every ifdef for every kconfig >> option is a grayed out unclickable region, rendering most things >> useless. > > BTW, I'm facing similar issue with QtWebKit: config.h is included into all > source files, but never in headers, so all #if's in headers are disabled > and code model does not function properly. Could you provide a report for this with a minimal example? Nikolai ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [Qt-creator] Qt Creator for Linux Kernel Development 2016-11-23 5:51 Qt Creator for Linux Kernel Development Jason A. Donenfeld 2016-11-23 7:45 ` [Qt-creator] " Konstantin Tokarev @ 2016-11-23 7:58 ` Orgad Shaneh 2016-11-23 9:21 ` Eike Ziller 2 siblings, 0 replies; 13+ messages in thread From: Orgad Shaneh @ 2016-11-23 7:58 UTC (permalink / raw) To: Jason A. Donenfeld; +Cc: WireGuard mailing list, qt-creator [-- Attachment #1: Type: text/plain, Size: 1429 bytes --] On Wed, Nov 23, 2016 at 7:51 AM, Jason A. Donenfeld <Jason@zx2c4.com> wrote: > (A) Qt Creator doesn't seem to parse the C correctly. Things like > designated initializers and a few other C features here and there just > don't get parsed correctly, and the IDE stops being useful. I suspect > this is because things are actually being parsed in C++ mode. Bummer. > Developers: any interest in improving C support in Qt Creator? > Which version do you use? Designated initializers support was added in 3.2 ( c56b999ffff249d4cb7dc7e8026a3297b63ff56d). I now see that the members are not detected correctly (for e.g. Find Usages), but parsing looks ok. (B) There is no way to tell Qt Creator that a particular header file > is included in every file -- that is, that gcc's "-include" is in use. > There is a way of messing with the "C++ Code Model" on a file-by-file > basis, for the duration of the time that the file is open, but no way > to automatically have it included in every file of the project. This > is a major hindrance. It means that every ifdef for every kconfig > option is a grayed out unclickable region, rendering most things > useless. Developers: any interest in fixing this? I spoke to a few of > you in IRC several months ago about this, and there was interest, but > it seems to have evaporated. > You can set PRECOMPILED_HEADER = header.h in your pro file. It should be applied to all sources. - Orgad [-- Attachment #2: Type: text/html, Size: 2062 bytes --] ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [Qt-creator] Qt Creator for Linux Kernel Development 2016-11-23 5:51 Qt Creator for Linux Kernel Development Jason A. Donenfeld 2016-11-23 7:45 ` [Qt-creator] " Konstantin Tokarev 2016-11-23 7:58 ` Orgad Shaneh @ 2016-11-23 9:21 ` Eike Ziller 2 siblings, 0 replies; 13+ messages in thread From: Eike Ziller @ 2016-11-23 9:21 UTC (permalink / raw) To: Jason A. Donenfeld; +Cc: WireGuard mailing list, qt-creator DQo+IE9uIE5vdiAyMywgMjAxNiwgYXQgNjo1MSBBTSwgSmFzb24gQS4gRG9uZW5mZWxkIDxKYXNv bkB6eDJjNC5jb20+IHdyb3RlOg0KPiANCj4gSGVsbG8gRWlrZSAmIFF0IENyZWF0b3IgbWFpbGlu ZyBsaXN0LA0KPiANCj4gSSdtIGluc2FuZSBhbmQgZGVjaWRlZCB0byB0cnkgdXNpbmcgYW4gSURF IGZvciBMaW51eCBrZXJuZWwNCj4gZGV2ZWxvcG1lbnQuIE11Y2ggdG8gbXkgZGVsaWdodCwgaXQg YWN0dWFsbHkgd29ya3Mgd2VsbC4gKEV2ZXJ5Ym9keSBvbg0KPiB0aGUgbWFpbGluZyBsaXN0IHRv IHdoaWNoIHRoaXMgbWVzc2FnZSBpcyBjcm9zcy1wb3N0ZWQganVzdCB2b21pdGVkIGENCj4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ENv bXBhbnkgR21iSA0KUnVkb3dlciBDaGF1c3NlZSAxMw0KRC0xMjQ4OSBCZXJsaW4NCmVpa2Uuemls bGVyQHF0LmlvDQpodHRwOi8vcXQuaW8NCkdlc2Now6RmdHNmw7xocmVyOiBNaWthIFDDpGxzaSwg SnVoYSBWYXJlbGl1cywgVHV1bGEgSGFhdGFqYQ0KU2l0eiBkZXIgR2VzZWxsc2NoYWZ0OiBCZXJs aW4sIFJlZ2lzdGVyZ2VyaWNodDogQW10c2dlcmljaHQgQ2hhcmxvdHRlbmJ1cmcsIEhSQiAxNDQz MzEgQg0KDQoNCg0KDQo= ^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2016-11-30 8:39 UTC | newest] Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2016-11-23 5:51 Qt Creator for Linux Kernel Development Jason A. Donenfeld 2016-11-23 7:45 ` [Qt-creator] " Konstantin Tokarev 2016-11-28 18:03 ` Jason A. Donenfeld 2016-11-28 19:49 ` Marco Bubke 2016-11-29 19:21 ` Jason A. Donenfeld 2016-11-28 21:34 ` André Pönitz 2016-11-29 8:55 ` Nikolai Kosjar 2016-11-29 19:23 ` Jason A. Donenfeld 2016-11-30 8:41 ` Nikolai Kosjar 2016-11-30 8:43 ` Orgad Shaneh 2016-11-29 8:56 ` Nikolai Kosjar 2016-11-23 7:58 ` Orgad Shaneh 2016-11-23 9:21 ` Eike Ziller
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).