Bug 187014 - print/xdvik fails with iconv linker errors
Summary: print/xdvik fails with iconv linker errors
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: Normal Affects Only Me
Assignee: Hiroki Sato
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-02-25 02:50 UTC by Don Lewis
Modified: 2014-06-10 06:39 UTC (History)
0 users

See Also:


Attachments
xdvik.patch (1.29 KB, patch)
2014-03-04 11:49 UTC, Tijl Coosemans
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Don Lewis freebsd_committer freebsd_triage 2014-02-25 02:50:01 UTC
The build phase for print/xdvik fails at this point:

cc -o xdvi-motif browser.o dl_list.o dvi-draw.o dvi-init.o dvisel.o encodings.o events.o exit-handlers.o filehist.o font-open.o gf.o string_list.o hypertex.o image-magick.o main.o mime.o my-snprintf.o my-vsnprintf.o pagehist.o pk.o print-internal.o psdps.o psgs.o psheader.o psnews.o read-mapfile.o search-internal.o special.o string-utils.o tfmload.o util.o vf.o xdvi.o xserver-info.o x_util.o -Wl,--allow-multiple-definition  ./gui/libgui.a -L/usr/local/lib /usr/local/lib/libt1.so ../kpathsea/.libs/libkpathsea.a /usr/local/lib/libXm.so /usr/local/lib/libXft.so /usr/local/lib/libfontconfig.so /usr/local/lib/libexpat.so /usr/local/lib/libfreetype.so -lz -lbz2 -lpng15 /usr/local/lib/libXrender.so /usr/local/lib/libjpeg.so -lpng /usr/local/lib/libXmu.so /usr/local/lib/libXt.so /usr/local/lib/libSM.so /usr/local/lib/libICE.so /usr/local/lib/libXp.so /usr/local/lib/libXext.so /usr/local/lib/libXpm.so /usr/local/lib/libX11.so /usr/local/lib/libxcb.so /usr/local/lib/libXau.so /usr/loc!
 al/lib/libXdmcp.so /usr/local/lib/libpthread-stubs.so -lrpcsvc -lm -Wl,--rpath -Wl,/usr/local/lib -Wl,--rpath -Wl,/usr/local/lib
