To specify Valgrind settings for the current project:In previous blog posts I've covered how to configure Qt Creator for development on Linux (1), Windows (2) and MacOS (3) desktop systems and for embedded development on the Raspberry Pi (4).After you download and install Valgrind tools, you can use Memcheck from Qt Creator. You can specify Valgrind settings either globally for all projects or separately for each project. You can configure the tools according to your needs. Qt Creator integrates Valgrind code analysis tools for detecting memory leaks and profiling function execution. Specifying Valgrind Settings.
![]() Valgrind For Qt Creator Install Valgrind ToolsThe steps and screenshots in this post will be based on the the most recent version of Qt Creator at the time of writing, 4.3.0 RC1.I should note that the instructions here are for a generic Yocto system. As an appendix to this blog post I've included brief instructions on how to build a Yocto image for the ARM-based emulator that includes Qt 5, as well as how to build a toolchain.I also assume you have a working Qt Creator, probably already set up for a desktop version of Qt. If you don't already have a toolchain or have a particular hardware platform in mind, you can build one for the Yocto simulator. Click Add., select Generic Linux Device then Start Wizard. And Click on the Devices tab. To do this Select Tools/Options. In my case it will be the Yocto emulator. ConfigurationTo set up Qt Creator for our Yocto toolchain, we need to do the following:We need to set up our embedded system as a device. Wd my passport for mac not working on pcWe add the Yocto cross-compiler by clicking on Add / GCC / C++. Then click on the Compilers tab.You'll probably see one or more compilers already there for native development. In the Tools/Options screen, click on the Build & Run tab. The settings I used for the Yocto emulator are shown below:Now we need to add our cross-compiler. Select Next and then Finish.Qt Creator will test connectivity with the device, so you should have it up and running when you do this, if possible. Click on the Debuggers tab, click on Add, and enter the name and path to your cross-debugger. Add the DebuggerI won't cover debugging and other tools in this blog post, but in order to debug we need to add a suitable debugger. If so, select Add / GCC / C and enter the path to the appropriate version of gcc from your SDK. For the Yocto SDK I was using, the settings are shown below:If you might be doing development in C (maybe to cross-compile some third party code), you might want to also set up a C compiler. ![]() Set Up the EnvironmentWe need to do one more thing. I found I needed to enter a suitable value in the "Qt mkspec" field, in my case "linux-oe-g++", in order for it to generate the correct Makefile. Having it be incorrect doesn't seem to bother the actual build, but in recent versions of Qt Creator (since this blog was written) the Clang code model can't find Qt with the x86 value and shows warnings or errors in the source editor.One quirk of Qt Creator is that it seems to always want to run qmake with the -mkspec option. The Sysroot: value should be /opt/poky/2.2.1/sysroots/x86_64-pokysdk-linux rather than /opt/poky/2.2.1/sysroots/armv5e-poky-linux-gnueabi. The sysroot in the kit should be set to the ARM sysroot and not the x86 sysroot, i.e. ![]() This is what I used:Here are the actual settings in case you want to copy and paste them:CC =arm -poky -linux -gnueabi -gcc -march =armv5e -marm -sysroot = /opt /poky /2.2.1 /sysroots /armv5e -poky -linux -gnueabiCCACHE_PATH = /opt /poky /2.2.1 /sysroots /x86_64 -pokysdk -linux /usr /bin : /opt /poky /2.2.1 /sysroots /x86_64 -pokysdk -linux /usr /bin /. Under Environment: for the kit and paste in the environment variables, one per line. You can then click on Change. A third option is to add the environment variables to your project settings, but that means adding it to every project that uses the kit.In my case I determined the environment needed by running the environment script and seeing what variables it set. This option is a little more work to set up, but avoids the issues of the shell setup. You can add the environment variables to the kit’s settings. PriOE_QMAKE_RCC = /opt /poky /2.2.1 /sysroots /x86_64 -pokysdk -linux /usr /bin /qt5 /rccOE_QMAKE_UIC = /opt /poky /2.2.1 /sysroots /x86_64 -pokysdk -linux /usr /bin /qt5 /uicPATH = /opt /poky /2.2.1 /sysroots /x86_64 -pokysdk -linux /usr /bin /qt5 : /opt /poky /2.2.1 /sysroots /x86_64 -pokysdk -linux /usr /bin : /opt /poky /2.2.1 /sysroots /x86_64 -pokysdk -linux /usr /sbin : /opt /poky /2.2.1 /sysroots /x86_64 -pokysdk -linux /bin : /opt /poky /2.2.
0 Comments
Leave a Reply. |
AuthorChristian ArchivesCategories |