From: | Stephen Scheck <singularsyntax(at)gmail(dot)com> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | pgsql-general <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: Explicit LOAD and dynamic library loading |
Date: | 2013-06-13 18:26:35 |
Message-ID: | CAKjnHz2kcNW6Dd=BNhDVAt6MeHscDXnQH=a6jm7C878oPTXxFA@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
I modified the Makefile a bit and it all works now:
MODULES = foo
MODULE_big = bar
OBJS = bar.o foo.so
EXTENSION = foo bar
One thing that's still a bit confusing, though ... I build the extensions
in my own home dir, which results in the rpath getting set like
this: -Wl,-rpath,'/vol/data/home/sscheck/sandbox/postgresql-9.2.4-build/lib'
But I do "make install" from the same directory, but logged in as the
postgres user under which I run my server(s). Does the rpath get embedded
into the .so's? If so I don't see why it works, but it does...
Thanks!
-Steve
On Thu, Jun 13, 2013 at 7:38 AM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Stephen Scheck <singularsyntax(at)gmail(dot)com> writes:
> > [postgres(at)dev1 lib]$ ldd bar.so
> > linux-vdso.so.1 => (0x00007fff1c7ff000)
> > libc.so.6 => /lib64/libc.so.6 (0x00007fa4c96ac000)
> > /lib64/ld-linux-x86-64.so.2 (0x00007fa4c9c5d000)
>
> So you're missing any reference to foo.so; not surprising it fails.
> You need to make sure that "-lfoo" or something similar gets into the
> link command for bar.so. You might still have some rpath issues after
> that, but right now the runtime linker doesn't even know it should be
> loading foo.so.
>
> > After digging into the PGXS docs a bit more, I think if I change the
> > Makefile a bit this may work:
>
> > MODULES = foo bar
> > MODULE_big = bar
> > OBJS = bar.o
> > SHLIB_LINK = foo.o
>
> Oh, you're trying to build two separate shlibs in one Makefile? I don't
> think that our Makefile infrastructure is smart enough to handle that,
> at least not if cross-references are required. You'd probably be well
> advised to split them into two separate source-code directories.
>
> Another question worth asking yourself, if you are building like this,
> is why you're bothering with two .so's at all. Is there a strong reason
> not to just make them into one library?
>
> regards, tom lane
>
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2013-06-13 19:24:47 | Re: Explicit LOAD and dynamic library loading |
Previous Message | Tom Lane | 2013-06-13 14:38:10 | Re: Explicit LOAD and dynamic library loading |