encodings.o: In function `cjk2unicode':
encodings.c:(.text+0x12f): undefined reference to `libiconv_open'
encodings.c:(.text+0x17a): undefined reference to `libiconv'
encodings.o: In function `close_iconv':
encodings.c:(.text+0x33d2): undefined reference to `libiconv_close'
util.o: In function `iconv_convert_string':
util.c:(.text+0x2950): undefined reference to `libiconv_open'
util.c:(.text+0x29e5): undefined reference to `libiconv'
util.c:(.text+0x29f9): undefined reference to `libiconv_close'
util.c:(.text+0x2b23): undefined reference to `libiconv_close'
cc: error: linker command failed with exit code 1 (use -v to see invocation)
gmake[3]: *** [xdvi-motif] Error 1
gmake[3]: Leaving directory `/usr/ports/print/xdvik/work/xdvik-22.84.16/texk/xdvik'
gmake[2]: *** [all] Error 1
gmake[2]: Leaving directory `/usr/ports/print/xdvik/work/xdvik-22.84.16/texk'
gmake[1]: *** [all] Error 1
gmake[1]: Leaving directory `/usr/ports/print/xdvik/work/xdvik-22.84.16'
*** Error code 1

Stop.
make: stopped in /usr/ports/print/xdvik


The problem seems to be that the build picks up /usr/local/include/iconv.h
instead of /usr/include/iconv.h.  The former include file has #define
statements that rename iconv_open to libiconv_open, etc.  This would
probably work if the port also listed libiconv as a dependency and linked
against /usr/local/lib/libiconv*, but neither of these is true.
The configure script doesn't add -L/usr/local/lib to the command line
when it is checked to see if it should link with -liconv.

This probably used to work before iconv was added to the libc because
configure would not have found iconv support.

How-To-Repeat: 
Attempt to build the port on a version of FreeBSD that includes iconv
in libc.
Comment 1 Edwin Groothuis freebsd_committer freebsd_triage 2014-02-25 02:50:10 UTC
Responsible Changed
From-To: freebsd-ports-bugs->hrs

Over to maintainer (via the GNATS Auto Assign Tool)
Comment 2 Tijl Coosemans freebsd_committer freebsd_triage 2014-03-04 11:49:16 UTC
Hi,

This patch should fix the problem:

- Add USES=iconv.
- Fix libiconv detection on FreeBSD < 10 by setting CPPFLAGS and LDFLAGS.
- Patch Makefile.in so it doesn't use libiconv on FreeBSD 10.

Tested on redports: https://redports.org/buildarchive/20140304100900-29556/
Comment 3 dfilter service freebsd_committer freebsd_triage 2014-03-06 09:13:33 UTC
Author: hrs
Date: Thu Mar  6 09:13:25 2014
New Revision: 347175
URL: http://svnweb.freebsd.org/changeset/ports/347175
QAT: https://qat.redports.org/buildarchive/r347175/

Log:
  Fix iconv issue [*]:
   - Add USES=iconv.
   - Fix libiconv detection on FreeBSD < 10 by setting CPPFLAGS and LDFLAGS.
   - Patch Makefile.in so it doesn't use libiconv on FreeBSD 10.
  
  - Use new syntax of LIB_DEPENDS.
  - Minor style cleanups.
  
  Submitted by:	tijl [*]
  PR:		ports/187014

Modified:
  head/print/xdvik/Makefile
  head/print/xdvik/pkg-plist

Modified: head/print/xdvik/Makefile
==============================================================================
--- head/print/xdvik/Makefile	Thu Mar  6 09:13:24 2014	(r347174)
+++ head/print/xdvik/Makefile	Thu Mar  6 09:13:25 2014	(r347175)
@@ -3,7 +3,7 @@
 
 PORTNAME=	xdvik
 PORTVERSION=	22.84.16
-PORTREVISION=	5
+PORTREVISION=	6
 CATEGORIES=	print
 MASTER_SITES=	SF/hoge
 #/xdvi/${PORTNAME}/${PORTVERSION}
@@ -12,9 +12,9 @@ PKGNAMESUFFIX=	-tetex
 MAINTAINER=	hrs@FreeBSD.org
 COMMENT=	DVI Previewer(kpathsearch) for X
 
-LIB_DEPENDS=	t1.5:${PORTSDIR}/devel/t1lib
+LIB_DEPENDS=	libt1.so:${PORTSDIR}/devel/t1lib
 
-USES=		gmake motif
+USES=		gmake iconv motif
 USE_TEX=	base texmf
 MAKE_JOBS_UNSAFE=	yes
 GNU_CONFIGURE=	yes
@@ -25,7 +25,8 @@ CONFIGURE_ARGS=	--with-system-t1lib \
 CONFIGURE_ENV=	INSTALL_SCRIPT="${INSTALL_SCRIPT}" \
 		INSTALL_DATA="${INSTALL_DATA}" \
 		INSTALL_PROGRAM="${INSTALL_PROGRAM}"
-CFLAGS+=	-I${LOCALBASE}/include
+CPPFLAGS+=	-I${LOCALBASE}/include
+LDFLAGS+=	-L${LOCALBASE}/lib
 INSTALL_WRKSRC=	${WRKSRC}/texk/xdvik
 
 PLIST_SUB=	TEXMFDIR=${TEXMFDIR} TEXMFCONFIGDIR=${TEXMFDIR}-config
@@ -45,7 +46,7 @@ TEXMFLOCAL_LSR?=${LOCALBASE}/${TEXMFLOCA
 TEXCONFIGBIN=	${LOCALBASE}/bin/texconfig-sys
 MKTEXLSR?=	${LOCALBASE}/bin/mktexlsr
 LIBT1_PREFIX?=	${LOCALBASE}
-DOC_FILES=	BUGS CHANGES INSTALL \
+PORTDOCS=	BUGS CHANGES INSTALL \
 		README README.CVS README_maintainer TODO
 
 .if defined(WITH_LETTERSIZE)
@@ -55,9 +56,10 @@ PAPERSIZE=	letter
 PAPERSIZE=	a4
 .endif
 
-PKGINSTALL=	${WRKDIR}/pkg-install.sh
-PKGDEINSTALL=	${WRKDIR}/pkg-install.sh
-PKGINSTALL_SUB=	MKTEXLSR=${MKTEXLSR} \
+PKGINSTALL=	${WRKDIR}/pkg-install
+PKGDEINSTALL=	${WRKDIR}/pkg-install
+SUB_FILES=	pkg-install
+SUB_LIST=	MKTEXLSR=${MKTEXLSR} \
 		XDVIDIR=${PREFIX}/${TEXMFDIR}/xdvi \
 		XDVICONFDIR=${PREFIX}/${TEXMFDIR}-config/xdvi \
 		PAPERSIZE=${PAPERSIZE} \
@@ -65,15 +67,15 @@ PKGINSTALL_SUB=	MKTEXLSR=${MKTEXLSR} \
 		LOCALBASE=${LOCALBASE}
 
 NO_STAGE=	yes
-pre-install:
-	${SED} ${PKGINSTALL_SUB:S/$/!g/:S/^/ -e s!%%/:S/=/%%!/} \
-		< ${FILESDIR}/pkg-install.in > ${PKGINSTALL}
-	${CHMOD} 0755 ${PKGINSTALL}
+post-patch:
+	@${REINPLACE_CMD} 's/@iconv_libs@/${ICONV_LIB}/' \
+	    ${WRKSRC}/texk/xdvik/Makefile.in \
+	    ${WRKSRC}/texk/xdvik/tests/Makefile.in
 
 post-install:
 .if !defined(NOPORTDOCS)
 	${MKDIR} ${DOCSDIR}
-	${INSTALL_DATA} ${DOC_FILES:S@^@${WRKSRC}/@} ${DOCSDIR}
+	cd ${WRKSRC} && ${INSTALL_DATA} ${PORTDOCS} ${DOCSDIR}
 .endif
 	@${PKGINSTALL} ${PKGNAME} POST-INSTALL
 

Modified: head/print/xdvik/pkg-plist
==============================================================================
--- head/print/xdvik/pkg-plist	Thu Mar  6 09:13:24 2014	(r347174)
+++ head/print/xdvik/pkg-plist	Thu Mar  6 09:13:25 2014	(r347175)
@@ -7,11 +7,3 @@ bin/xdvi-motif
 %%TEXMFDIR%%/xdvi/pixmaps/toolbar2.xpm
 @dirrm %%TEXMFDIR%%/xdvi/pixmaps
 %%TEXMFCONFIGDIR%%/xdvi/XDvi
-%%PORTDOCS%%%%DOCSDIR%%/BUGS
-%%PORTDOCS%%%%DOCSDIR%%/CHANGES
-%%PORTDOCS%%%%DOCSDIR%%/INSTALL
-%%PORTDOCS%%%%DOCSDIR%%/README
-%%PORTDOCS%%%%DOCSDIR%%/README.CVS
-%%PORTDOCS%%%%DOCSDIR%%/README_maintainer
-%%PORTDOCS%%%%DOCSDIR%%/TODO
-%%PORTDOCS%%@dirrm %%DOCSDIR%%
_______________________________________________
svn-ports-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-ports-all
To unsubscribe, send any mail to "svn-ports-all-unsubscribe@freebsd.org"
Comment 4 Don Lewis freebsd_committer freebsd_triage 2014-06-10 06:39:22 UTC
Fixed by 347175.