GNU bug report logs - #12047
24.1.50; configure fails on Gentoo FreeBSD

Previous Next

Package: emacs;

Reported by: Ulrich Mueller <ulm <at> gentoo.org>

Date: Wed, 25 Jul 2012 23:13:02 UTC

Severity: important

Tags: patch

Found in version 24.1.50

Fixed in version 24.2

Done: Glenn Morris <rgm <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 12047 in the body.
You can then email your comments to 12047 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#12047; Package emacs. (Wed, 25 Jul 2012 23:13:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Ulrich Mueller <ulm <at> gentoo.org>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Wed, 25 Jul 2012 23:13:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Ulrich Mueller <ulm <at> gentoo.org>
To: bug-gnu-emacs <at> gnu.org
Subject: 24.1.50; configure fails on Gentoo FreeBSD
Date: Thu, 26 Jul 2012 01:05:32 +0200
[Message part 1 (text/plain, inline)]
Emacs from BZR (but also 24.1) fails on Gentoo FreeBSD 9.0 during
configure:

   configure: error: Required file(s) not found: crtn.o crt1.o crti.o
   Try using the --with-crt-dir option.
   $ uname -a
   FreeBSD eunomia 9.0-Gentoo FreeBSD Gentoo 9.0 #0: Tue Jul 24 02:42:55 CEST 2012     root@:/usr/src/sys/amd64/compile/GENERIC  amd64

The problem is that crt{1,i,n}.o (which are installed by freebsd-lib)
are located in /usr/lib, whereas crt{begin,end}.o (installed by gcc)
are in /usr/lib/gcc/x86_64-gentoo-freebsd9.0/4.5.3.

Obviously, specifying a location with --with-crt-dir wouldn't help in
this situation, because configure assumes that all crt*.o files are
in the same directory.

Attached patch fixes the problem for me.

(Another question is why crtbegin.o and crtend.o are needed for
linking on FreeBSD, in the first place? Emacs builds and runs here
without apparent problems, even if linked without these files.)

[emacs.patch (text/plain, inline)]
--- emacs-orig/ChangeLog
+++ emacs/ChangeLog
@@ -1,3 +1,10 @@
+2012-07-25  Ulrich Müller  <ulm <at> gentoo.org>
+
+	* configure.in: Don't assume that crtbegin.o and crtend.o are in
+	the same directory as crt1.o.
+	(--with-crtbegin-dir): New option.
+	(CRTBEGIN_DIR): New output variable.
+
 2012-07-17  Dmitry Antipov  <dmantipov <at> yandex.ru>
 
 	Fix toolkit configuration report.
--- emacs-orig/src/ChangeLog
+++ emacs/src/ChangeLog
@@ -1,3 +1,7 @@
+2012-07-25  Ulrich Müller  <ulm <at> gentoo.org>
+
+	* Makefile.in (CRTBEGIN_DIR): New variable.
+
 2012-07-25  Martin Rudalics  <rudalics <at> gmx.at>
 
 	* frame.c (Fredirect_frame_focus): In doc-string don't mention
--- emacs-orig/configure.ac
+++ emacs/configure.ac
@@ -212,6 +212,12 @@
 The default is /usr/lib, or /usr/lib64 on some platforms.])])
 CRT_DIR="${with_crt_dir}"
 
+CRTBEGIN_DIR=$CRT_DIR
+AC_ARG_WITH([crtbegin-dir],
+[AS_HELP_STRING([--with-crtbegin-dir=DIR],
+[directory containing crtbegin.o and crtend.o; defaults to crt-dir])])
+CRTBEGIN_DIR="${with_crtbegin_dir}"
+
 AC_ARG_WITH(gameuser,dnl
 [AS_HELP_STRING([--with-gameuser=USER],[user for shared game score files])])
 test "X${with_gameuser}" != X && test "${with_gameuser}" != yes \
@@ -987,8 +993,8 @@
     START_FILES='pre-crt0.o'
     ;;
   freebsd )
-    LIB_STANDARD='-lgcc -lc -lgcc $(CRT_DIR)/crtend.o $(CRT_DIR)/crtn.o'
-    START_FILES='pre-crt0.o $(CRT_DIR)/crt1.o $(CRT_DIR)/crti.o $(CRT_DIR)/crtbegin.o'
+    LIB_STANDARD='-lgcc -lc -lgcc $(CRTBEGIN_DIR)/crtend.o $(CRT_DIR)/crtn.o'
+    START_FILES='pre-crt0.o $(CRT_DIR)/crt1.o $(CRT_DIR)/crti.o $(CRTBEGIN_DIR)/crtbegin.o'
     SYSTEM_TYPE=berkeley-unix
     ;;
   gnu-linux | gnu-kfreebsd )
