Setting the search path environment variable for shared libraries

Aleix Pol aleixpol at kde.org
Mon Jun 29 13:31:43 BST 2020


On Mon, Jun 29, 2020 at 1:56 AM Steve the Fiddle
<stevethefiddle at gmail.com> wrote:
>
>
>
> On Sun, 28 Jun 2020 at 22:32, René J.V. Bertin <rjvbertin at gmail.com> wrote:
>>
>> On Sunday June 28 2020 20:25:26 Steve the Fiddle wrote:
>>
>> >wxWidgets is installed at "/opt/wxWidgets/lib/", and this is set in
>> >"~/.bashrc" with:
>> >"export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/wxWidgets/lib/"
>>
>> A more proper way to work with this kind of install would be to add /opt/wxWidgets/lib to Audacity's rpath. Or, if any and all wxWidgets apps should use the libraries there you could add the location to ldconfig.
>
>
> The version of wxWidgets required for this app is not available in my distro (Xubuntu 18.04), so I only want to use this build of wxWidgets for this project only.
>
> I'd prefer to avoid modifying CMakeLists.txt because it's under version control (and I'm not yet familiar enough with cmake)

That's correct too. You should never have to modify your CMake scripts
to have something run on your system.

>
>>
>>
>> >It appears that kdevelop ignores LD_LIBRARY_PATH
>>
>> I think it's rather the contrary, i.e. that KDevelop resets that variable.
>>
>> >How do I tell kdevelop where to find wxWidgets so that I can launch and
>> >debug from within kdevelop?
>>
>> IIRC you can associate an environment profile to your debug configuration, and set your variable(s) that way.
>
>
> That's what I'm trying to do, but I can't get it to work, and I've not found any documentation for how to.
>
> I was guessing that I need to set it in:
> "Settings > Configure kdevelop > Environment"
> with:
> Variable: LD_LIBRARY_PATH
> Value: /opt/wxWidgets/lib/
>
> and then select that Environment Profile in:
> "Run > Configure Launches"
>
> but that doesn't work.
>
>
>>
>>
>> An alternative approach would be to launch Audacity like you would normally (except the debug build), and then attach KDevelop's debugger to the running process. This is typically faster if you're not debugging the startup phase itself, sometimes a lot faster.
>
>
> Unfortunately that does not work if I launch Audacity from a shell script (the only way so far that I can get it to launch from within kdevelop).
>
> My thinking is that if I can set the "environment profile" correctly, then Audacity should launch. Am I misunderstanding the "environment profile" feature in kdevelop?

That's what it does.
You can configure your launcher through "Run > Configure Launches...".
Make sure you have the right profile set on the launcher
configuration. I use the feature quite often.

You can see what's happening by trying to start a terminal instead of
your application.

Aleix


More information about the KDevelop mailing list