News:

Accounts with zero posts and zero activity during the last months will be deleted periodically to fight SPAM!

Main Menu

Does cb_console_runner clear LD_LIBRARY_PATH????

Started by dpu, October 21, 2008, 11:08:55 PM

Previous topic - Next topic

dpu

If I run a program from within Code::Blocks:
Executing: xterm -T OsgVertexProgramTest -e /usr/bin/cb_console_runner /home/dunrau/src/dev/OsgVertexProgramTest/bin/Debug/OsgVertexProgramTest  (in /home/dunrau/src/dev/OsgVertexProgramTest/.)
LD_LIBRARY_PATH is not set, although other environment variables I define are.  Why is this happening?  More details below:

I'm running Code::Blocks 8.02 on ubuntu 8.10.  I have a console app that needs some directories in LD_LIBRARY_PATH so that the required libraries can be found at run time.  When I run the program from code::blocks, the libraries cannot be found.  When I debug from within Code::Blocks, or run from a shell outside of Code::Blocks, the program runs fine.  This is irrespective of whether I define LD_LIBRARY_PATH in my .bashrc, in Code::Blocks environment variables, or add the directories to the project->Build Options->Search directories->Linker area.

With this test program:
#include <iostream>
#include <cstdlib>

using namespace std;

void printEnv(const char* pName)
{
    char* pValue = getenv(pName);
    if (pValue)
    {
        cout << pName << "=" << pValue << endl;
    }
    else
    {
        cout << pName << " not set" << endl;
    }
}


int main()
{
    char input[256];
    cout << "Hello world!" << endl;

    printEnv("PATH");
    printEnv("DU_TEST");
    printEnv("LD_LIBRARY_PATH");
    printEnv("OSG_FILE_PATH");
    cin >> input;
    return 0;
}

I can see that LD_LIBRARY_PATH values that I set are fine every way I run the program except if I run it from the Code::Blocks run icon.  When I run the program this way, LD_LIBRARY_PATH is not set.

Any ideas why this is happening????  It seems  this topic is the same problem: http://forums.next.codeblocks.org/index.php/topic,9197.0.html, but no solutions are listed....

MortenMacFly

Quote from: dpu on October 21, 2008, 11:08:55 PM
Any ideas why this is happening????

It's written in my post of the other thread you refer to:
Quote from: dpu on October 21, 2008, 11:08:55 PM
http://forums.next.codeblocks.org/index.php/topic,9197.0.html

I'm afraid you need to modify the C::B sources slightly... Look for "LD_LIBRARY_PATH" in compilergcc.cpp of the compiler plugin. I can't tell more as I am not a Linux guy. Probably some other devs can provide additional information.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: [url="https://www.codeblocks.org/docs/main_codeblocks_en.html"]https://www.codeblocks.org/docs/main_codeblocks_en.html[/url]
C::B FAQ: [url="https://wiki.codeblocks.org/index.php?title=FAQ"]https://wiki.codeblocks.org/index.php?title=FAQ[/url]

dpu

#2
Thanks - looks like that is the code that is controlling this.  So, this is a bug then.  I looked through compiler.gcc and I can't see an obvious problem.  I can't find a bug report on this.  Should I raise one???