Using run.sh from another program (Qt)

Applications, development tools, FPGA, C, WEB
Post Reply
grafzahl
Posts: 11
Joined: Mon Mar 02, 2015 2:34 pm

Using run.sh from another program (Qt)

Post by grafzahl » Tue Mar 24, 2015 3:07 pm

Hi,

I want to use the run.sh 'IP' command from a GUI.
I work with Qt and made a button, which will start a subprocess:

Code: Select all

void MainWindow::CompileAndTransfer()
{
    QProcess *compAndtrans;
    compAndtrans = new QProcess(this);
    compAndtrans->setWorkingDirectory("/home/username/RedPitaya/SDK/");
    compAndtrans->start("./run.sh 'IP'");
    compAndtrans->waitForFinished();
    QString strOut = compAndtrans->readAllStandardOutput();
    qDebug() << strOut;
}
Output is:

Code: Select all

"make: Entering directory `/home/molsyst/RedPitaya/SDK/src'
rm -f api_test *.o ~* 
make: Leaving directory `/home/molsyst/RedPitaya/SDK/src'
make: Entering directory `/home/molsyst/RedPitaya/SDK/src'
arm-linux-gnueabi-gcc -c -g -std=gnu99 -Wall -Werror -I ../include/ trig-aqui.c -o trig-aqui.o
make: Leaving directory `/home/molsyst/RedPitaya/SDK/src'
" 
But neither "trig-aqui.o" nor "api_test" is in the dir, as it is usually after running the run.sh script from the shell.

Does anybody have an idea?

Tanks in advance
Graf Zahl

Nils Roos
Posts: 1441
Joined: Sat Jun 07, 2014 12:49 pm
Location: Königswinter

Re: Using run.sh from another program (Qt)

Post by Nils Roos » Tue Mar 24, 2015 9:23 pm

Hi,

My first guess would be that the compilation failed, eg. because the arm-linux-gnueabi-gcc compiler is not on any path that the Qt environment knows about.
I am not familiar with Qt specifics, but it looks like you capture only the standard output. To see error messages in the output, add "2>&1" to the command.

Code: Select all

compAndtrans->start("./run.sh 'IP' 2>&1");
Maybe things become clearer then.
All in a day's work for Bicycle Repair Man

grafzahl
Posts: 11
Joined: Mon Mar 02, 2015 2:34 pm

Re: Using run.sh from another program (Qt)

Post by grafzahl » Wed Mar 25, 2015 2:42 pm

You are right:

Code: Select all

QProcess *compile1;
compile1 = new QProcess(this);
compile1->start(arm-linux-gnueabi-gcc);
qDebug() << compile1->errorString(); 

Code: Select all

"No such file or directory"
But why does Qt not know a program, which the terminal knows?

grafzahl
Posts: 11
Joined: Mon Mar 02, 2015 2:34 pm

Re: Using run.sh from another program (Qt)

Post by grafzahl » Thu Mar 26, 2015 10:09 am

I had to use the full path of all programs, in this case:
Makefile:
CROSS_COMPILE = ../gcc_linaro/bin/arm-linux-gnueabi-

Now it works fine 8-)

Post Reply
jadalnie klasyczne ekskluzywne meble wypoczynkowe do salonu ekskluzywne meble tapicerowane ekskluzywne meble do sypialni ekskluzywne meble włoskie

Who is online

Users browsing this forum: No registered users and 7 guests