NetBSD Problem Report #50800

From timshel@hopkins.fluentdevelopment.com.au  Sat Feb 13 12:05:28 2016
Return-Path: <timshel@hopkins.fluentdevelopment.com.au>
Received: from mail.netbsd.org (mail.NetBSD.org [199.233.217.200])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(Client CN "mail.netbsd.org", Issuer "Postmaster NetBSD.org" (verified OK))
	by mollari.NetBSD.org (Postfix) with ESMTPS id E90B87ABDA
	for <gnats-bugs@gnats.NetBSD.org>; Sat, 13 Feb 2016 12:05:28 +0000 (UTC)
Message-Id: <20160213111111.292FC37DBE@hopkins.fluentdevelopment.com.au>
Date: Sat, 13 Feb 2016 22:10:44 +1100 (AEDT)
From: timshel@fluentdevelopment.com.au
Reply-To: timshel@fluentdevelopment.com.au
To: gnats-bugs@gnats.NetBSD.org
Subject: Postfix-pgsql module missing pkgsrc rpath
X-Send-Pr-Version: 3.95

>Number:         50800
>Category:       pkg
>Synopsis:       Postfix-pgsql module missing pkgsrc rpath
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    bsiegert
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Feb 13 12:10:00 +0000 2016
>Closed-Date:    Sun Feb 14 20:02:50 +0000 2016
>Last-Modified:  Sun Feb 14 20:02:50 +0000 2016
>Originator:     Timshel Knoll-Miller
>Release:        NetBSD 6.1.5
>Organization:
	Fluent Development
>Environment:
System: NetBSD hopkins.fluentdevelopment.com.au 6.1.5 NetBSD 6.1.5 (GENERIC) amd64
Architecture: x86_64
Machine: amd64
>Description:

postfix-pgsql builds the lib/postfix/postfix-pgsql.so without linking including the /usr/pkg/lib rpath.
This means that the postgresql libpq.so.X library cannot be found at run time, causing the following error
to appear repeatedly in /var/log/maillog:

Feb 13 22:04:04 hopkins postfix/trivial-rewrite[22681]: fatal: load_library_symbols: dlopen failure loading /usr/pkg/lib/postfix/postfix-pgsql.so: Shared object "libpq.so.5" not found
Feb 13 22:04:05 hopkins postfix/master[16485]: warning: process /usr/pkg/libexec/postfix/trivial-rewrite pid 22681 exit status 1
Feb 13 22:04:05 hopkins postfix/master[16485]: warning: /usr/pkg/libexec/postfix/trivial-rewrite: bad command startup -- throttling

The linker can't find the postfix-pgsql module:
[timshel@hopkins pts/0 postfix-pgsql](0)$ ldd /usr/pkg/lib/postfix/postfix-pgsql.so 
/usr/pkg/lib/postfix/postfix-pgsql.so:
        -lpq.5 => not found
        -lc.12 => /usr/lib/libc.so.12
[timshel@hopkins pts/0 postfix-pgsql](0)$ 

The issue is caused as the postfix-pgsql Makefile refers incorrectly to the postgresql buildlink prefix variable
as "${BUILDLINK_PREFIX.pgsql}", which is empty (and so a -Wl,-rpath /lib gets passed to the gcc link command,
rather than the correct -Wl,-rpath /usr/pkg/lib).

Changing the variable reference to "${BUILDLINK_PREFIX.${PGSQL_TYPE}}" fixed the issue on my system.
A patch to that effect is included below.

>How-To-Repeat:
Build mail/postfix and mail/postfix-pgsql and start the server with /etc/rc.d/postfix start.
>Fix:
$NetBSD$

--- Makefile.orig	2016-02-13 10:56:58.000000000 +0000
+++ Makefile
@@ -13,7 +13,7 @@ POSTFIX_LIB_MKMAP=	no

 CCARGS+=		-I${PGSQL_PREFIX}/include
 AUXLIBS_MODULE=		-L${PGSQL_PREFIX}/lib -lpq				\
-			${COMPILER_RPATH_FLAG}${BUILDLINK_PREFIX.pgsql}/lib
+			${COMPILER_RPATH_FLAG}${BUILDLINK_PREFIX.${PGSQL_TYPE}}/lib

 .include "../../mk/pgsql.buildlink3.mk"
 .include "../../mk/bsd.pkg.mk"

>Release-Note:

>Audit-Trail:
From: "Benny Siegert" <bsiegert@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/50800 CVS commit: pkgsrc/mail/postfix-pgsql
Date: Sun, 14 Feb 2016 19:48:13 +0000

 Module Name:	pkgsrc
 Committed By:	bsiegert
 Date:		Sun Feb 14 19:48:13 UTC 2016

 Modified Files:
 	pkgsrc/mail/postfix-pgsql: Makefile

 Log Message:
 Fix rpath for pgsql module. From Timshell Knoll-Miller in PR pkg/50800.
 Bump PKGREVISION.


 To generate a diff of this commit:
 cvs rdiff -u -r1.3 -r1.4 pkgsrc/mail/postfix-pgsql/Makefile

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

Responsible-Changed-From-To: pkg-manager->bsiegert
Responsible-Changed-By: bsiegert@NetBSD.org
Responsible-Changed-When: Sun, 14 Feb 2016 20:02:50 +0000
Responsible-Changed-Why:


State-Changed-From-To: open->closed
State-Changed-By: bsiegert@NetBSD.org
State-Changed-When: Sun, 14 Feb 2016 20:02:50 +0000
State-Changed-Why:
Fix committed, thanks!


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.