I have an application that I run on an Embedded Linux device.
In Eclipse, I can run remote debugging using the eclipse-cdt-launch-remote plugin where I point a binary to run, and where to put it on the device with some environment variables to be exported before running the application.
The application is a C++ application with a custom Makefile for building the application as an ELF file.
The application is deployed on the device via SSH, using login with user and password. And then, I can debug from Eclipse using stepping and so on.
(I am also using the MentorGraphics crosscompiler for arm-none-linux-gnueabi-2014.05)
My question is: How do I mimic the same functionality in Qt Creator since I like coding with Qt Creator more than coding with Eclipse?
I know that an easy fix would be to code in Qt Creator, and then debug using Eclipse, but I really want to debug using Qt Creator.
Edit: Solved it by hours of testing and reading up on the Qt Creator
IDE.
Imported my project that was an Makefile project.
Then I went in to Options under Tools and added my Device that used SSH.
After that I added a debugger, I used gdb-multiarch since the one provided in the prebuilt toolchain binary did not support python.
Then I added my custom toolchain pointing the compiler path to the toolchains binary g++. And set the ABI to
arm-linux-generic-elf-32bit. Although I dont actually see the
compiler settings being used during debug.
I created a new kit using my Device, Debugger, and Compiler. And set device type to Generic Linux Device. Pointing to my sysroot that
I extracted when using buildroot for the filesystem. These were the
only options I set in the kit.
Closed the options menu, and went into Projects where I added my new kit
Changed the build settings and set the build directory and build steps for the application.
Changed the run settings to use some custom commands, like moving the newly built .elf application to target. And then I set where the
local executable was and where the remote executable was. The remote
executable is the one I moved to the target using custom command from
host.
Voila! I could now run remote debugging on my target from Qt Creator.
Qt Creator has built-in support for automatic deploy on remote devices.
On the Embedded Linux device:
Create a login password for the root user
Install the openssh-server and gdb-server packages
On Qt Creator:
Enter Tools > Options > Devices and create a new device specifying address (i.e. IP and port numbers) and credentials (i.e. root and password). Further information available here.
Enter Tools > Options > Build & Run > Compilers and add the gcc cross-compiler path (further information available here)
Enter Tools > Options > Build & Run > Debuggers and add the gdb cross-debugger path (further information available here)
As the last step, finally enter Tools > Options > Build & Run > Kits and link compiler, debugger and device into a single Kit, also specifying the sysroot (i.e. local copy of the embedded Linux root filesystem).
Set the build target to Debug.
In the Qt project, check that all deploy steps are selected (e.g. transfer file to the remote device) and add any needed argument (e.g. -qws for touchscreen on Qt 4.x)
In general, have a look at the guide here.
Related
I am running Linux Mint 18.3 and QtCreator (Qt version 5.15 installed from Qt installer download from Qt site, not repository binaries for the distrubution) and developing a C++ GUI application. Because of the openSSL mismatch between native Mint SSL version and that used by Qt5.12 onwards, I have installed the OpenSSL1.1.1d binaries via the Qt Maintenance Tool and have explicitly added these libraries to my application project.
Without this step nothing works. With this step, my application runs successfully when initiated WITHIN QtCreator, but not when I just run the binaries outside of it.
I know that I must be missing something simple here, but what is QtCreator doing that enables access to SSL? I have tried creating simlinks to these libraries (libcrypto.so.1.1 and libssl.so.1.1) locally within the binary directory but this has no effect.
I would like to be able to run my application without having to do so inside of QtCreator but so far I can find no workaround to allow this. Can anyone suggest what I am missing?
I can confirm that the output of calls to my QSslSocket::sslLibraryVersionString() function are returning empty string and "OpenSSL 1.1.1d" respectively, so I am convinced this is a runtime linking problem.
I installed Qt Creator 5.10.1 and when I built the project I had a error : "Could not determine which ”make“ command to run. Check the ”make“ step in the build configuration.”.
I have already install Qt on another PC and I saw this question "Could not determine which "make" command to run. Check the "make" step in the build configuration." Qt creator
but in Tools > Options > Build & Run > Kits I have lot of Desktop Qt 5.10.1 so he have 1.
Sorry for my english as I'm french and I 13 so my skill is limited
https://www.dropbox.com/s/lg17a54pdgj9923/screen.png?dl=0
You can see the selected build kit in the Build Kit Selector located at the bottom left of your window (button with the hammer image).
You can also manage any of the Build Kits if you go to Tools > Options > Build & Run.
For any build kit in Qt, you need to have the following components:
Device - You can build your application or your desktop/local computer or a remote computer or device with a different or same kind of processor.
Compiler - Specify the location of a compatible C++ compiler here. Clicking on manage takes you to the Compilers tab where you can add as many compilers as you want. If you are on Windows, you will most likely have a MinGW compiler installed along with Qt at this location - C:\Qt\Tools\MinGW\bin\gcc.exe. You can also select a compiler installed with Visual Studio which will be a MSVC compiler.
Qt Version - The last thing you need to specify is the Qmake builder which is in Qt Version. You will need to select this with the appropriate C++ compiler that you previously selected in this build kit. If you have a MinGW C++ compiler, then specify a path for a MinGw qmake.exe and if it is a MSVC compiler then select a MSVC based qmake.exe. On Windows, all your qmake.exe's will be located at C:\Qt\<Qt-version>\<compiler-version&type>\bin\qmake.exe.
Keep in mind that if you are building the project for a different processor or operating system, you will need an appropriate compiler and Qmake selected.
Once you select these properly (and select that build kit in selector), your project will build properly.
Let's take this simple C/C++ application Netbeans project folder.
In Netbeans IDE, we just hit build button on the toolbar to build the application.
I want to do that automatically via Windows command line, how can I do that?
I did google, and found some related posts though not very helpful for me except telling me to call ant dist - though I don't have the build.xml in my Netbeans 8 project.
p.s. I have hundreds of student submissions and need to verify which one is compilable.
I also post on Netbeans forum here.
I want to do that automatically via Windows command line, how can I do that?
NetBeans uses Makefile-based projects as default for C/C++ projects, so you can use make to build your project:
cd <Project dir>
make
It's also possible to build other make-targets (eg. make all or make test (builds / runs tests)).
Note: The Cygwin bin dir (CYGWIN_HOME\bin) must be in system PATH - same applies to other environments (MinGW, Gcc etc).
I use Qt Creator 2.8.1 on Windows, no deployment menu (configure) available.
Cross compile for ARM target device.
I defined toolchain which is ok except GDB, cross compiler and kit (all together).
The application is built either in debug and release mode but two things I need more:
executable name is always *.exe. This is a linux ARM binary, cannot change this?
deploy not available at all (neither run menu)
I must scp by hand, change attributes and run. Can be automatic little bit?
However, I can create a batch file witch pscp but isn't suppose Qt Creator handle this?
It is only the matter of proper toolchain and deployment setup. Here you can find the screenshots of mine from my QtCreator session where you can customize the kit and deployment as you wish.
Please make sure you have the right "-spec" argument there because that will determine the toolchain used, and it is important to be set up properly.
As for the deployment, you can put the commands in there that you would otherwise put into your Windows batch file, et al.
Ok, I found the problem here, thanks stackoverflow:
Raspberry pi on Qt 5.1.1: Remote path not set
In the project .pro file must be set the remote path for deploying:
target.path = /root/john/qt
INSTALLS += target
And now, the deployment works as expected.
There is one problem more... on my XP, executable is with .exe extension. In the same project .pro file, must change:
TARGET = untitled1.exe
If anyone knows how to get ride of .exe extension, appreciate.
Thanks all for suggestions,
I am using eclipse IDE. I have here some basic source code including header file. Have been using cygwin as C++ compiler. It compiles my app and it does not produce any error. But I cannot see the output on IDE's console. When I run the executable file on its own it produces output. How to configure Eclipse IDE in order to redirect output to the IDE's console?
This is all I get:
15:40:11 **** Incremental Build of configuration Debug for project GetCompiled ****
make all
Building target: GetCompiled.exe
Invoking: Cygwin C++ Linker
g++ -o "GetCompiled.exe" ./Compiling.o
cygwin warning:
MS-DOS style path detected: D:\Aristotelis\C++\GetCompiled\Debug
Preferred POSIX equivalent is: /cygdrive/d/Aristotelis/C++/GetCompiled/Debug
CYGWIN environment variable option "nodosfilewarning" turns off this warning.
Consult the user's guide for more details about POSIX paths:
http://cygwin.com/cygwin-ug-net/using.html#using-pathnames
Finished building target: GetCompiled.exe
15:40:12 Build Finished (took 702ms)
Selected app to run:
I tried to run the exe file from the IDE by selecting to run as an C++ app, but it does not produce any output.
Best regards
Eclipse/CDT does not automatically run your application after each build. You need to either go trough the menu Run->Open Run->Run or use the keyboard shortcut Crtl+F11, and then check the Console window again.
An advanced feature is to set your application as a post-build event. For that, go to your Build Settings and find the appropriate submenu and type the name of your application.exe there (haven't got Eclipse at my fingertips right now). With this setting, the application will be launched automatically after each successful build. This comes in handy if you do automated unit testing.