NetBSD Problem Report #47388

From zakinko@snowrabbit.org  Mon Dec 31 17:38:40 2012
Return-Path: <zakinko@snowrabbit.org>
Received: from mail.netbsd.org (mail.netbsd.org [149.20.53.66])
	by www.NetBSD.org (Postfix) with ESMTP id A4BA463EA19
	for <gnats-bugs@gnats.NetBSD.org>; Mon, 31 Dec 2012 17:38:40 +0000 (UTC)
Message-Id: <CAL+Qxy8T-EYbS9NVr8F0pY_AO32Un-42pGOf-T3JwogMGViTzA@mail.gmail.com>
Date: Tue, 1 Jan 2013 02:30:36 +0900
From: Showta Ishizaki <zakinko@snowrabbit.org>
To: gnats-bugs@netbsd.org
Subject: [PREFER_PKGSRC=yes]print/cups 1.5.4 compilation failure

>Number:         47388
>Category:       pkg
>Synopsis:       [PREFER_PKGSRC=yes]print/cups 1.5.4 compilation failure
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Dec 31 17:40:00 +0000 2012
>Last-Modified:  Mon Apr 08 01:25:02 +0000 2013
>Originator:     Showta Ishizaki
>Release:        NetBSD 5.1.2_PATCH
>Organization:
NSRG.FML.ORG
>Environment:
                System: NetBSD nsrg00.spub.chitose.ac.jp 5.1.2_PATCH NetBSD
5.1.2_PATCH (HOME_SERVER) #0: Mon Apr 16 06:49:15 JST 2012
fukachan@fml.org:/usr/src/sys/arch/i386/compile/HOME_SERVER i386
                Architecture: i386
                Machine: i386
>Description:

# ( cd /usr/pkgsrc/print/cups/ ; make install PREFER_PKGSRC=yes )

