Author Topic: simple problem with path maybe?  (Read 5233 times)

Offline noidian

  • Single posting newcomer
  • *
  • Posts: 5
simple problem with path maybe?
« on: July 31, 2012, 05:55:22 pm »
Hi,

I have installed the codeblocks 10.05. on ubuntu lucid.

The problem is the hello world startup throws error:

Compiling: main.cpp
execvp(g++ -Wall -fexceptions  -O2     -c /media/Data/pcie_driver/main.cpp -o /media/Data/pcie_driver/obj/Release/main.o) failed with error 2!
Process terminated with status 255 (0 minutes, 0 seconds)
0 errors, 0 warnings

I have tried changing the  Project->properties and modifying the settings etc.

The command works fine by itself in bash shell.

Any help would be great.

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: simple problem with path maybe?
« Reply #1 on: July 31, 2012, 08:57:16 pm »
Do you have the g++-package installe ?
If yes, what happens, if you use the same command in a console ?

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: simple problem with path maybe?
« Reply #2 on: July 31, 2012, 09:20:46 pm »
If yes, what happens, if you use the same command in a console ?
The command works fine by itself in bash shell.

Did you select a different shell in C::B - other than the bash you used fore testing?
Did you use a different parametrisation of the same shell in C::B and for testing?
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: simple problem with path maybe?
« Reply #3 on: July 31, 2012, 09:48:22 pm »
If yes, what happens, if you use the same command in a console ?
The command works fine by itself in bash shell.

Did you select a different shell in C::B - other than the bash you used fore testing?
Did you use a different parametrisation of the same shell in C::B and for testing?

 ??? Totally overread that, sorry.
What is the compilers masterpath of the toolchain ?

You can try to put the env command in the projects prebuild steps to see, whether the PATH-variable is correct, so g++ can be run.

The return value of 2 of execvp means ENOENT as far as I know.
ENOENT = no such file or directory

Offline noidian

  • Single posting newcomer
  • *
  • Posts: 5
Re: simple problem with path maybe?
« Reply #4 on: August 01, 2012, 04:40:20 pm »
Hi,

Thanks for the responses.

Quote
Did you select a different shell in C::B - other than the bash you used fore testing?
I assume the C::B uses the bash shell by default.  So I am not sure how to go about changing that.


Quote
Did you use a different parametrisation of the same shell in C::B and for testing?
I guess no, since I have no exact idea of how to change out of the bash shell in C::B.

Quote
What is the compilers masterpath of the toolchain ?
I went to -> Settings->Compiler and..-> Toolchan exec

in that for g++ is /usr/bin

which I presume is the compiler masterpath, your asking for.

Quote
You can try to put the env command in the projects prebuild steps to see, whether the PATH-variable is correct, so g++ can be run.

I tried adding /usr/bin to the bash as PATH=$PATH:/usr/bin/g++ , export PATH
Adding that path to the prebuild in Project- > build options, still throws an error 2.
(Is this what you meant?)






Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: simple problem with path maybe?
« Reply #5 on: August 01, 2012, 04:52:23 pm »
The masterpath is not correct, there is a red note in the toolchain executables tab, that says, that the master path is the path without the bin !

Just put env in your prebuild step to see what path is used.
/usr/bin should be automatically in path anyways.

What output do you get if you type g++ --version on a console ?

Offline noidian

  • Single posting newcomer
  • *
  • Posts: 5
Re: simple problem with path maybe?
« Reply #6 on: August 01, 2012, 06:40:01 pm »
The masterpath is /usr alone. I have also attached a print screen of the toolchain window.

Adding "env" to the prebuild path gave me this
Code
Running target pre-build steps
env
GDM_KEYBOARD_LAYOUT=us
GNOME_KEYRING_PID=1387
USER=venkak2
HOME=/home/venkak2
XDG_SESSION_COOKIE=74d71d281f69a358b940af214fec4118-1343832244.477641-747832526
DESKTOP_SESSION=gnome
GTK_MODULES=canberra-gtk-module
GNOME_KEYRING_CONTROL=/tmp/keyring-th4bcF
MANDATORY_PATH=/usr/share/gconf/gnome.mandatory.path
LOGNAME=venkak2
DEFAULTS_PATH=/usr/share/gconf/gnome.default.path
USERNAME=venkak2
GDM_LANG=en_US.UTF-8
PATH=/usr/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/sbin:/bin:/usr/games
DISPLAY=:0.0
LANG=en_US.UTF-8
XAUTHORITY=/var/run/gdm/auth-for-venkak2-rbxGCm/database
SHELL=/bin/bash
GDMSESSION=gnome
SPEECHD_PORT=7561
PWD=/home/venkak2
XDG_CONFIG_DIRS=/etc/xdg/xdg-gnome:/etc/xdg
XDG_DATA_DIRS=/usr/share/gnome:/usr/local/share/:/usr/share/
LIBGL_DRIVERS_PATH=/usr/lib/fglrx/dri:/usr/lib32/fglrx/dri
SSH_AUTH_SOCK=/tmp/keyring-th4bcF/ssh
SSH_AGENT_PID=1441
DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-kV2H1bAoFK,guid=2510adacb591559824110b2c501940b4
GNOME_DESKTOP_SESSION_ID=this-is-deprecated
SESSION_MANAGER=local/labroot:@/tmp/.ICE-unix/1405,unix/labroot:/tmp/.ICE-unix/1405
ORBIT_SOCKETDIR=/tmp/orbit-venkak2
G_FILENAME_ENCODING=UTF-8
LD_LIBRARY_PATH=

-------------- Build: Release in newtest ---------------

g++ -Wall -fexceptions  -O2      -c /home/venkak2/newtest/main.cpp -o /home/venkak2/newtest/obj/Release/main.o
execvp(g++ -Wall -fexceptions  -O2      -c /home/venkak2/newtest/main.cpp -o /home/venkak2/newtest/obj/Release/main.o) failed with error 2!
Process terminated with status 255 (0 minutes, 0 seconds)
0 errors, 0 warnings


>>g++ --version

op:  g++ (Ubuntu 4.4.3-4ubuntu5.1) 4.4.3

 

[attachment deleted by admin]
« Last Edit: August 01, 2012, 06:43:27 pm by noidian »