Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » C / C++ IDE (CDT) » CDT Linking Problems
CDT Linking Problems [message #166959] Thu, 30 March 2006 13:39 Go to next message
Eclipse UserFriend
Originally posted by: cabernet.obado.net

My configuration:

Fedora Core 5
Java: gij (GNU libgcj) version 4.1.0
Eclipse: 3.1.2 M20060118-1600
CDT: 3.0.2

I'm having some trouble executing my C++ managed make project... I've got
three different projects in the mix here:

1. Project A: Exectable (Gnu)
References Projects B and C

2. Project B: Shared Library (Gnu)
References Project C

3. Project C: Shared Library (Gnu)

Build order is B, C, A

When I do a rebuild all on project A, I don't get any errors or warnings,
but when I try to execute the binary I get the following error:

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

Okay, after much head banging, I run try running ldd on the exectable and
get:

libC.so => not found
libB.so => not found

It seems that there is some kind of linking problem, so I then did a
rebuild on project B only. I also got no errors, but when I ran ldd on the
binary libB.so I got:

libC.so => not found

Odd. I have the full paths to these libraries in my Library search path
under the C/C++ Build configuration, and the process definitely complains
if that path is not correct (I tried it).

Finally, I added the paths to the output binaries for projects B and C to
/etc/ld.so.conf and ran ldconfig. After that, my executables ran fine and
were able to resolve the shared libraries...

Shouldn't CDT automate this in some way? It seems odd that I would have to
go to these lengths to get shared libraries to work in a development
environment, but I am new to CDT. Am I missing something?

Thanks!
Re: CDT Linking Problems [message #167128 is a reply to message #166959] Fri, 31 March 2006 14:26 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: arne.anka.ginguppin.de

have a look at your project's properties -> c/c++ project paths ->
libraries. maybe it does what you want?
Re: CDT Linking Problems [message #167159 is a reply to message #167128] Fri, 31 March 2006 15:00 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: cabernet.obado.net

Hmm... I don't have a configuration area for Project Paths... perhaps
because they are managed make projects?

I do have an area under properties -> C/C++ Build -> Tool Settings -> GCC
C++ Linker -> Libraries which allows me to set two things, the Libraries
(-l) and the Library search path (-L). I have the required libraries
listed in the Library area and the proper search path listed in the
Library Search Path area. I even tried removing those entries and the
whole build failed at the link stage, so it is definitely looking at the
values I put in there...

--Chris
Re: CDT Linking Problems [message #167216 is a reply to message #166959] Mon, 03 April 2006 08:36 Go to previous messageGo to next message
Anton Leherbauer is currently offline Anton LeherbauerFriend
Messages: 490
Registered: July 2009
Senior Member
I suppose you need to set the LD_LIBRARY_PATH to the location(s) of your
shared libraries when you run the executable. You can do this in the
Environment Tab of the Launch Configuration.
I don't think that CDT managed make is expected to do this autmagically
for you.

HTH,
Toni


Chris Abernethy wrote:
> My configuration:
>
> Fedora Core 5
> Java: gij (GNU libgcj) version 4.1.0
> Eclipse: 3.1.2 M20060118-1600
> CDT: 3.0.2
>
> I'm having some trouble executing my C++ managed make project... I've
> got three different projects in the mix here:
>
> 1. Project A: Exectable (Gnu)
> References Projects B and C
>
> 2. Project B: Shared Library (Gnu)
> References Project C
>
> 3. Project C: Shared Library (Gnu)
>
> Build order is B, C, A
>
> When I do a rebuild all on project A, I don't get any errors or
> warnings, but when I try to execute the binary I get the following error:
>
> error while loading shared libraries: libC.so: cannot open shared object
> file: No such file or directory
>
> Okay, after much head banging, I run try running ldd on the exectable
> and get:
>
> libC.so => not found
> libB.so => not found
>
> It seems that there is some kind of linking problem, so I then did a
> rebuild on project B only. I also got no errors, but when I ran ldd on
> the binary libB.so I got:
>
> libC.so => not found
>
> Odd. I have the full paths to these libraries in my Library search path
> under the C/C++ Build configuration, and the process definitely
> complains if that path is not correct (I tried it).
>
> Finally, I added the paths to the output binaries for projects B and C
> to /etc/ld.so.conf and ran ldconfig. After that, my executables ran fine
> and were able to resolve the shared libraries...
>
> Shouldn't CDT automate this in some way? It seems odd that I would have
> to go to these lengths to get shared libraries to work in a development
> environment, but I am new to CDT. Am I missing something?
>
> Thanks!
>
>
Re: CDT Linking Problems [message #167270 is a reply to message #167159] Tue, 04 April 2006 05:56 Go to previous messageGo to next message
Norbert Plött is currently offline Norbert PlöttFriend
Messages: 233
Registered: July 2009
Senior Member
Hi Chris,

> I do have an area under properties -> C/C++ Build -> Tool Settings -> GCC
> C++ Linker -> Libraries which allows me to set two things, the Libraries

this will help the _compiler/linker_ to find the libraries, but when you try
to launch the program then your _operating system_ must find them. That's
why you needed ldconfig to make this work.

So much for the diagnosis.
Not sure whether this can be automated from eclipse. You need root
privileges to run ldconfig, right?

Sorry, only little help


Norbert Ploett
Re: CDT Linking Problems [message #167292 is a reply to message #167270] Tue, 04 April 2006 07:13 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: arne.anka.ginguppin.de

> this will help the _compiler/linker_ to find the libraries, but when you
> try
> to launch the program then your _operating system_ must find them. That's
> why you needed ldconfig to make this work.

uhm. right -- but this can be fixed by setting LD_LIBRARY_PATH correctly
in thge launcher's "environment"-tab.
mostly with a value like $LD_LIBRARY_PATH:mylibpathA:mylibpathB
Re: CDT Linking Problems [message #167464 is a reply to message #167216] Wed, 05 April 2006 17:33 Go to previous message
Eclipse UserFriend
Originally posted by: cabernet.obado.net

Thanks to everyone who suggested this, it fixed the problem for me.

--Chris
Previous Topic:debugging under linux (fc5)
Next Topic:C Source Folder
Goto Forum:
  


Current Time: Fri Sep 27 13:30:25 GMT 2024

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

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

Back to the top