Re: Could not build from source /usr/bin/ld: cannot find -lpgcommon_shlib

Dennis Suratna <[email protected]> Sat, 30 Nov 2019 19:46:15 -0800
Newsgroups gmane.comp.db.postgresql.novice
Message-ID <CAOBK3AT1epBxC5hqeB9d0k7YPFvxbm5UMCV9OeVALdj9B7F_nw@mail.gmail.com>
--000000000000becc4205989c4e8a
Content-Type: text/plain; charset="UTF-8"

Hi Tom,

Just did what you suggested and everything works as expected. You're right,
I tried installing from source without specifying the VPATH at first and
then realize that I already have postgres installed from package manager
and decided to install in a different directory.

So what I ended up doing was I re-cloned the source directory and deleted
the build directory and start from scratch.

Thanks for the help.

On Sat, Nov 30, 2019 at 1:22 PM Tom Lane <[email protected]> wrote:

> Dennis Suratna <[email protected]> writes:
> > And I got the same error. I have attached the full make output to this
> > reply.
>
> Well, this is pretty interesting:
>
> make -C src all
> make[1]: Entering directory '/home/dennis/workspace/pgsql_build/src'
> make -C common all
> make[2]: Entering directory '/home/dennis/workspace/pgsql_build/src/common'
> make[2]: Nothing to be done for 'all'.
> make[2]: Leaving directory '/home/dennis/workspace/pgsql_build/src/common'
>
> "make" didn't find anything to do there.  However, digging through the
> rest of the make log, I find that the backend link went through
> successfully with
>
> /home/dennis/workspace/pgsql_build/../postgresql/src/backend/../../src/common/libpgcommon_srv.a
>
>
> If I'm counting ".."'s correctly, that's pointing at
>
> /home/dennis/workspace/postgresql/src/common/libpgcommon_srv.a
>
> that is, something in your source tree not your build tree.
>
> Extrapolating, I'd guess that you have a partial build laying about in
> your source tree that includes libpgcommon_shlib.a, and depending on just
> how a particular Makefile is worded, the VPATH mechanism might find that
> file when libpgcommon_shlib.a is asked for; it's certainly enough to
> discourage make itself from building a new copy in the build tree.  But
> the linker doesn't know enough to find that from "-lpgcommon_shlib".
>
> In short, you need to clean out your source tree before trying to do a
> VPATH build.  If using git, "git clean -dfx" would do it.  Otherwise
> you might be best advised to blow away the tree and re-extract the
> tarball you started from.
>
>                         regards, tom lane
>

--000000000000becc4205989c4e8a
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div>Hi Tom,</div><div><br></div><div>Just did what you su=
ggested and everything works as expected. You&#39;re right, I tried install=
ing from source without specifying the VPATH at first and then realize that=
 I already have postgres installed from package manager and decided to inst=
all in a different directory.</div><div><br></div><div>So what I ended up d=
oing was I re-cloned the source directory and deleted the build directory a=
nd start from scratch. <br></div><div><br></div><div>Thanks for the help.<b=
r></div></div><br><div class=3D"gmail_quote"><div dir=3D"ltr" class=3D"gmai=
l_attr">On Sat, Nov 30, 2019 at 1:22 PM Tom Lane &lt;<a href=3D"mailto:tgl@=
sss.pgh.pa.us">[email protected]</a>&gt; wrote:<br></div><blockquote class=
=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rg=
b(204,204,204);padding-left:1ex">Dennis Suratna &lt;<a href=3D"mailto:denni=
[email protected]" target=3D"_blank">[email protected]</a>&gt; wri=
tes:<br>
&gt; And I got the same error. I have attached the full make output to this=
<br>
&gt; reply.<br>
<br>
Well, this is pretty interesting:<br>
<br>
make -C src all<br>
make[1]: Entering directory &#39;/home/dennis/workspace/pgsql_build/src&#39=
;<br>
make -C common all<br>
make[2]: Entering directory &#39;/home/dennis/workspace/pgsql_build/src/com=
mon&#39;<br>
make[2]: Nothing to be done for &#39;all&#39;.<br>
make[2]: Leaving directory &#39;/home/dennis/workspace/pgsql_build/src/comm=
on&#39;<br>
<br>
&quot;make&quot; didn&#39;t find anything to do there.=C2=A0 However, diggi=
ng through the<br>
rest of the make log, I find that the backend link went through<br>
successfully with<br>
<br>
/home/dennis/workspace/pgsql_build/../postgresql/src/backend/../../src/comm=
on/libpgcommon_srv.a <br>
<br>
If I&#39;m counting &quot;..&quot;&#39;s correctly, that&#39;s pointing at<=
br>
<br>
/home/dennis/workspace/postgresql/src/common/libpgcommon_srv.a<br>
<br>
that is, something in your source tree not your build tree.<br>
<br>
Extrapolating, I&#39;d guess that you have a partial build laying about in<=
br>
your source tree that includes libpgcommon_shlib.a, and depending on just<b=
r>
how a particular Makefile is worded, the VPATH mechanism might find that<br=
>
file when libpgcommon_shlib.a is asked for; it&#39;s certainly enough to<br=
>
discourage make itself from building a new copy in the build tree.=C2=A0 Bu=
t<br>
the linker doesn&#39;t know enough to find that from &quot;-lpgcommon_shlib=
&quot;.<br>
<br>
In short, you need to clean out your source tree before trying to do a<br>
VPATH build.=C2=A0 If using git, &quot;git clean -dfx&quot; would do it.=C2=
=A0 Otherwise<br>
you might be best advised to blow away the tree and re-extract the<br>
tarball you started from.<br>
<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 regards, tom lane<br>
</blockquote></div>

--000000000000becc4205989c4e8a--