Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
HOWTO set the HOME environment variable when debugging on target
vikramg last edited by
I am launching an application for debug on an RPi target from a Linux x86-64 host, via QtCreator. Strangely, the
HOMEenv variable does not get set when debugging. As a result, reads from QSettings etc fail because the application is trying to read from an incorrect location. (When running normally without debugging, the environment gets set correctly).
From here: https://doc.qt.io/qtcreator/creator-debugger-engines.html it should be possible to add "GDB commands after GDB has been started, but before the debugged program is started or attached" in the "Additional startup commands" field in Project settings. I tried adding the following:
set environment HOME = /home/pi set environment FOO = /home/pi
and printing out the vars from my application, and FOO gets printed out correctly, but HOME is still empty. I can force HOME to get set via
qputenvand that works. But I'd like to avoid doing that if possible. So my questions are:
- Why does the gdb environment setting not work for the HOME variable?
- Is there an environment variable that gets set only when debugging so I can at least qualify the qputenv with that? (i.e. perform the qputenv of HOME only when the app is being debugged).