Subject: pkg/30333: shells/zsh build fails to configure and build on Solaris (10)
To: None <pkg-manager@netbsd.org, gnats-admin@netbsd.org,>
From: None <idart@performancedesign.no>
List: pkgsrc-bugs
Date: 05/25/2005 15:43:00
>Number:         30333
>Category:       pkg
>Synopsis:       shells/zsh build fails to configure and build on Solaris (10)
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed May 25 15:43:00 +0000 2005
>Originator:     Idar Tollefsen
>Release:        zsh-4.2.5
>Organization:
Performance Design
>Environment:
SunOS lancaster 5.10 s10_72 sun4u sparc SUNW,Ultra-30
>Description:
First, the command "exists" doesn't exist (no pun indented),
so configuration fails before it even gets off the ground since exists
is used in Makefile.common in one of the .if tests.

Second, when trying to build zsh, I get the following:

gcc -m64 -Wl,-s -Xlinker -z -Xlinker combreloc -Xlinker -z -Xlinker redlocsym -Xlinker -z -Xlinker lazyload -L/usr/local/gcc34/lib/gcc/sparc64-sun-solaris2.10/3.4.3 -Wl,-R/usr/local/gcc34/lib/gcc/sparc64-sun-solaris2.10/3.4.3 -L/usr/local/gcc34/lib -Wl,-R/usr/local/gcc34/lib -L/usr/local/gcc34/lib/gcc/sparc64-sun-solaris2.10/3.4.3/ -Wl,-R/usr/local/gcc34/lib/gcc/sparc64-sun-solaris2.10/3.4.3/ -L/usr/lib -Wl,-R/usr/lib -L/usr/local/lib -Wl,-R/usr/local/lib   -o zsh main.o  `cat stamp-modobjs`   -lsocket -ldl -lnsl -lcurses -lm -lintl -lc
Undefined                       first referenced
 symbol                             in file
libiconv_close                      utils.o  (symbol belongs to implicit dependency /usr/pkgsrc/shells/zsh/work/.buildlink/lib/libiconv.so.2)
libiconv_open                       utils.o  (symbol belongs to implicit dependency /usr/pkgsrc/shells/zsh/work/.buildlink/lib/libiconv.so.2)
libiconv                            utils.o  (symbol belongs to implicit dependency /usr/pkgsrc/shells/zsh/work/.buildlink/lib/libiconv.so.2)
ld: fatal: Symbol referencing errors. No output written to zsh
collect2: ld returned 1 exit status
*** Error code 1

Stop.
bmake: stopped in /usr/pkgsrc/shells/zsh/work/zsh-4.2.5/Src
*** Error code 1

This despite zsh stating that it requires iconv before the build
commences.

Third, it defaults to /etc for configuration files (zprofile, zshenv,
etc.). This might be fine for NetBSD (I wouldn't know), but when it's
used on other systems that might have these already, I personally
feel it would be more appropriate to put them in ${LOCALBASE}/etc,
which is where mk.conf resides as well.

It also seems that Sun removed the static system libraries from
Solaris 10. Consequently, ZSH_STATIC=YES won't work and fails with
a message that it can't find "-lc".

>How-To-Repeat:
On Solaris, go to shells/zsh and try to build it.
>Fix:
- Remove the use of "exists" from Makefile.common.
- Add explicit linking against libiconv.
- Change default configuration directory from /etc to ${LOCALBASE}/etc.

Here's a patch against shells/zsh/Makefile.common that shows this.
It needs tweaking since commenting out the use of "exists" hardly
qualifies as a fix and setting the configuration directory should
maybe be done only on non-NetBSD systems:
----------------------------------------

--- Makefile.common.orig	Tue May 24 15:42:10 2005
+++ Makefile.common	Wed May 25 14:54:09 2005
@@ -25,6 +25,8 @@
 
 .include "../../mk/bsd.prefs.mk"
 
+CONFIGURE_ARGS+=	--enable-etcdir=${LOCALBASE}/etc --enable-libs=-liconv
+
 BUILD_DEFS+=	ZSH_STATIC
 
 .if defined(ZSH_STATIC) && !empty(ZSH_STATIC:M[Yy][Ee][Ss])
@@ -34,8 +36,8 @@
 NETBSD_SHLIBDIR=	/lib
 
 .  if ${OPSYS} == "NetBSD" && ${OBJECT_FMT} == "ELF" && \
-      defined(MKDYNAMICROOT) && !empty(MKDYNAMICROOT:M[Yy][Ee][Ss]) && \
-      exists(${NETBSD_SHLINKER}) && exists(${NETBSD_SHLIBDIR})
+      defined(MKDYNAMICROOT) && !empty(MKDYNAMICROOT:M[Yy][Ee][Ss]) 
+#      exists(${NETBSD_SHLINKER}) && exists(${NETBSD_SHLIBDIR})
 #
 # Built a dynamically linked "zsh" binary on NetBSD systems which use
 # dynamically linked binaries on the root filesystem. The binary will
@@ -105,3 +107,4 @@
 	${ECHO_MSG} "${_PKGSRC_IN}> Testing for ${PKGNAME}"
 	@cd ${WRKSRC} && ${MAKE} check
 	@cd ${WRKSRC}/Test && ${MAKE} clean
+