Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.
Bug 174736 - can't build emacs from srpm
Summary: can't build emacs from srpm
Alias: None
Product: Fedora
Classification: Fedora
Component: emacs
Version: rawhide
Hardware: i386
OS: Linux
Target Milestone: ---
Assignee: Jens Petersen
QA Contact:
Depends On:
Blocks: FC5Target
TreeView+ depends on / blocked
Reported: 2005-12-01 20:16 UTC by Jonathan Kamens
Modified: 2007-11-30 22:11 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Last Closed: 2006-03-16 05:15:26 UTC

Attachments (Terms of Use)
emacs-dump.strace.gz (deleted)
2006-01-24 11:48 UTC, Jens Petersen
no flags Details

Description Jonathan Kamens 2005-12-01 20:16:34 UTC
I get this trying to build emacs from source RPM with gcc-4.0.2-6 and kernel-

Dumping under names emacs and emacs-21.4.1
Warning: Your system has a gap between BSS and the
heap (25018972 byte).  This usually means that exec-shield
or something similar is in effect.  The dump may
fail because of this.  See the section about
exec-shield in etc/PROBLEMS for more information.
Segmentation fault (core dumped)

I tried both turning off exec-shield and doing setarch x86 as suggested in 
etc/PROBLEMS, and the problem persists.

Comment 1 Jens Petersen 2005-12-14 07:56:24 UTC
So this is not related to bug 174730, right?

Comment 2 Jonathan Kamens 2005-12-14 16:07:48 UTC
I do not believe these bugs are related.  I tried turning off -fstack-
protector, and that didn't fix this bug.

Comment 3 Jens Petersen 2005-12-20 07:18:53 UTC
Ok, i386 presumably?

Comment 4 Jonathan Kamens 2005-12-20 18:42:54 UTC
Yes, i386.

Comment 5 Jens Petersen 2006-01-24 08:09:51 UTC
Hmm, finally got a chance to look at this.  Turning off exec-shield
doesn't help anyway, nor "setarch i386".

The segfault is happening during dumping again:

