all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#12047: 24.1.50; configure fails on Gentoo FreeBSD
@ 2012-07-25 23:05 Ulrich Mueller
  2012-07-27  7:36 ` Ulrich Mueller
  0 siblings, 1 reply; 4+ messages in thread
From: Ulrich Mueller @ 2012-07-25 23:05 UTC (permalink / raw)
  To: 12047

[-- Attachment #1: message body text --]
[-- Type: text/plain, Size: 930 bytes --]

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.)


[-- Attachment #2: emacs.patch --]
[-- Type: text/plain, Size: 4703 bytes --]

--- emacs-orig/ChangeLog
+++ emacs/ChangeLog
@@ -1,3 +1,10 @@
+2012-07-25  Ulrich Müller  <ulm@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@yandex.ru>
 
 	Fix toolkit configuration report.
--- emacs-orig/src/ChangeLog
+++ emacs/src/ChangeLog
@@ -1,3 +1,7 @@
+2012-07-25  Ulrich Müller  <ulm@gentoo.org>
+
+	* Makefile.in (CRTBEGIN_DIR): New variable.
+
 2012-07-25  Martin Rudalics  <rudalics@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@

^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#12047: 24.1.50; configure fails on Gentoo FreeBSD
  2012-07-25 23:05 bug#12047: 24.1.50; configure fails on Gentoo FreeBSD Ulrich Mueller
@ 2012-07-27  7:36 ` Ulrich Mueller
  2012-07-31 23:53   ` Ulrich Mueller
  0 siblings, 1 reply; 4+ messages in thread
From: Ulrich Mueller @ 2012-07-27  7:36 UTC (permalink / raw)
  To: 12047

[-- Attachment #1: message body text --]
[-- Type: text/plain, Size: 460 bytes --]

> (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.


[-- Attachment #2: emacs.patch --]
[-- Type: text/plain, Size: 820 bytes --]

--- emacs-orig/ChangeLog
+++ emacs/ChangeLog
@@ -1,3 +1,8 @@
+2012-07-27  Ulrich Müller  <ulm@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@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 )

^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#12047: 24.1.50; configure fails on Gentoo FreeBSD
  2012-07-27  7:36 ` Ulrich Mueller
@ 2012-07-31 23:53   ` Ulrich Mueller
  2012-08-01  7:21     ` Glenn Morris
  0 siblings, 1 reply; 4+ messages in thread
From: Ulrich Mueller @ 2012-07-31 23:53 UTC (permalink / raw)
  To: 12047

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".)





^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#12047: 24.1.50; configure fails on Gentoo FreeBSD
  2012-07-31 23:53   ` Ulrich Mueller
@ 2012-08-01  7:21     ` Glenn Morris
  0 siblings, 0 replies; 4+ messages in thread
From: Glenn Morris @ 2012-08-01  7:21 UTC (permalink / raw)
  To: 12047-done

Version: 24.2

Thank you; applied.





^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-08-01  7:21 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-07-25 23:05 bug#12047: 24.1.50; configure fails on Gentoo FreeBSD Ulrich Mueller
2012-07-27  7:36 ` Ulrich Mueller
2012-07-31 23:53   ` Ulrich Mueller
2012-08-01  7:21     ` Glenn Morris

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.