Hi,
I've tried to compile the latest CVS emacs version with profiling and
coverage. Under Fedora-10_x86_64 that's the environment used:
gcc --version = 4.3.2 20081105 (Red Hat 4.3.2-7)
ld -version = 2.18.50.0.9-8.fc10 20080822
autoconf --version = 2.63
automake --version = 1.10.1
glibc 2.9
CFLAGS="-pg -coverage"
LDFLAGS="-pg -coverage"
The command "./configure --prefix=/bla/bla" works fine. Then, "make"
starts to compile, failing at
gcc -nostdlib `./prefix-args -Xlinker -z nocombreloc` -pg -coverage
-Wl,-znocombreloc -o temacs pre-crt0.o /usr/lib64/crt1.o
/usr/lib64/crti.o dispnew.o frame.o scroll.o xdisp.o menu.o xmenu.o
window.o charset.o coding.o category.o ccl.o character.o chartab.o
cm.o term.o terminal.o xfaces.o xterm.o xfns.o xselect.o xrdb.o
fontset.o xsmfns.o fringe.o image.o gtkutil.o dbusbind.o emacs.o
keyboard.o macros.o keymap.o sysdep.o buffer.o filelock.o insdel.o
marker.o minibuf.o fileio.o dired.o filemode.o cmds.o casetab.o
casefiddle.o indent.o search.o regex.o undo.o alloc.o data.o doc.o
editfns.o callint.o eval.o floatfns.o fns.o font.o print.o lread.o
syntax.o unexelf.o bytecode.o process.o callproc.o region-cache.o
sound.o atimer.o doprnt.o strftime.o intervals.o textprop.o
composite.o md5.o xfont.o ftfont.o xftfont.o ftxfont.o terminfo.o
lastfile.o vm-limit.o -lgtk-x11-2.0 -lgdk-x11-2.0 -latk-1.0 -lgio-2.0
-lpangoft2-1.0 -lgdk_pixbuf-2.0 -lpangocairo-1.0 -lcairo -lpango-1.0
-lfreetype -lfontconfig -lgobject-2.0 -lgmodule-2.0 -lglib-2.0
-lpthread -lSM -lICE -ltiff -ljpeg -lpng -lz -lm -lgif -lXpm -lX11
-lXft -lXrender -lfontconfig -lfreetype -lX11 -lasound -lrsvg-2
-lgdk_pixbuf-2.0 -lcairo -lgobject-2.0 -lgmodule-2.0 -lglib-2.0
-L/lib64 -ldbus-1 -lgpm -lncurses -lm -lgcc -lc -lgcc
/usr/lib64/crtn.o
with the message
/usr/lib/gcc/x86_64-redhat-linux/4.3.2/libgcov.a(_gcov.o): In function `__gcov_init':
(.text+0x148): undefined reference to `atexit'
collect2: ld returned 1 exit status
make[1]: *** [temacs] Error 1
Q1: Is this a problem of the Fedora-10 environment?
Q2: It is reproducible in other environments?
The only way I've found to get 'temacs' compiled is by manually cd-ing 'src'
directory and issuing the command
gcc `./prefix-args -Xlinker -z nocombreloc` -pg -coverage
-Wl,-znocombreloc -o temacs pre-crt0.o dispnew.o frame.o scroll.o
xdisp.o menu.o xmenu.o window.o charset.o coding.o category.o ccl.o
character.o chartab.o cm.o term.o terminal.o xfaces.o xterm.o xfns.o
xselect.o xrdb.o fontset.o xsmfns.o fringe.o image.o gtkutil.o
dbusbind.o emacs.o keyboard.o macros.o keymap.o sysdep.o buffer.o
filelock.o insdel.o marker.o minibuf.o fileio.o dired.o filemode.o
cmds.o casetab.o casefiddle.o indent.o search.o regex.o undo.o alloc.o
data.o doc.o editfns.o callint.o eval.o floatfns.o fns.o font.o
print.o lread.o syntax.o unexelf.o bytecode.o process.o callproc.o
region-cache.o sound.o atimer.o doprnt.o strftime.o intervals.o
textprop.o composite.o md5.o xfont.o ftfont.o xftfont.o ftxfont.o
terminfo.o lastfile.o vm-limit.o -lgtk-x11-2.0 -lgdk-x11-2.0 -latk-1.0
-lgio-2.0 -lpangoft2-1.0 -lgdk_pixbuf-2.0 -lpangocairo-1.0 -lcairo
-lpango-1.0 -lfreetype -lfontconfig -lgobject-2.0 -lgmodule-2.0
-lglib-2.0 -lpthread -lSM -lICE -ltiff -ljpeg -lpng -lz -lm -lgif
-lXpm -lX11 -lXft -lXrender -lfontconfig -lfreetype -lX11 -lasound
-lrsvg-2 -lgdk_pixbuf-2.0 -lcairo -lgobject-2.0 -lgmodule-2.0
-lglib-2.0 -L/lib64 -ldbus-1 -lgpm -lncurses -lm -lgcc -lc -lgcc
That is, I had to remove '/usr/lib64/crt[1in].o' files and the flag '-nostdlib'. Ok
then, once I had 'temacs' compiled, I continued with the 'make' command from
the top directory. Then I get the error:
`/bin/pwd`/temacs --batch --load loadup bootstrap
make[1]: *** [bootstrap-emacs] Profiling timer expired
At this point there's no way to continue unless you edit 'emacs.c' and add
this patch:
diff -c -2 -r1.462 emacs.c
*** src/emacs.c 1 Mar 2009 12:40:39 -0000 1.462
--- src/emacs.c 1 Mar 2009 19:08:32 -0000
***************
*** 787,790 ****
--- 787,792 ----
main (int argc, char **argv)
{
+ struct itimerval itval = {{0, 0}, {0, 0}};
+ setitimer (ITIMER_PROF, &itval, NULL);
#if GC_MARK_STACK
Lisp_Object dummy;
Q3: Should this patch progress to CVS?
Compiled again 'temacs' and continued with the make process, finishing
without problems. 'make install' and run 'emacs' without problems, obtaining
all information files for gprof and gcov.
-- Francesc Rocher