@@ -1001,8 +1007,8 @@
     ;;
   dnl NB this may be adjusted below.
   netbsd | openbsd )
-    LIB_STANDARD='-lgcc -lc -lgcc $(CRT_DIR)/crtend.o'
-    START_FILES='pre-crt0.o $(CRT_DIR)/crt0.o $(CRT_DIR)/crtbegin.o'
+    LIB_STANDARD='-lgcc -lc -lgcc $(CRTBEGIN_DIR)/crtend.o'
+    START_FILES='pre-crt0.o $(CRT_DIR)/crt0.o $(CRTBEGIN_DIR)/crtbegin.o'
     SYSTEM_TYPE=berkeley-unix
     ;;
 
@@ -1019,14 +1025,17 @@
 
 dnl Not all platforms use crtn.o files.  Check if the current one does.
 crt_files=
+crtbegin_files=
 
 for file in x $LIB_STANDARD $START_FILES; do
   case "$file" in
     *CRT_DIR*) crt_files="$crt_files `echo $file | sed -e 's|.*/||'`" ;;
+    *CRTBEGIN_DIR*)
+      crtbegin_files="$crtbegin_files `echo $file | sed -e 's|.*/||'`" ;;
   esac
 done
 
-if test "x$crt_files" != x; then
+if test "x$crt_files" != x || test "x$crtbegin_files" != x; then
 
   ## If user specified a crt-dir, use that unconditionally.
   crt_gcc=no
@@ -1058,6 +1067,12 @@
 
   fi                            # CRT_DIR = ""
 
+  crtbegin_gcc=no
+  if test "X$CRTBEGIN_DIR" = X; then
+    CRTBEGIN_DIR=$CRT_DIR
+    crtbegin_gcc=$crt_gcc
+  fi
+
   crt_missing=
 
   for file in $crt_files; do
@@ -1082,13 +1097,26 @@
     test -e $CRT_DIR/$file || crt_missing="$crt_missing $file"
   done                          # $crt_files
 
