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

From: Dennis Suratna <dennis(dot)suratna(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: Could not build from source /usr/bin/ld: cannot find -lpgcommon_shlib
Date: 2019-12-01 03:46:15
Message-ID: CAOBK3AT1epBxC5hqeB9d0k7YPFvxbm5UMCV9OeVALdj9B7F_nw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

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 <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:

> Dennis Suratna <dennis(dot)suratna(at)gmail(dot)com> 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
>

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Marcel Ruff 2019-12-03 10:12:36 Re: PostgreSQL 12 crash with segmentation violation in heap_freetuple
Previous Message Tom Lane 2019-11-30 21:22:57 Re: Could not build from source /usr/bin/ld: cannot find -lpgcommon_shlib