Author Topic: Script execution and environment issue  (Read 6711 times)

Offline Folco

  • Regular
  • ***
  • Posts: 343
    • Folco's blog (68k lover)
Script execution and environment issue
« on: October 18, 2010, 11:18:12 am »
Hi,


I can't succeed in executing a script using the "Tools" menu.

In the "Settings -> Environment -> General settings" dialog, I have set :
- Shell to run command in : "/bin/bash -c"
- Terminal to launch console programs : "konsole"

In the "Tools" menu, I have added this tool :
- Name : "Build"
- Executable : "konsole"
- Parameters : "--noclose --workdir ${PROJECT_DIR} -e build.sh"
- Working directory : <none>
- Launching options : "Launch tool visible detached (without output redirection)"

But when I launch the tool, I get this message :
Code
Warning: Could not find 'build.sh', starting '/bin/bash' instead.  Please check your profile settings.

folco@Weygand:/mnt/Data/Programmation/TI/Perso/pdt/pdtlib/src$
"build.sh" is not found !
Code
folco@Weygand:/mnt/Data/Programmation/TI/Perso/pdt/pdtlib/src$ ls build.sh
build.sh
folco@Weygand:/mnt/Data/Programmation/TI/Perso/pdt/pdtlib/src$
Why is it not found ? Where am I wrong ?

The log of Code::Blocks says that :
Code
Launching tool 'Build': konsole --noclose --workdir /mnt/Data/Programmation/TI/Perso/pdt/pdtlib/src/ -e build.sh
(in /mnt/Data/Programmation/TI/Perso/pdt/pdtlib/src)
This seems right ?


How to get build.sh to be executed (the file is executable of course, it runs fine from a terminal) ?



I use C::B svn 6714 (the current one today) with Kubuntu 10.10 64 bits, compiled by myself.
« Last Edit: October 18, 2010, 03:38:40 pm by Folco »
Kernel Extremist - PedroM power ©

Offline Folco

  • Regular
  • ***
  • Posts: 343
    • Folco's blog (68k lover)
Re: Script execution and environment issue
« Reply #1 on: October 22, 2010, 02:31:27 pm »
Nobody seems to have an idea ? :(

So could some developper say to me where I should look for in the sources to see what I can do to my command to be processed right, please ?


Ok, I advance in the problem: I'have remplaced 'build.sh' with './build.sh. Now my script is called.

but I get an internal error :
Code
/mnt/Data/Programmation/TI/Perso/pdt/pdtlib/src/build.sh: line 5: tigcc: command not found
tigcc is a compiler installed by myself, and I had already added that in my ~/.bashrc:
Code
# GCC4TI
export TIGCC=/usr/local/share/gcc4ti
export PATH=$PATH:$TIGCC/bin
The Konsole app seems to be launched without looking at my .bashrc...

I also created a ~/.bash_profile, adding these exports, but I get always the same error.

How to solve that ? (I do want to avoid to call 'tigcc' with its absolute path in my build.sh script).
« Last Edit: October 22, 2010, 02:45:02 pm by Folco »
Kernel Extremist - PedroM power ©

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7252
Re: Script execution and environment issue
« Reply #2 on: October 22, 2010, 02:50:09 pm »
Does the same command work from commandline ?

Offline Folco

  • Regular
  • ***
  • Posts: 343
    • Folco's blog (68k lover)
Re: Script execution and environment issue
« Reply #3 on: October 22, 2010, 03:12:16 pm »
I have modified the Build tool, now it is set like that :

Executable: konsole
Parameters: --noclose -e ./build.sh
Working dir.: ${PROJECT_DIR}
And "Launch tool visible detached"

C::B log says that :
Launching tool 'Build': konsole --noclose -e ./build.sh (in /mnt/Data/Programmation/TI/Perso/pdt/pdtlib/src)

But I get the error in my script : "/mnt/Data/Programmation/TI/Perso/pdt/pdtlib/src/build.sh: line 7: tigcc: command not found"

If I execute by hand , in konsole:
[folco@home]$ konsole --noclose -e ./build.sh
I get the expected result : my script is executed in a new Konsole window, and 'tigcc' is found, so compilation works fine.


So the same command does work from commandline.
« Last Edit: October 22, 2010, 03:15:39 pm by Folco »
Kernel Extremist - PedroM power ©

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13406
    • Travis build status
Re: Script execution and environment issue
« Reply #4 on: October 22, 2010, 03:37:15 pm »
Is bash your default shell?

What is the result of "echo $PATH" is you execute it in the first konsole?
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline Folco

  • Regular
  • ***
  • Posts: 343
    • Folco's blog (68k lover)
Re: Script execution and environment issue
« Reply #5 on: October 22, 2010, 05:00:15 pm »
Yes, bash is my default term.

"echo $PATH" in my build.sh script sends /usr/bin:/home/folco/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/sbin:/bin:/usr/games.
Indeed, /usr/local/share/gcc4ti/bin is not here... :(
Always in this script, "echo $TERM" and "echo $SHELL" says the same thing that in a console started from the K menu:
Code
folco@Weygand:~$ echo $TERM
xterm
folco@Home:~$ echo $SHELL
/bin/bash
folco@Home:~$ echo $PATH
/home/folco/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/share/gcc4ti/bin

I didn't find anything in ~/* and /etc/ to configure konsole, to say it to use ~/.bashrc at boot.
In the "Settings -> Environment -> General settings" dialog, I have set :
- Shell to run command in : "/bin/bash -c"
- Terminal to launch console programs : "konsole"

If you think this is not a CB issue, I will ask on another forum...
Thanks for your help.
« Last Edit: October 22, 2010, 05:16:58 pm by Folco »
Kernel Extremist - PedroM power ©

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13406
    • Travis build status
Re: Script execution and environment issue
« Reply #6 on: October 22, 2010, 05:39:09 pm »
Yes, this is not a C::B issue...

You'll have better luck in your distro's forum/ML.
Another option is to try another terminal, but I think this is a distro/configuration problem.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline Folco

  • Regular
  • ***
  • Posts: 343
    • Folco's blog (68k lover)
Re: Script execution and environment issue
« Reply #7 on: October 22, 2010, 05:53:14 pm »
Ok, thank you for all the help already given. :)
Kernel Extremist - PedroM power ©

Offline Folco

  • Regular
  • ***
  • Posts: 343
    • Folco's blog (68k lover)
Re: Script execution and environment issue
« Reply #8 on: October 23, 2010, 05:11:40 pm »
Eh... my problem is solved... but I didn't change anything !
Perhaps I needed to reboot C::B, or my PC ? I don't know, but I did it, and now it works, without changing anything in the configuration I gave here (2 posts above).

So if you get trouble with shell/console when setting up a tool, just try to restart C::B or your PC.

Thanks again. :)
Kernel Extremist - PedroM power ©

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13406
    • Travis build status
Re: Script execution and environment issue
« Reply #9 on: October 23, 2010, 06:26:56 pm »
Linux is not windows, it doesn't require a restart for most of the things :)
For changes in the env will be detected, you log out then log in :)
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]