+  dnl Same as above, but for crtbegin.o and crtend.o.
+  for file in $crtbegin_files; do
+    if test $crtbegin_gcc = yes && test ! -e "$CRTBEGIN_DIR/$file"; then
+       crt_file=`$CC --print-file-name=$file 2>/dev/null`
+       case "$crt_file" in
+         */*) CRTBEGIN_DIR=`AS_DIRNAME(["$crt_file"])` ;;
+       esac
+    fi
+    crtbegin_gcc=no
+    test -e "$CRTBEGIN_DIR/$file" || crt_missing="$crt_missing $file"
+  done
+
   test "x$crt_missing" = x || \
     AC_MSG_ERROR([Required file(s) not found:$crt_missing
-Try using the --with-crt-dir option.])
+Try using the --with-crt-dir or --with-crtbegin-dir option.])
 
-fi                              # crt_files != ""
+fi                              # crt_files != "" || crtbegin_files != ""
 
 AC_SUBST(CRT_DIR)
+AC_SUBST(CRTBEGIN_DIR)
 
 case $opsys in
   netbsd | openbsd )
@@ -1097,8 +1125,8 @@
         test -f $CRT_DIR/crtn.o || \
           AC_MSG_ERROR([Required file not found: crtn.o])
 
-        LIB_STANDARD='-lgcc -lc -lgcc $(CRT_DIR)/crtend.o $(CRT_DIR)/crtn.o'
-        START_FILES='pre-crt0.o $(CRT_DIR)/crt0.o $(CRT_DIR)/crti.o $(CRT_DIR)/crtbegin.o'
+        LIB_STANDARD='-lgcc -lc -lgcc $(CRTBEGIN_DIR)/crtend.o $(CRT_DIR)/crtn.o'
+        START_FILES='pre-crt0.o $(CRT_DIR)/crt0.o $(CRT_DIR)/crti.o $(CRTBEGIN_DIR)/crtbegin.o'
     fi
     ;;
 esac
--- emacs-orig/src/Makefile.in
+++ emacs/src/Makefile.in
@@ -126,6 +126,7 @@
 LIB_GCC=@LIB_GCC@
 
 CRT_DIR=@CRT_DIR@
+CRTBEGIN_DIR=@CRTBEGIN_DIR@
 ## May use $CRT_DIR.
 LIB_STANDARD=@LIB_STANDARD@
 START_FILES = @START_FILES@

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#12047; Package emacs. (Fri, 27 Jul 2012 07:44:02 GMT) Full text and rfc822 format available.

Message #8 received at 12047 <at> debbugs.gnu.org (full text, mbox):

From: Ulrich Mueller <ulm <at> gentoo.org>
To: 12047 <at> debbugs.gnu.org
Subject: Re: 24.1.50; configure fails on Gentoo FreeBSD
Date: Fri, 27 Jul 2012 09:36:48 +0200
[Message part 1 (text/plain, inline)]
> (Another question is why crtbegin.o and crtend.o are needed for
> linking on FreeBSD, in the first place? Emacs builds and runs here
> without apparent problems, even if linked without these files.)

Coming back to this. After talking to the Gentoo BSD team, I've now
dropped crtbegin.o and crtend.o from linking on FreeBSD in the
Gentoo package.

See attached patch. Tested on Gentoo FreeBSD 9.0 and on (vanilla)
FreeBSD 7.0. It builds and runs just fine.

[emacs.patch (text/plain, inline)]
--- emacs-orig/ChangeLog
+++ emacs/ChangeLog
@@ -1,3 +1,8 @@
+2012-07-27  Ulrich Müller  <ulm <at> gentoo.org>
+
+	* configure.ac (LIB_STANDARD, START_FILES): On FreeBSD, don't
+	include crtbegin.o and crtend.o in the link (Bug#12047).
+
 2012-07-17  Dmitry Antipov  <dmantipov <at> yandex.ru>
 
 	Fix toolkit configuration report.
--- emacs-orig/configure.ac
+++ emacs/configure.ac
@@ -987,8 +987,8 @@
     START_FILES='pre-crt0.o'
     ;;
   freebsd )
-    LIB_STANDARD='-lgcc -lc -lgcc $(CRT_DIR)/crtend.o $(CRT_DIR)/crtn.o'
-    START_FILES='pre-crt0.o $(CRT_DIR)/crt1.o $(CRT_DIR)/crti.o $(CRT_DIR)/crtbegin.o'
+    LIB_STANDARD='-lgcc -lc -lgcc $(CRT_DIR)/crtn.o'
+    START_FILES='pre-crt0.o $(CRT_DIR)/crt1.o $(CRT_DIR)/crti.o'
     SYSTEM_TYPE=berkeley-unix
     ;;
   gnu-linux | gnu-kfreebsd )

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#12047; Package emacs. (Wed, 01 Aug 2012 00:01:02 GMT) Full text and rfc822 format available.

Message #11 received at 12047 <at> debbugs.gnu.org (full text, mbox):

From: Ulrich Mueller <ulm <at> gentoo.org>
To: 12047 <at> debbugs.gnu.org
Subject: Re: 24.1.50; configure fails on Gentoo FreeBSD
Date: Wed, 1 Aug 2012 01:53:27 +0200
Small update: I've had the chance to test it also on an ancient
FreeBSD version (4.2, released in November 2000). Emacs 24.1 builds
and runs fine without being linked to crt{begin,end}.o.

(In contrast, on recent OpenBSD 5.1 these files are needed. Omitting
crt{begin,end}.o causes linking to fail with an "undefined reference
to __init".)




Reply sent to Glenn Morris <rgm <at> gnu.org>:
You have taken responsibility. (Wed, 01 Aug 2012 07:29:02 GMT) Full text and rfc822 format available.

Notification sent to Ulrich Mueller <ulm <at> gentoo.org>:
bug acknowledged by developer. (Wed, 01 Aug 2012 07:29:02 GMT) Full text and rfc822 format available.

Message #16 received at 12047-done <at> debbugs.gnu.org (full text, mbox):

From: Glenn Morris <rgm <at> gnu.org>
To: 12047-done <at> debbugs.gnu.org
Subject: Re: bug#12047: 24.1.50; configure fails on Gentoo FreeBSD
Date: Wed, 01 Aug 2012 03:21:11 -0400
Version: 24.2

Thank you; applied.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Wed, 29 Aug 2012 11:24:03 GMT) Full text and rfc822 format available.

This bug report was last modified 12 years and 78 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.