Subject: pkg/28296: x11/ruby-tcltklib uses wrong DEPENDS relational operator, etc.
To: None <pkg-manager@netbsd.org, gnats-admin@netbsd.org,>
From: Greg A. Woods <woods@weird.com>
List: pkgsrc-bugs
Date: 11/13/2004 22:21:00
>Number: 28296
>Category: pkg
>Synopsis: x11/ruby-tcltklib uses wrong DEPENDS relational operator, etc.
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: pkg-manager
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Sat Nov 13 22:21:00 +0000 2004
>Originator: Greg A. Woods
>Release: NetBSD 1.6.2_STABLE
>Organization:
Planix, Inc.; Toronto, Ontario; Canada
>Environment:
System: NetBSD
>Description:
lang/ruby won't build when tcl-8.4.6nb5 is already installed
because x11/ruby-tcltklib won't build because it needs tcl-8.3.4
and tk-8.3.4 and yet it's DEPENDS settings use the ">="
relational operator instead of "=" as they should.
Note also that this "extconf.rb" script doesn't exit with a
non-zero exit code when it fails leading to even further
confusion and problems.
Sadly multiple versions of tcl and tk can't be installed using
pkgsrc simultaneously, which really sucks because there's no
good reason for this problem existing (the manual pages and
include directories could trivially be versioned).
So why does ruby have so much trouble with tcl/tk 8.4.* and with
the threat of the threads library especially since tk 8.4.* does
not _require_ linking against any threads library?!?!?
However since this extconf.rb script ignores LDFLAGS from
CONFIGURE_ENV and the Makefile it generates also ignores LDFLAGS
from BUILD_ENV the right linker flags are not passed through
when building the shared library resulting in a failure to find
the X11.6 library:
17:56 [5552] $ ldd work/ruby-1.6.8/ext/tcltklib/*.so
work/ruby-1.6.8/ext/tcltklib/tcltklib.so:
-lcrypt.0 => /usr/lib/libcrypt.so.0
-lm.0 => /usr/lib/libm.so.0
-lruby.16 => /usr/pkg/lib/libruby.so.16
-ltk84.1 => /usr/pkg/lib/libtk84.so.1
-ltcl84.1 => /usr/pkg/lib/libtcl84.so.1
-lX11.6 => not found
-lc.12 => /usr/lib/libc.so.12
Indeed the Makefile doesn't even note the need for X11!
The second patch below undoes the reliance on a back-dated
version of tcl/tk, fixes the LDFLAGS problems, adds USE_X11, and
seems to produce a fine result -- at least all the
share/examples/ruby/tk examples work OK for me.
>How-To-Repeat:
===> Checking for vulnerabilities in ruby-tcltklib-1.6.8nb4
=> Checksum OK for ruby/ruby-1.6.8.tar.gz.
===> Extracting for ruby-tcltklib-1.6.8nb4
=====> WARNING: tcl-8.4.6nb5 should be upgraded -> tcl-8.3.4
===> Required runtime package tcl-8.4.6nb5 installed OK (need tcl>=8.3)
=====> WARNING: tk-8.4.6nb3 should be upgraded -> tk-8.3.4
===> Required runtime package tk-8.4.6nb3 installed OK (need tk>=8.3)
===> Required runtime package ruby-base-1.6.8nb5 installed OK (need ruby-base>=1.6.8)
pax: Trying to read GNU tar archive with extensions off
===> Patching for ruby-tcltklib-1.6.8nb4
===> Applying pkgsrc patches for ruby-tcltklib-1.6.8nb4
===> Overriding tools for ruby-tcltklib-1.6.8nb4
===> Configuring for ruby-tcltklib-1.6.8nb4
===> Running extconf.rb to configure
checking for t_open() in -lnsl... no
checking for socket() in -lsocket... no
checking for dlopen() in -ldl... no
checking for log() in -lm... yes
checking for tcl.h... yes
checking for tk.h... yes
checking for XOpenDisplay() in -lX11... yes
checking for Tcl_FindExecutable() in -ltcl83... no
===> Building for ruby-tcltklib-1.6.8nb4
make: cannot open Makefile.
make: stopped in /build/package-obj/x11/ruby-tcltklib/work/ruby-1.6.8/ext/tcltklib
*** Error code 2
Stop.
make: stopped in /work/woods/m-NetBSD-pkgsrc/x11/ruby-tcltklib
*** Error code 1
Stop.
make: stopped in /work/woods/m-NetBSD-pkgsrc/x11/ruby-tcltklib
>Fix:
note that tcl-8.3.4 _does_ match "8.3" and so this first minimal
patch will do the right thing IFF tcl/tk-8.3.* is sufficient in
the target environment....
Index: x11/ruby-tcltklib/Makefile
===================================================================
RCS file: /cvs/master/m-NetBSD/main/pkgsrc/x11/ruby-tcltklib/Makefile,v
retrieving revision 1.12
diff -u -r1.12 Makefile
--- x11/ruby-tcltklib/Makefile 29 Mar 2004 07:55:25 -0000 1.12
+++ x11/ruby-tcltklib/Makefile 13 Nov 2004 21:17:00 -0000
@@ -14,8 +14,8 @@
# Ruby can work with tcl 8.4 but can't coexist with thread library.
# Since tcl-8.4.6nb1 enabled linking with thread library, ruby couldn't
# use it any more.
-DEPENDS+= tcl>=8.3:../../lang/tcl83
-DEPENDS+= tk>=8.3:../../x11/tk83
+DEPENDS+= tcl=8.3:../../lang/tcl83
+DEPENDS+= tk=8.3:../../x11/tk83
WRKSRC= ${RUBY_WRKSRC}/ext/tcltklib
DIST_SUBDIR= ruby
HOWEVER this patch seems to solve the whole problem:
(note I hate these post-configure hacks that apply patches, even
when they're working with generated files, but this hack is much
easier for me to maintain than the proper fix of patching the
makefile generator....)
Index: x11/ruby-tcltklib/Makefile
===================================================================
RCS file: /cvs/master/m-NetBSD/main/pkgsrc/x11/ruby-tcltklib/Makefile,v
retrieving revision 1.12
diff -u -r1.12 Makefile
--- x11/ruby-tcltklib/Makefile 29 Mar 2004 07:55:25 -0000 1.12
+++ x11/ruby-tcltklib/Makefile 13 Nov 2004 22:07:24 -0000
@@ -14,8 +14,8 @@
# Ruby can work with tcl 8.4 but can't coexist with thread library.
# Since tcl-8.4.6nb1 enabled linking with thread library, ruby couldn't
# use it any more.
-DEPENDS+= tcl>=8.3:../../lang/tcl83
-DEPENDS+= tk>=8.3:../../x11/tk83
+DEPENDS+= tcl>=8.4:../../lang/tcl
+DEPENDS+= tk>=8.4:../../x11/tk
WRKSRC= ${RUBY_WRKSRC}/ext/tcltklib
DIST_SUBDIR= ruby
@@ -24,6 +24,8 @@
EXTRACT_ELEMENTS= ${RUBY_DISTNAME}/ext/tcltklib
USE_RUBY_EXTCONF= yes
+USE_X11= yes
+
CONFIGURE_ARGS= --with-tcllib="${TCL_LIB}" --with-tklib="${TK_LIB}" \
--with-tcl-lib="${LOCALBASE}/lib/${TCL_DIR}" \
--with-tk-lib="${LOCALBASE}/lib/${TK_DIR}" \
@@ -34,8 +36,8 @@
# Set these vars as the version numbers (without decimal points) of Tcl/Tk
# you want to use with Ruby/Tk.
# e.g.: make TCL_VERSION=42 TK_VERSION=76 WITH_TCL_JP=yes build
-TCL_VERSION?= 83
-TK_VERSION?= 83
+TCL_VERSION?= 84
+TK_VERSION?= 84
#.if defined(WITH_TCLTK_JP)
#TCL_CATEGORY= japanese
#TK_CATEGORY= japanese
@@ -51,6 +53,10 @@
TCL_DIR= `echo "${TCL_LIB}" | ${SED} 's/\([0-9]\)\([0-9]\)/\1.\2/'`
TK_DIR= `echo "${TK_LIB}" | ${SED} 's/\([0-9]\)\([0-9]\)/\1.\2/'`
+post-configure:
+ ${MV} ${WRKSRC}/Makefile ${WRKSRC}/Makefile.in
+ ${SED} 's/^DLDFLAGS = /DLDFLAGS = \$${LDFLAGS}/' < ${WRKSRC}/Makefile.in > ${WRKSRC}/Makefile
+
post-install:
${INSTALL_DATA_DIR} ${RUBY_EXAMPLESDIR}/tcltklib
${INSTALL_DATA} ${WRKSRC}/sample/* ${RUBY_EXAMPLESDIR}/tcltklib
@@ -61,4 +67,5 @@
${INSTALL_DATA} ${WRKSRC}/README.euc ${RUBY_DOCDIR}/tcltklib/README.ja
.include "../../lang/ruby-base/Makefile.common"
+.include "../../lang/tcl/buildlink3.mk"
.include "../../mk/bsd.pkg.mk"