0

So heres my issue....

I have my application1 where I start up another application2 through a QProcess. Application2 has dependencies on Qt shared libraries, so before I start up the QProcess, I set the QProcess system environment to the current environment in Application1, where my LD_LIBRARY_PATH is pointing to the Qt shared libs so like in the code below:

void MyClass::setEnvironment()
{
    QProcessEnvironment env = QProcessEnvironment::systemEnvironment();
    m_process->setProcessEnvironment(env);
    QStringList envList = m_process->systemEnvironment();
    m_process->setWorkingDirectory(m_project->path());
}

after this i call a QProcess::start, where my exitStatus returns a QProcess::CrashExit.

I tried debugging application2 but I get this error before it even enters main. After looking into the kernel logs I encountered this error:

Jul 23 09:30:40 centos7-gui kernel: application2[23290]: segfault at 38 ip 00002b4916d67969 sp 00007fff1b2e7c30 error 4 in libQt5Core.so.5.3.1[2b4916c36000+510000]

Again, Ive checked the system environment after setting it, and the LD_LIBRARY_PATH is what it needs to be. Also, if I run application2 seperately, and not within application1 through a QProcess, it works fine.

Does anyone have any suggestions on what this could be or how I could fix it? This is killing me!

auth private
  • 1,318
  • 1
  • 9
  • 22
  • Is there anything returned by `readAllStandardError()` and `readAllStandardOutput()`? – Timo Jul 23 '15 at 20:22
  • Yes there was but I found the problem. Sort of a bone head move on my part. I was trying to attach GDB to the process through Qt Creator, but since my application didnt have an exec() call, the debugger would never break so I would only see a Segfault error when trying. I found that I had to suspend the process somewhere at the beginning of main so I could correctly attach to the process in the place I needed to debug it, and found the crash in one of my own functions. – user3827379 Jul 23 '15 at 22:08
  • I'm glad you found the answer. Suggestion for your next question: Try to provide a [Minimal, Complete, and Verifiable example](http://stackoverflow.com/help/mcve). You're more likely to get a good answer. – Timo Jul 23 '15 at 22:17

0 Answers0