Subject: Re: pkg/28296: x11/ruby-tcltklib uses wrong DEPENDS relational operator, etc.
To: Takahiro Kambe <taca@back-street.net>
From: Greg A. Woods <woods@weird.com>
List: netbsd-bugs
Date: 11/20/2004 15:36:10
[ On Saturday, November 20, 2004 at 23:58:10 (+0900), Takahiro Kambe wrote: ]
> Subject: Re: pkg/28296: x11/ruby-tcltklib uses wrong DEPENDS relational operator, etc.
>
> Thanks for your problem report.
> 
> First, I'm working on whole ruby package's framework now. 

Ah!  Thank you very much for your response to my report!  Hopefully I
can answer your questions and clarify the problems I've encountered.


> Because "extconf.rb" has diffrent policy from "configure" script; its
> main purpose is using in Ruby distribution's source tree and build
> available extention libraries without error.  Anyway, I'll add some
> work around in tne new framework.

Yes it is always best for any program run by "make" to exit with a
non-zero error code whenever it fails or otherwise detects an error.

(As an aside I can't imagine how "extconf.rb" can get away without using
non-zero exit codes to indicate errors in the Ruby distribution source
tree either.  It would seem to me that this universal error indicator be
highly desirable to use in that environment as well.  Perhaps you can
suggest to the original author and/or maintainers that they consider
this method of error reporting for the distribution source as well.)


> It isn't really the problem of tcl/tk 8.4 but ruby package's has
> problem (or some lack) about handling of pthread library. 

Is there any test you know of that I can do to reproduce this problem?

So far I have not seen any problem that I can attribute to be pthread
related, though I must admit I've not yet run very many Ruby programs
yet.  :-)

Note also that as far as I can tell there's no dependency on any
threading library recorded anywhere in the ruby, tcl, or tk binary or
libraries (at least not on my machine) so I don't even see how the
pthread library could ever get in the way or cause any problems.  In
particular there's no use of any pthread library by the libtcl or libtk
libraries:

	$ ldd /usr/pkg/lib/libtcl84.so  /usr/pkg/lib/libtk84.so 
	/usr/pkg/lib/libtcl84.so:
	/usr/pkg/lib/libtk84.so:

There is also no dependency on any pthread library recorded in the pkg
database for any package that the "ruby" package depends on or that
those packages depend on.

	$ /usr/sbin/pkg_info -n tk tcl
	Information for tk-8.4.6nb3:
	
	
	Information for tcl-8.4.6nb5:
	
	

I don't think I've set any special configuration options that would have
avoided such a dependency, at least I don't see any such thing in the
'pkg_info -B' output for any of the ruby-related packages or any of
their dependencies.


> > 	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
> Do you use diffrent path, X11BASE?

Well, no (I use the standard /usr/X11R6, though note this is on an Alpha
so it's built from the old xsrc/xc, not the new xsrc/xfree/xc), but I do
install the default required "xpkgwedge" package so all X11 related
packages are forced into $LOCALBASE.

> I couldn't reproduce such
> situation on NetBSD 1.6.2/i386 machine.

Perhaps you don't have xpkgwedge installed?

How did the linker get the '-Wl,-R/usr/X11R6/lib' option passed to it
when linking tcltklib.so on your system and where did it ultimately come
from?

Or maybe somehow you have LD_LIBRARY_PATH set to include /usr/X11R6/lib
or something in LD_PRELOAD, or the equivalent still in /etc/ld.so.conf?

I have no /etc/ld.so.conf on my machine and I don't set any of the LD_*
variables in my default environment.

> > +post-configure:
> > +	${MV} ${WRKSRC}/Makefile ${WRKSRC}/Makefile.in
> > +	${SED} 's/^DLDFLAGS = /DLDFLAGS = \$${LDFLAGS}/' < ${WRKSRC}/Makefile.in > ${WRKSRC}/Makefile
> > +
> Can you specify what was need to passed by LDFLAGS?

LDFLAGS must always be passed to the linker in any unix-like development
environment if one wants one's build system to be portable.  In NetBSD's
pkgsrc environment its value comes from either CONFIGURE_ENV and/or
MAKE_ENV, depending on what phase is running and its value is set as
appropriate by various feature in the pkgsrc *.mk files.

In this case it's the '-L' and '-Wl' flags that matter but on some
systems the debugger and/or optimizer options must also be passed to the
linker (and the of course there's also sometimes the need for '-static'):

	$ cd ../../x11/ruby-tcltklib/                                      
	$ make show-var VARNAME=LDFLAGS  
	 -Wl,-R/usr/pkg/lib -L/usr/pkg/lib -Wl,-R/usr/X11R6/lib -L/usr/X11R6/lib

I note that in the ruby-tcltklib package the "--with-X11-dir="/usr/X11R6""
parameter was passed to "extconf.rb", but this did not seem to be used
to generate the equivalent '-L' and '-Wl' parameters for linking either.

(there are of course a vast number of other packages in pkgsrc which do
not correctly use the LDFLAGS value that pkgsrc provides for them and
hopefully eventually I or someone will get around to reporting them so
they can all be fixed :-)

-- 
						Greg A. Woods

+1 416 218-0098                  VE3TCP            RoboHack <woods@robohack.ca>
Planix, Inc. <woods@planix.com>          Secrets of the Weird <woods@weird.com>