Skip to main content



      Home
Home » Language IDEs » C / C++ IDE (CDT) » Is it possible to set the linux library path for shared libraries?
Is it possible to set the linux library path for shared libraries? [message #192376] Fri, 01 June 2007 08:10 Go to next message
Eclipse UserFriend
Originally posted by: objectivedynamics.homail.com

Hi,

Let me firstly say that I'm relatively new to both Eclipse and Linux so
please forgive me if I'm asking a dumb question here ;o)

I am developing a library that is intended to run on both Linux and Windows
(XP) and I am using Eclipse as the IDE.

I am able to compile, link, run and debug the program without problems on XP
and I'm able to compile and link the program on (Ubuntu 7.04) Linux.
However, I run into problems when I try to execute the program on Linux. I
get the following error:

error while loading shared libraries: libaeryn_core.so.2: cannot open
shared object file: No such file or directory

The file does exist but it's not in a standard place - it's in
/home/mike/development/Aeryn/build/lib.

Can anyone tell me how I can set up Eclipse so that when the application is
loaded, it will locate the correct shared library?

Rgds,
MikeB
Re: Is it possible to set the linux library path for shared libraries? [message #192383 is a reply to message #192376] Fri, 01 June 2007 09:12 Go to previous messageGo to next message
Eclipse UserFriend
MikeB wrote:
> However, I run into problems when I try to execute the program on Linux. I
> get the following error:
>
> error while loading shared libraries: libaeryn_core.so.2: cannot open
> shared object file: No such file or directory
>
> The file does exist but it's not in a standard place - it's in
> /home/mike/development/Aeryn/build/lib.
>
> Can anyone tell me how I can set up Eclipse so that when the application
> is loaded, it will locate the correct shared library?

You just have to ensure that LD_LIBRARY_PATH
contains /home/mike/development/Aeryn/build/lib. I suggest you add
export LD_LIBRARY_PATH=/home/mike/development/Aeryn/build/lib
to your .bashrc so that you can start your program even outside of eclipse.

If you really want to restrict this to eclipse try to set this environment
variable somewhere in the launch configuration.

Jens
Re: Is it possible to set the linux library path for shared libraries? [message #192402 is a reply to message #192383] Fri, 01 June 2007 10:55 Go to previous message
Eclipse UserFriend
Originally posted by: objectivedynamics.homail.com

>"Jens Seidel" <jensseidel@users.sf.net> wrote in message
>news:f3p60m$gkp$1@build.eclipse.org...
>You just have to ensure that LD_LIBRARY_PATH
>contains /home/mike/development/Aeryn/build/lib. I suggest you add
>export LD_LIBRARY_PATH=/home/mike/development/Aeryn/build/lib
>to your .bashrc so that you can start your program even outside of eclipse.

Thanks for the suggestion Jens.

I just discovered how to set LD_LIBRARY_PATH in the application's launch
configuration and was about to post a follow-up when I saw your reply.

Whilst I'm happy to set LD_LIBRARY_PATH in the launch configuration, I'm
less happy about doing it in .bashrc as I've seen bad press regarding
LD_LIBRARY_PATH :
http://xahlee.org/UnixResource_dir/_/ldpath.html

Having looked into it a bit further, LD has an -rpath option which adds a
directory to the runtime library search path for the application.
So, I am able to set
-rpath /home/mike/development/Aeryn/build/lib
in Project Properties, miscellaneous settings for the GCC C++ Linker

After doing this, I'm able to run the application from both Eclipe and bash
without setting LD_LIBRARY_PATH at all.

Rgds,
MikeB
Previous Topic:Opening the CDT as a PDE project in Eclipse.
Next Topic:Problem debugging with cygwin
Goto Forum:
  


Current Time: Thu May 08 06:26:04 EDT 2025

Powered by FUDForum. Page generated in 0.05590 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top