Code::Blocks Forums

User forums => Help => Topic started by: Leo.J90 on November 24, 2010, 11:31:09 am

Title: Can't compile on Gentoo
Post by: Leo.J90 on November 24, 2010, 11:31:09 am
I'm trying to compile and get this on build log:
Quote
Checking for existence: /home/leo/Documents/AdPa/bin/Release/AdPa
Executing: xterm -T AdPa -e /usr/bin/cb_console_runner LD_LIBRARY_PATH=$LD_LIBRARY_PATH:. /home/leo/Documents/AdPa/bin/Release/AdPa  (in /home/leo/Documents/AdPa/.)
Process terminated with status 255 (0 minutes, 0 seconds)
 

I don't understand what's the problem. From console if i do "g++ -Wall main.cpp Func.h -o AdPa" everything works fine.
Title: Re: Can't compile on Gentoo
Post by: Jenna on November 24, 2010, 11:39:21 am
Why do you think compilation does not work ?
I can see nothing about that in your build log snippet.

Do you have xterm installed ?
Title: Re: Can't compile on Gentoo
Post by: thomas on November 24, 2010, 12:33:11 pm
This 255 value comes from line 73 in consolerunner/main.cpp:
int ret = system(cmdline);.

man system(3) says: "The value returned is -1 on error (e.g. fork() failed), and the return status of the command otherwise". The valid xterm error codes are in the range [1,45], which rules out clause no. 2.

Which means that (assuming your computer isn't unable to fork() because it has a million processes running) in all likelihood you either don't have xterm installed at all or it is not in the path, or something the like.
Title: Re: Can't compile on Gentoo
Post by: oBFusCATed on November 24, 2010, 12:55:20 pm
Thomas, Jens: Do you know if it is possible to make cb_console_runner to spit an error when terminal launching fails?
This problem is happening quite too often and there is no clue for the user how to fix it on his/her own.
Title: Re: Can't compile on Gentoo
Post by: Leo.J90 on November 24, 2010, 02:24:20 pm
Well, that's true i forgot to install xterm. :?

Thanks!
Title: Re: Can't compile on Gentoo
Post by: thomas on November 24, 2010, 05:25:41 pm
Thomas, Jens: Do you know if it is possible to make cb_console_runner to spit an error when terminal launching fails?
Well, that'd be something like changing that line 73 to:
int ret;
if((ret = system(cmdline)) == -1) printf("Error: failed to launch xterm. Make sure xterm is installed on your system");


Should be as trivial as that, but I have no Linux system to test.
Title: Re: Can't compile on Gentoo
Post by: Jenna on November 25, 2010, 12:10:53 am
Thomas, Jens: Do you know if it is possible to make cb_console_runner to spit an error when terminal launching fails?
Well, that'd be something like changing that line 73 to:
int ret;
if((ret = system(cmdline)) == -1) printf("Error: failed to launch xterm. Make sure xterm is installed on your system");


Should be as trivial as that, but I have no Linux system to test.

If the terminal does not exist (xterm in this case, but others can be configured), cb_console_runner will not be started, because cb_console_runner is executed inside the termnal and not vice-versa.

So the correct place to check for the return-value would be in CompilerGCC::OnJobEnd, but only if we tried to run the exe and not after compiling or whatever.
So it's not just as trivial as it looks at first time.