libproj gets linked from /usr/lib when /usr/local/lib install exists
|Reported by:||strk||Owned by:||strk|
I've been chasing this today and found out the culprit being an LDFLAGS variable set by the Makefile.global file (as included by pgxs.mk) to contain a
-L switch pointing to a system directory.
GCC scans directories in the expected order /usr/local/lib first, then /usr/lib unless an explicit -L is given to point to /usr/lib.
This is what is happening: PostgreSQL PGXS machinery is forcing the system lib first.
This misbehavior can affect any other library for which you have multiple installs with the same library filename.
Luckly it can be fixed by re-defining LDFLAGS, which in this case is *missing* in postgis/Makefile.in
Setting LDFLAGS ourselves fixes this issue.