For Programmers: Free Programming Magazines  


Home > Archive > Unix Programming > September 2007 > Re: Linking in a module?









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: Linking in a module?
red floyd

2007-09-23, 7:11 pm

Trespasser wrote:
> Hi,
>
> When I try to execute a program called cnet I get an error like:
>
> [root@duenna stopandwait]$ cnet -s -m 1 STOPANDWAIT
> cnet: error while loading shared libraries: libelf.so.0: cannot open shared
> object file: No such file or directory
>
> I think that means that the runtime loader can't find a file to link with
> the cnet program. I do have the file libelf.so.0 in /usr/local/lib, but I've
> tried and can't find a way to tell the loader to look there.
>
> Am I able to link the missing module to the executable when I compile the
> program? I think my linker options should include -llibelf, but when I
> include that the ld program say's it can't find libelf. I could help it to
> find what it's looking for with -Lsomepath I guess, but I don't know what
> the loader is looking for. Surely not libelf.so.0. Tried that, didn't go.
>
> Can anyone please tell me what I'm doing. I have no clue.
>


What, specifically was your C++ question?

Linking and loading are off-topic and are highly system dependent. I
would recommend asking again in comp.unix.programmer.

F/U set.
Paul Pluzhnikov

2007-09-24, 4:21 am

red floyd <no.spam@here.dude> writes:
[color=darkred]
> Trespasser wrote:

Correct.
[color=darkred]

Well, what did you try, and on what OS?

Given the libelf.so.0 filename, you are almost assuredly on an ELF
platform. If so, this should do the trick:

# sh/ksh/bash/zsh syntax:
LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH

# csh/tcsh syntax:
setenv LD_LIBRARY_PATH /usr/local/lib:$LD_LIBRARY_PATH
[color=darkred]

How should *we* know that? Are you able to link or aren't you?
[color=darkred]

No. Maybe it should include '-lelf', but adding '-llibelf' will
make static linker look for liblibelf.{a,so}, which likely doesn't
exist on your system.
[color=darkred]

Try '-L/usr/local/lib -lelf' (there should be a /usr/local/lib/libelf.so,
which should be a symlink to something else).
[color=darkred]

You didn't tell us what you are doing, so we don't have a clue
either. Try reading this:

http://catb.org/~esr/faqs/smart-questions.html

Cheers,
--
In order to understand recursion you must first understand recursion.
Remove /-nsp/ for email.
Trespasser

2007-09-24, 8:09 am

resolved.

"red floyd" <no.spam@here.dude> wrote in message
news:pXwJi.10455$924.4625@newssvr23.news.prodigy.net...
> Trespasser wrote:
>
> What, specifically was your C++ question?
>
> Linking and loading are off-topic and are highly system dependent. I
> would recommend asking again in comp.unix.programmer.
>
> F/U set.



Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2010 codecomments.com