LC_ALL=C ./temacs -batch -l loadup dump
Loading loadup (source)...
Using load-path (/home/petersen/emacs-21.4/lisp)
Loading byte-run...
Loading subr...
Loading version.el (source)...
Loading widget...
Loading custom...
Loading float-sup...
((50723 . 16252) (8262 . 0) (510 . 57) 71542 134842 (14 . 9) (21 . 0) (7070 . 14
Loading vc-hooks...
Loading ediff-hook...
((51666 . 15309) (8352 . 0) (511 . 56) 72439 134859 (14 . 9) (21 . 0) (7129 . 14
Finding pointers to doc strings...
Finding pointers to doc strings...done
Wrote /home/petersen/emacs-21.4/lib-src/fns-21.4.1.el
Dumping under names emacs and emacs-21.4.1
Warning: Your system has a gap between BSS and the
heap (15422940 byte).  This usually means that exec-shield
or something similar is in effect.  The dump may
fail because of this.  See the section about
exec-shield in etc/PROBLEMS for more information.
make[1]: *** [emacs] Segmentation fault
make[1]: *** Deleting file `emacs'
make[1]: Leaving directory `/home/petersen/emacs-21.4/src'
make: *** [src] Error 2

Comment 6 Jakub Jelinek 2006-01-24 10:09:52 UTC
Is emacs built with -fstack-protector (by default in $RPM_OPT_FLAGS) or not?
That could be one of the reasons, I guess that's incompatible with emacs
crappy dumping.
But, the above warning suggests there could be something related to
VM layout too, can you provide strace dump?

Comment 7 Jens Petersen 2006-01-24 11:43:58 UTC
Emacs isn't built with -fstack-protector anymore with 21.4-11, but that
doesn't help here.

Comment 8 Jens Petersen 2006-01-24 11:48:09 UTC
Created attachment 123609 [details]

Strace of temacs dumping.

Comment 9 Jens Petersen 2006-02-27 12:21:39 UTC
In bug 182084 it was suggested (indirectly) to pass -R to setarch,
which disables address randomization.  Does that help with building on i386?

Comment 10 Jens Petersen 2006-02-27 13:47:15 UTC
I added the -R option to setarch in 21.4-13: does it help?

Comment 11 Jens Petersen 2006-02-28 03:48:52 UTC
According to the reporter in bug 182084, it fixes the build problem. :)

Comment 12 Jonathan Kamens 2006-03-03 19:36:22 UTC
Doesn't seem to help.  Still segfaults on i386 with 21.4-13.

Comment 13 Sam Peterson 2006-03-06 03:24:36 UTC
"Doesn't seem to help.  Still segfaults on i386 with 21.4-13."

Hmm, weird, it seemed to work for me (the package built anyway).  I
unfortunately do not have an FC5 system up and running that I can test on.  I
admittedly tried other things including disabling exec shield system wide,
however, The build worked upon a reboot, so I figured that wasn't the problem. 
I will try again tonight an my FC4 system just to make sure the "-R" wasn't some
kind of fluke.

Comment 14 Sam Peterson 2006-03-06 04:23:15 UTC
Okay, from a couple of test builds I have come to the conclusion that the "-R"
is needed, but not in the RPM spec file.  Instead, I used the following command
to build the rpm:

setarch i386 -R rpmbuild --rebuild --nodeps emacs-21.4-13.src.rpm

I even removed the "-R" commands from the setarch commands in the spec file and
tested with that, and it still built okay.

My apologies for barking up the wrong tree, but it looks like I wasn't
completely off track, just confused.

Unfortunately, this looks like something the RPM can't fix, you'll just have to
make sure you build the package with the "setarch i386 -R" command.  The "-R" is
necessary, I tried just "setarch i386" and that didn't work.

If you people want to try that and let me know if that works for you.  It worked
for me.

I don't know why it works that way, and doesn't work in the spec file.  It could
be the SETARCH environment variable isn't being put in the right place on the
command line.

The reason I built with --nodeps is that apparently there are build dependencies
on libXaw-devel and libX11-devel packages, both of which I don't seem to have. 
The package built fine without either however.  I do have packages named
Xaw3d-devel and xorg-x11-devel.  Not sure if this is a problem with the package
build dependencies or if third party repositories have muddled-up my package names.

Comment 15 Jonathan Kamens 2006-03-06 05:18:49 UTC
This really needs to be fixed inside the rpm spec file, not outside of it.  I
can't imagine any reason why this wouldn't be possible if done properly.

Comment 16 Sam Peterson 2006-03-06 05:44:08 UTC
So uh, I take it that it worked for you then?  I can't imagine why it couldn't
be fixed in the rpm either, but I'm kind of at a loss on tracking it down.  I'm
just another user like yourself :).  Maybe Jens has some insights.

Comment 17 Jens Petersen 2006-03-06 11:09:03 UTC
Sam, this bug is about building Emacs under FC5 - I'm not aware of any
problems with rebuilding it on FC4.

Comment 18 Sam Peterson 2006-03-06 12:19:48 UTC
The nature of the problem seems very similar though.  I'd be curious about what
would specific to FC5 that would cause it.  The segfaults during the dump and
the error message right before the dump were exactly what I was seeing on FC4. 
Jonathan hasn't said whether or not he's tried build the rpm with my suggestion yet.

Comment 19 Jonathan Kamens 2006-03-06 13:24:24 UTC
Yes, your suggestion worked for me.

Comment 20 Jens Petersen 2006-03-06 13:43:21 UTC
Sam, sorry you're right - I finally tested on an i386 rawhide box and
"setarch i386 -R rpmbuild ..." works for me too. :)

Comment 21 Jens Petersen 2006-03-07 12:11:42 UTC
Ok, I think it should be fixed in 21.4-14.

Comment 22 Jonathan Kamens 2006-03-16 05:15:26 UTC
Yes, it appears to be.

Note You need to log in before you can comment on or make changes to this bug.