[Pkg-tcltk-devel] Bug#440689: tcl configure --enable-64bit=yes on i386 => -m64

Ian Jackson iwj at ubuntu.com
Mon Sep 3 17:00:14 UTC 2007

Package: tcl8.4
Version: 8.4.15-1
Tags: patch

In ubuntu gutsy on i386 we have a version of gcc which accepts the
-m64 flag to generate 64-bit code.  (I imagine Debian will get that
same compiler at some point.)  However of course that code won't run.
This is generally fine of course if you don't pass that flag.

However, tcl8.4's unix/configure.in and unix/tcl.m4 conspire to try to
find out how to compile your code by saying -m64 and seeing whether
compilation and linking work.  Apparently they do but then the rest of
configure goes wrong - particularly, attempts to run programs fail and
configure decides all sorts of things are broken (see also my two
other recent bug reports).

I think the right answer is probably just to disable this automatic
selection of -m64 (on Linux, at least).  When we want 64-bit code, we
arrange for gcc to generate it without being asked specially.
However, I wasn't confident of my ground.

So instead I have fixed it by checking DEB_BUILD_ARCH for `*i386'*
(which will match the hurd builds too) and saying --disable-64bit in
that case.  The patch is below.

This same patch includes rudimentary support for
DEB_BUILD_OPTIONS=noopt.  NB that the question of what the delimiter
in DEB_BUILD_OPTIONS is is still undecided and the patch below assumes
it's spaces.


--- tcl8.4-8.4.15/debian/rules~	2007-09-03 16:49:03.000000000 +0100
+++ tcl8.4-8.4.15/debian/rules	2007-09-03 17:51:47.000000000 +0100
@@ -8,6 +8,25 @@
 v = 8.4
+DEB_BUILD_ARCH:=$(shell dpkg-architecture -qDEB_BUILD_ARCH)
+# patterns list architectures for which
+#	- compiler supports -m64
+#	- system cannot execute resulting code
+# this is a bit unpleasant but the alternative would be AC_TRY_RUN
+# which is bad for cross-compiling
+ifeq ($(filter-out *i386*, $(DEB_BUILD_ARCH)),)
+ifneq ($(filter noopt, $(DEB_BUILD_OPTIONS)),)
 	-quilt pop -a
@@ -27,11 +46,11 @@
 	touch generic/tclStubInit.c
 	cd unix && \
 	./configure --prefix=/usr --includedir=/usr/include/tcl$(v) \
-	    --enable-shared --enable-threads --enable-64bit \
+	    --enable-shared --enable-threads $(CONFIGURE_ENABLE_64) \
 	    --mandir=/usr/share/man --enable-man-symlinks \
 	    --enable-man-compression=gzip \
 	    && touch ../generic/tclStubInit.c && \
-	    $(MAKE) CFLAGS="-g -O2 -D_REENTRANT"
 # Build the static library.
 	cd unix && \
 	  ar cr libtcl$(v).a *.o && \

More information about the Pkg-tcltk-devel mailing list