Subject: bug#10896: Suggested Fix (for configure)

From: "ISHIKAWA,chiaki" <[email-masked]>
Date: Mon, 27 Feb 2012 22:36:04 +0900

This could be a Debian specific problem.
The failure was also observed on another Debian system.
(Which again is a cross between the current stable release, squeeze,
and the next version.)

I looked for crt1.o in supplied debian packages.

The following command prints out
the matched file names provided in each Debian package.

ishikawa@debian-vbox-ci:~$ dpkg --search "crt1.o"
libc6-dbg: /usr/lib/debug/usr/lib64/Scrt1.o
libc6-dbg: /usr/lib/debug/usr/lib64/crt1.o
libc6-dbg: /usr/lib/debug/usr/lib/i386-linux-gnu/crt1.o
libc6-dbg: /usr/lib/debug/usr/lib/i386-linux-gnu/Mcrt1.o
libc6-dev: /usr/lib/i386-linux-gnu/Scrt1.o
libc6-dbg: /usr/lib/debug/usr/lib/i386-linux-gnu/gcrt1.o
libc6-dbg: /usr/lib/debug/usr/lib64/Mcrt1.o
libc6-dbg: /usr/lib/debug/usr/lib64/gcrt1.o
libc6-dev: /usr/lib/i386-linux-gnu/Mcrt1.o
libc6-dev: /usr/lib/i386-linux-gnu/gcrt1.o
libc6-dev: /usr/lib/i386-linux-gnu/crt1.o
libc6-dbg: /usr/lib/debug/usr/lib/i386-linux-gnu/Scrt1.o

So they are all from libc6-dev, and libc6-dbg.

I got curious and checked the intallation status of libc6 on the computer.
Looks they are installed alright. See below

$ aptitude search libc6
i   libc6                           - Embedded GNU C Library: Shared
libraries
p   libc6-amd64                     - Embedded GNU C Library: 64bit
Shared libra
i A libc6-dbg                       - Embedded GNU C Library: detached
debugging
i A libc6-dev                       - Embedded GNU C Library:
Development Librar
p   libc6-dev-amd64                 - Embedded GNU C Library: 64bit
Development
i   libc6-i686                      - Embedded GNU C Library: Shared
libraries [
p   libc6-pic                       - Embedded GNU C Library: PIC
archive librar
p   libc6-prof                      - Embedded GNU C Library: Profiling
Librarie
p   libc6-xen                       - Embedded GNU C Library: Shared
libraries [

Lines that start with "i" in the first column mean the package on the
line are currently installed.

I wonder, though, why simple libc6 (not -dev, not -dbg) doesn't have
crt1.o according to the output of "dpkg --search".

Maybe emacs should not look at crt1.o?
At least not on the next Debian distribution currently in testing status?

The debian distribution on the PC I use is halfway across from
squeeze, the current stable version, to the next planned main release
version, w...something. I hate the clever naming.

GCC seems to have beeen installed without a problem.  It can compile
emacs after the aforementioned additional parameter to configure. It
can compile VirtualBox support modules for linux: I run this instance
of linux inside VirtualBox environment.  So the installation of GCC is
complete as far as I can tell.  (The other computer where emacs
configure without --with-crt-dir failed also has gcc
installed. It can compile and link mozill's thunderbird, a very
complex program, indeed. So GCC installation there is complete also.)

By the way, I diff'ed ./configure under 23.3 and 23.3 and didn't find
much change as far as CRT_DIR is concerned , so assume that it is not
that different.  So the cause seems to be a different packaging and
layout of libc6 under (newer) Debian packages.

I checked the time-stamp of the binary of emacs 23.3 which I compiled
myself on my PC and have been using.  emacs-23.3 compiled fine last
May (May 2011) when I used then current Debian distribution. So the
Debian packaging has changed between the current stable and the next
version (testing) since then.

Fix?

My suggestion is to move the test for the validity of CRT_DIR after
the case statement (and after the default setting of CRT_DIR). See
patch and the execution of configure below.  [Currently, it is tested
only inside the case statement for 64 bits checking. No checking is
done outside the case statement.]

Then, at least, the missing crt1.o is noticed immediately during the
configure before make is invoked.

PATCH to configure:

ishikawa@debian-vbox-ci:~/emacs-23.4$ diff -U 8 ./configure~ ./configure
--- ./configure~	2012-01-20 00:01:37.000000000 +0900
+++ ./configure	2012-02-27 17:39:20.000000000 +0900
@@ -5732,23 +5732,25 @@
    ## the location (bug#5655).
    ## Test for crtn.o, not just the directory, because sometimes the
    ## directory exists but does not have the relevant files (bug#1287).
    ## If user specified a crt-dir, use that unconditionally.
    if test "X$CRT_DIR" = "X"; then
      CRT_DIR=/usr/lib
      test -e /usr/lib64/crtn.o && CRT_DIR=/usr/lib64
    fi
-
-   test -e $CRT_DIR/crtn.o || test -e $CRT_DIR/crt0.o || \
-     as_fn_error $? "crt*.o not found.  Use --with-crt-dir to specify
the location." "$LINENO" 5
    ;;
+
 esac
 test "X$CRT_DIR" = "X" && CRT_DIR=/usr/lib

+test -e $CRT_DIR/crtn.o || test -e $CRT_DIR/crt0.o || \
+    as_fn_error $? "crt*.o not found.  Use --with-crt-dir to specify
the location." "$LINENO" 5
+
+

 if test "${with_sound}" != "no"; then
   # Sound support for GNU/Linux and the free BSDs.
   for ac_header in machine/soundcard.h sys/soundcard.h soundcard.h
 do :
ishikawa@debian-vbox-ci:~/emacs-23.4$ ./configure
checking build system type... i686-pc-linux-gnu
checking host system type... i686-pc-linux-gnu
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking how to run the C preprocessor... gcc -E
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking minix/config.h usability... no
checking minix/config.h presence... no
checking for minix/config.h... no
checking whether it is safe to define __EXTENSIONS__... yes
checking whether gcc understands -Wno-pointer-sign... yes
checking whether gcc understands -Wdeclaration-after-statement... yes
checking whether ln -s works... yes
checking how to run the C preprocessor... gcc -E
checking for a BSD-compatible install... /usr/bin/install -c
checking for ranlib... ranlib
checking for install-info... /usr/bin/install-info
checking for install-info... (cached) /usr/bin/install-info
checking for install-info... (cached) /usr/bin/install-info
checking for gzip... /bin/gzip
checking for makeinfo... /usr/bin/makeinfo
checking for -znocombreloc... yes
configure: checking the machine- and system-dependent files to find out
 - which libraries the lib-src programs will want, and
 - whether the GNU malloc routines are usable...
checking for special C compiler options needed for large files... no
checking for _FILE_OFFSET_BITS value needed for large files... 64
configure: error: crt*.o not found.  Use --with-crt-dir to specify the
location.
ishikawa@debian-vbox-ci:~/emacs-23.4$