Making all in test...
Compiling ippserver.c...
libtool: compile:  gcc -Wall -Wno-format-y2k -Wunused -fPIC -Os -g
-fstack-protector -Wno-tautological-compare -I.. -D_CUPS_SOURCE
-I/usr/pkgsrc/print/cups/work/.buildlink/include/krb5
-I/usr/pkgsrc/print/cups/work/.buildlink/include -O2
-I/usr/pkgsrc/print/cups/work/.buildlink/include/libusb-1.0
-I/usr/pkgsrc/print/cups/work/.buildlink/include/dbus-1.0
-I/usr/pkgsrc/print/cups/work/.buildlink/lib/dbus-1.0/include
-DDBUS_API_SUBJECT_TO_CHANGE -DOPENSSL_DISABLE_OLD_DES_SUPPORT
-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_THREAD_SAFE -D_REENTRANT
-c ippserver.c  -fPIC -DPIC -o .libs/ippserver.o
libtool: compile:  gcc -Wall -Wno-format-y2k -Wunused -fPIC -Os -g
-fstack-protector -Wno-tautological-compare -I.. -D_CUPS_SOURCE
-I/usr/pkgsrc/print/cups/work/.buildlink/include/krb5
-I/usr/pkgsrc/print/cups/work/.buildlink/include -O2
-I/usr/pkgsrc/print/cups/work/.buildlink/include/libusb-1.0
-I/usr/pkgsrc/print/cups/work/.buildlink/include/dbus-1.0
-I/usr/pkgsrc/print/cups/work/.buildlink/lib/dbus-1.0/include
-DDBUS_API_SUBJECT_TO_CHANGE -DOPENSSL_DISABLE_OLD_DES_SUPPORT
-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_THREAD_SAFE -D_REENTRANT
-c ippserver.c -o ippserver.o >/dev/null 2>&1
Linking ippserver...
libtool: link: gcc -Wl,-R/usr/pkg/lib -fPIE -pie -Wall -Wno-format-y2k
-Wunused -fPIC -Os -g -fstack-protector -Wno-tautological-compare -o
ippserver ippserver.o
-L/usr/pkgsrc/print/cups/work/cups-1.5.4/cgi-bin
-L/usr/pkgsrc/print/cups/work/cups-1.5.4/cups
-L/usr/pkgsrc/print/cups/work/cups-1.5.4/filter
-L/usr/pkgsrc/print/cups/work/cups-1.5.4/ppdc
-L/usr/pkgsrc/print/cups/work/cups-1.5.4/scheduler
-L/usr/pkgsrc/print/cups/work/.buildlink/lib ../cups/libcups.a
/usr/pkgsrc/print/cups/work/.buildlink/lib/libgssapi.so
/usr/pkgsrc/print/cups/work/.buildlink/lib/libheimntlm.so
/usr/pkgsrc/print/cups/work/.buildlink/lib/libkrb5.so
/usr/pkgsrc/print/cups/work/.buildlink/lib/libsqlite3.so
/usr/pkgsrc/print/cups/work/.buildlink/lib/libhx509.so
/usr/pkgsrc/print/cups/work/.buildlink/lib/libasn1.so
/usr/pkgsrc/print/cups/work/.buildlink/lib/libwind.so
/usr/pkgsrc/print/cups/work/.buildlink/lib/libcom_err.so
/usr/pkgsrc/print/cups/work/.buildlink/lib/libheimbase.so
/usr/pkgsrc/print/cups/work/.buildlink/lib/libroken.so -lssl -lcrypto
-ldns_sd -lpthread -lcrypt -lm
/usr/pkgsrc/print/cups/work/.buildlink/lib/libz.so -Wl,-rpath
-Wl,/usr/pkgsrc/print/cups/work/.buildlink/lib -Wl,-rpath
-Wl,/usr/pkgsrc/print/cups/work/.buildlink/lib
../cups/libcups.a(transcode.o): In function `_cupsCharmapFlush':
/usr/pkgsrc/print/cups/work/cups-1.5.4/cups/transcode.c:64: undefined
reference to `libiconv_close'
/usr/pkgsrc/print/cups/work/cups-1.5.4/cups/transcode.c:70: undefined
reference to `libiconv_close'
../cups/libcups.a(transcode.o): In function `cupsCharsetToUTF8':
/usr/pkgsrc/print/cups/work/cups-1.5.4/cups/transcode.c:167: undefined
reference to `libiconv_open'
/usr/pkgsrc/print/cups/work/cups-1.5.4/cups/transcode.c:168: undefined
reference to `libiconv_open'
/usr/pkgsrc/print/cups/work/cups-1.5.4/cups/transcode.c:179: undefined
reference to `libiconv'
../cups/libcups.a(transcode.o): In function `cupsUTF8ToCharset':
/usr/pkgsrc/print/cups/work/cups-1.5.4/cups/transcode.c:292: undefined
reference to `libiconv_open'
/usr/pkgsrc/print/cups/work/cups-1.5.4/cups/transcode.c:293: undefined
reference to `libiconv_open'
/usr/pkgsrc/print/cups/work/cups-1.5.4/cups/transcode.c:304: undefined
reference to `libiconv'
gmake[1]: *** [ippserver] Error 1
gmake: *** [all] Error 1
*** Error code 2

Stop.
make: stopped in /usr/pkgsrc/print/cups
*** Error code 1

Stop.
make: stopped in /usr/pkgsrc/print/cups

>How-To-Repeat:
# ( cd /usr/pkgsrc/print/cups/ ; make install PREFER_PKGSRC=yes )

>Fix:
cups can be built on NetBSD/i386 5.1.2_PATCH after applying the
following patch.

The configure of cups checks the existence of both iconv.h and
iconv_open(3) which libc.a has for POSIX. The configure check is
wrong. In fact cups needs GNU libiconv. Cups tries to link
libiconv_open() and the compilation failed.

Index: print/cups/Makefile
===================================================================
RCS file: /cvsroot/pkgsrc/print/cups/Makefile,v
retrieving revision 1.193
diff -u -b -r1.193 Makefile
--- print/cups/Makefile        2012-10-08 13:45:36.000000000 +0000
+++ print/cups/Makefile
@@ -176,6 +176,8 @@ post-install:
 .endif

 .include "../../converters/libiconv/buildlink3.mk"
+LDFLAGS+=               -liconv
+
 .include "../../devel/zlib/buildlink3.mk"
 .include "../../graphics/png/buildlink3.mk"
 .include "../../graphics/tiff/buildlink3.mk"
Index: print/poppler/Makefile
===================================================================
RCS file: /cvsroot/pkgsrc/print/poppler/Makefile,v
retrieving revision 1.57
diff -u -b -r1.57 Makefile
--- print/poppler/Makefile     2012-09-14 12:15:01.000000000 +0000
+++ print/poppler/Makefile
@@ -48,6 +48,7 @@ post-install:
        ${INSTALL_MAN} ${WRKSRC}/README-XPDF
${DESTDIR}${PREFIX}/share/doc/poppler/
        ${RMDIR} ${DESTDIR}${PREFIX}/include/poppler || ${TRUE}

+.include "../../converters/libiconv/buildlink3.mk"
 .include "../../fonts/fontconfig/buildlink3.mk"
 .include "../../mk/jpeg.buildlink3.mk"
 .include "../../graphics/png/buildlink3.mk"
Index: print/poppler-utils/Makefile
===================================================================
RCS file: /cvsroot/pkgsrc/print/poppler-utils/Makefile,v
retrieving revision 1.25
diff -u -b -r1.25 Makefile
--- print/poppler-utils/Makefile     2012-07-04 20:26:58.000000000 +0000
+++ print/poppler-utils/Makefile
@@ -49,6 +49,7 @@ PTHREAD_STUBLIB=      # provided by libc
 .endif
 MAKE_ENV+=             PTHREAD_STUBLIB=${PTHREAD_STUBLIB}

+.include "../../converters/libiconv/buildlink3.mk"
 .include "../../mk/jpeg.buildlink3.mk"
 .include "../../graphics/png/buildlink3.mk"
 .include "../../mk/bsd.pkg.mk"

-- 
Chitose Institute of Science and Technology
http://www.chitose.ac.jp/english/
Network Science (and Service) Research Group
http://www.nsrg.fml.org/

Ishizaki Showta
zakinko@snowrabbit.org

>Audit-Trail:
From: Thomas Klausner <wiz@NetBSD.org>
To: NetBSD bugtracking <gnats-bugs@NetBSD.org>
Cc: 
Subject: Re: pkg/47388
Date: Sun, 7 Apr 2013 18:44:46 +0200

 +LDFLAGS+=               -liconv
 This looks wrong.
 Why is it needed unconditionally, and for all objects that are linked?
 In particular, it seems to work fine without PREFER_PKGSRC.

 I also don't understand the explanation: "The configure of cups checks
 the existence of both iconv.h and iconv_open(3) which libc.a has for
 POSIX. The configure check is wrong. In fact cups needs GNU libiconv.
 Cups tries to link libiconv_open() and the compilation failed."

 If the configure check is wrong, please fix that instead.

 Further, the diff includes changes to poppler, which are not commented
 upon at all, adding libiconv/bl3.mk. Does poppler directly need
 libiconv? If not, it's probably pulled in by some dependency and
 should be fixed in its bl3.mk instead.

From: "OBATA Akio" <obache@netbsd.org>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: pkg/47388
Date: Mon, 08 Apr 2013 10:20:25 +0900

 On Mon, 08 Apr 2013 01:45:03 +0900, Thomas Klausner <wiz@netbsd.org> wrote:

 >  +LDFLAGS+=               -liconv
 >  This looks wrong.
 >  Why is it needed unconditionally, and for all objects that are linked?
 >  In particular, it seems to work fine without PREFER_PKGSRC.

 or following?
 LDFLAGS+=	${BUILDLINK_LDADD.iconv}

 >  I also don't understand the explanation: "The configure of cups checks
 >  the existence of both iconv.h and iconv_open(3) which libc.a has for
 >  POSIX. The configure check is wrong. In fact cups needs GNU libiconv.
 >  Cups tries to link libiconv_open() and the compilation failed."
 > If the configure check is wrong, please fix that instead.

 Configure checks are
    1. exist iconv.h?
    2. exist iconv_open require -liconv?

 step 2 must be done with iconv.h because iconv.h from GNU libiconv
 rename iconv_open with libiconv_open with macros, but not.

 darwin-iconv hack in devel/glib2/hacks.mk may the hint to resolve
 this issue.

 -- 
 OBATA Akio / obache@NetBSD.org

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.