Results 1 to 6 of 6

Thread: Whats wrong with this script -- help needed

  1. #1
    Join Date
    Oct 2006
    Posts
    75
    Thanks
    10
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Whats wrong with this script -- help needed

    hi,
    In the process of deploying Qt-4.5.1 application on RHEL5 built with bitrock install builder, the installer is executing a script to change environment variables. the script looks like this.

    script file name : myscript.sh

    Qt Code:
    1. #!/bin/bash
    2. export LD_LIBRARY_PATH=$PWD:$LD_LIBRARY_PATH
    3. export PATH=$PWD:$PATH
    To copy to clipboard, switch view to plain text mode 

    As compiler related and Qt library files are also present the application directory, I am trying to set library and executable path to application directory.
    when i ran that script, even from console externally, I not getting any error, but the environment variables are not at all changed. But when i do the following at the prompt, its getting set for the session and vanishing after i close the console and reopen it again.

    Qt Code:
    1. #export export LD_LIBRARY_PATH=$PWD:$LD_LIBRARY_PATH
    2. #export PATH=$PWD:$PATH
    To copy to clipboard, switch view to plain text mode 

    where is the problem?
    how can i set/ change environment variables through my Qt application permanently?

    I have also tried the following in my Qt application

    Qt Code:
    1. int main(..)
    2. {
    3. .....
    4. QApplication::addLibraryPath("$PWD");
    5. ......
    6. }
    To copy to clipboard, switch view to plain text mode 

    Im not successful with any of those option.. pls suggest your valuable points.

    my Qt application will run on Linux as well as on Windows (with mingw compiler).

    thank u very much in advance.. pls post ur suggestions.

  2. #2
    Join Date
    Jun 2008
    Location
    Germany/Belarus/Sweden
    Posts
    53
    Thanks
    3
    Thanked 1 Time in 1 Post
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Whats wrong with this script -- help needed

    Have you tried gentenv & setenv?
    QApplication::addLibraryPath(getenv("PWD"));

  3. #3
    Join Date
    Oct 2006
    Posts
    75
    Thanks
    10
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Whats wrong with this script -- help needed

    thanks fr ur reply Acer. i tried that also,but nothing happened. by searching i learned that,the script is forking another process whose env wil vanish once it comes out of execution. i tried to set env vars for my app just before it starts executing.i think the only alternative is to edit the /etc/bashrc file and change the required vars through some API in my qt app itself.can somebody pls let me know how can i edit /etc/bashrcthru qt or 'C' ?

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Whats wrong with this script -- help needed

    Quote Originally Posted by swamyonline View Post
    how can i set/ change environment variables through my Qt application permanently?
    You can't. The environment you have in the application is a copy of the environment the parent process had. Once you end your application its environment will be destroyed and the parent will still have the same environment it had before launching your application.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  5. #5
    Join Date
    Apr 2008
    Posts
    196
    Thanked 8 Times in 6 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows
    Wiki edits
    1

    Default Re: Whats wrong with this script -- help needed

    Hi swamyonline,

    This has nothing to do, but why do you use non-RPM if you work on RHEL5. This has the advantage that it also resolves dependencies.

    If you need help in building rpms don't be shy to sent me a PM.
    I use it for many projects.

    Kind Regards
    NoRulez

  6. #6
    Join Date
    Oct 2006
    Posts
    75
    Thanks
    10
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Whats wrong with this script -- help needed

    hi NoRulez,

    thanks for your reply. me shy? not at all when learning new things. yes, i desperately need such an implementation. pls suggest your points. eagerly looking forward. thanks again. bye

Similar Threads

  1. Qt Script
    By c_srikanth1984 in forum Qt Programming
    Replies: 3
    Last Post: 9th June 2009, 10:35
  2. Can I include a script from script?
    By yycking in forum Qt Programming
    Replies: 1
    Last Post: 24th April 2009, 03:01
  3. Replies: 2
    Last Post: 2nd June 2008, 08:45
  4. Testing app with Qt Script
    By Angelo Moriconi in forum Qt Programming
    Replies: 5
    Last Post: 23rd October 2007, 08:20
  5. How to use PERL script in Qt
    By joseph in forum Qt Programming
    Replies: 1
    Last Post: 9th August 2007, 21:57

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.