Thread overview | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
September 22, 2009 Re: Linking in an .so on linux with rebuild? | ||||
---|---|---|---|---|
| ||||
Nick Sabalausky wrote:
> I can't seem to get that to work. Tried all sorts of stuff. Off the top of my head:
>
> -ll<thelibname>
> -ll<thelibname>.so
> "-L-l <thelibname>"
> "-L-l <thelibname>.so"
> -L-l -L<thelibname>
> -L-l -L<thelibname>.so
>
> None of them were able to find the file (and, yes, the name+path are right), and I'm not using any links.
While it doesn't solve your issue, I myself use pragma(lib, "thelibname");
|
September 22, 2009 Re: Linking in an .so on linux with rebuild? | ||||
---|---|---|---|---|
| ||||
Here under "prerequisite libraries" http://www.dsource.org/projects/dsss/wiki/DSSSForSoftwareEngineers#DEPENDENCIES it seems to say that -ll<libname> should work. But it seems to suggest that version (build) { pragma(link, "example"); } is better. That's what I always seem to end up using. On Tue, Sep 22, 2009 at 3:37 PM, Nick Sabalausky <a@a.a> wrote: > I can't seem to get that to work. Tried all sorts of stuff. Off the top of my head: > > -ll<thelibname> > -ll<thelibname>.so > "-L-l <thelibname>" > "-L-l <thelibname>.so" > -L-l -L<thelibname> > -L-l -L<thelibname>.so > > None of them were able to find the file (and, yes, the name+path are right), and I'm not using any links. > > > |
September 22, 2009 Re: Linking in an .so on linux with rebuild? | ||||
---|---|---|---|---|
| ||||
Nick Sabalausky wrote: > I can't seem to get that to work. Tried all sorts of stuff. Off the top of my head: > > -ll<thelibname> This should work. If the lib is named "libsomething", don't include the "lib": -llsomething Excluding the "lib" seems to be standard on Unix-like OSes. > -ll<thelibname>.so > "-L-l <thelibname>" > "-L-l <thelibname>.so" > -L-l -L<thelibname> > -L-l -L<thelibname>.so > > None of them were able to find the file (and, yes, the name+path are right), and I'm not using any links. > > |
September 23, 2009 Re: Linking in an .so on linux with rebuild? | ||||
---|---|---|---|---|
| ||||
Nick Sabalausky wrote:
> I can't seem to get that to work. Tried all sorts of stuff. Off the top of my head:
>
> -ll<thelibname>
> -ll<thelibname>.so
> "-L-l <thelibname>"
> "-L-l <thelibname>.so"
> -L-l -L<thelibname>
> -L-l -L<thelibname>.so
>
> None of them were able to find the file (and, yes, the name+path are right), and I'm not using any links.
I've had exactly the same problem in trying to compile MiniD on Ubuntu last night.
MiniD wants libhistory, but -llhistory doesn't work.
What's worrying me is that even if I call ld directly and pass -lhistory, IT says it can't find it, either. It's in /lib, so I have no idea what's going on.
Passing the .so directly on the command line, like on Windows, doesn't appear to work as either rebuild or DMD is chucking a wobbly at the .so file, complaining it doesn't know what that extension is for.
|
September 23, 2009 Re: Linking in an .so on linux with rebuild? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Daniel Keep | I found a solution. See http://stackoverflow.com/questions/335928/linux-gcc-linking-ld-cannot-find-a-library-that-exists For me, I needed readline and history, so I did this: $ cd /lib $ sudo ln -s libreadline.so.5 libreadline.so $ sudo ln -s libhistory.so.5 libhistory.so After that, ld didn't complain. |
September 23, 2009 Re: Linking in an .so on linux with rebuild? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Daniel Keep | Daniel Keep wrote:
> I found a solution.
>
> See
> http://stackoverflow.com/questions/335928/linux-gcc-linking-ld-cannot-find-a-library-that-exists
>
> For me, I needed readline and history, so I did this:
>
> $ cd /lib
> $ sudo ln -s libreadline.so.5 libreadline.so
> $ sudo ln -s libhistory.so.5 libhistory.so
>
> After that, ld didn't complain.
Interesting. On my system (Debian), the libreadline.so symlink is in a separate -dev package. Who knows why.
|
September 23, 2009 Re: Linking in an .so on linux with rebuild? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Daniel Keep | On Wed, Sep 23, 2009 at 12:41 AM, Daniel Keep <daniel.keep.lists@gmail.com> wrote:
>
> I found a solution.
>
> See http://stackoverflow.com/questions/335928/linux-gcc-linking-ld-cannot-find-a-library-that-exists
>
> For me, I needed readline and history, so I did this:
>
> $ cd /lib
> $ sudo ln -s libreadline.so.5 libreadline.so
> $ sudo ln -s libhistory.so.5 libhistory.so
>
> After that, ld didn't complain.
>
Oh yay. I was going to suggest that but I had never had that kind of problem on Ubuntu when building MiniD before. Maybe we're using different versions or something.
|
September 23, 2009 Re: Linking in an .so on linux with rebuild? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jarrett Billingsley | Jarrett Billingsley wrote: > On Wed, Sep 23, 2009 at 12:41 AM, Daniel Keep <daniel.keep.lists@gmail.com> wrote: >> I found a solution. >> >> See http://stackoverflow.com/questions/335928/linux-gcc-linking-ld-cannot-find-a-library-that-exists >> >> For me, I needed readline and history, so I did this: >> >> $ cd /lib >> $ sudo ln -s libreadline.so.5 libreadline.so >> $ sudo ln -s libhistory.so.5 libhistory.so >> >> After that, ld didn't complain. >> > > Oh yay. I was going to suggest that but I had never had that kind of problem on Ubuntu when building MiniD before. Maybe we're using different versions or something. Now I just have to figure out how to fix THIS: ../build/dsss_objs/D/sandbox.minid_repl.o: In function `_Dmain': sandbox/minid_repl.d:(.text._Dmain+0x6f): undefined reference to `_D5minid11commandline45__T3CLITS5minid11commandline14MDConsoleInputZ3CLI11interactiveMFPS5minid5types8MDThreadZv' I *hate* linker errors. :( |
September 23, 2009 Re: Linking in an .so on linux with rebuild? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Daniel Keep | On Wed, Sep 23, 2009 at 1:11 AM, Daniel Keep <daniel.keep.lists@gmail.com> wrote:
>
>
> Jarrett Billingsley wrote:
>> On Wed, Sep 23, 2009 at 12:41 AM, Daniel Keep <daniel.keep.lists@gmail.com> wrote:
>>> I found a solution.
>>>
>>> See http://stackoverflow.com/questions/335928/linux-gcc-linking-ld-cannot-find-a-library-that-exists
>>>
>>> For me, I needed readline and history, so I did this:
>>>
>>> $ cd /lib
>>> $ sudo ln -s libreadline.so.5 libreadline.so
>>> $ sudo ln -s libhistory.so.5 libhistory.so
>>>
>>> After that, ld didn't complain.
>>>
>>
>> Oh yay. I was going to suggest that but I had never had that kind of problem on Ubuntu when building MiniD before. Maybe we're using different versions or something.
>
> Now I just have to figure out how to fix THIS:
>
> ../build/dsss_objs/D/sandbox.minid_repl.o: In function `_Dmain':
> sandbox/minid_repl.d:(.text._Dmain+0x6f): undefined reference to
> `_D5minid11commandline45__T3CLITS5minid11commandline14MDConsoleInputZ3CLI11interactiveMFPS5minid5types8MDThreadZv'
>
> I *hate* linker errors. :(
Oh boy, looks like templates are at it again. I'm not sure what the problem is there. Maybe minid.commandline isn't actually being compiled somehow, only imported?
|
September 23, 2009 Re: Linking in an .so on linux with rebuild? | ||||
---|---|---|---|---|
| ||||
Posted in reply to grauzone Attachments:
| grauzone wrote: > Daniel Keep wrote: >> I found a solution. >> >> See http://stackoverflow.com/questions/335928/linux-gcc-linking-ld-cannot-find-a-library-that-exists >> >> >> For me, I needed readline and history, so I did this: >> >> $ cd /lib >> $ sudo ln -s libreadline.so.5 libreadline.so >> $ sudo ln -s libhistory.so.5 libhistory.so >> >> After that, ld didn't complain. > > Interesting. On my system (Debian), the libreadline.so symlink is in a separate -dev package. Who knows why. That's because those symlinks are only necessary when compiling. On linux, DLLs have actually three names: - libfoo.so.x.y.z or libfoo-x.y.z.so where x.y.z is the full version number. This one is a real file; - libfoo.so.x or libfoo-x.so where x is the ABI version number. This is the name that will actually be stored into executables and therefore the name that is necessary to run the program. This is usually a symlink; - libfoo.so is used when linking programs. It is supposed to be a symlink that points to the latest installed version of the library. Note that you can type "sudo ldconfig" to regenerate the missing symlinks. Jerome -- mailto:jeberger@free.fr http://jeberger.free.fr Jabber: jeberger@jabber.fr |
Copyright © 1999-2021 by the D Language Foundation