Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 27716 - Segfault during guile-1.6.4 compilation on PPC
Summary: Segfault during guile-1.6.4 compilation on PPC
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Development (show other bugs)
Hardware: PPC Linux
: High normal (vote)
Assignee: Alastair Tse (RETIRED)
URL:
Whiteboard:
Keywords:
: 85670 (view as bug list)
Depends on:
Blocks:
 
Reported: 2003-09-01 08:55 UTC by Olivier Castan
Modified: 2005-06-25 10:21 UTC (History)
4 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Olivier Castan 2003-09-01 08:55:37 UTC
Doing 'emerge -uv --deep world', guile on my system should be updated from 1.4.1
to 1.6.4. While making files I get :

[...]
cat alist.doc arbiters.doc async.doc backtrace.doc boolean.doc chars.doc
continuations.doc debug.doc dynl.doc dynwind.doc environments.doc eq.doc
error.doc eval.doc evalext.doc extensions.doc feature.doc fluids.doc fports.doc
gc.doc goops.doc gsubr.doc guardians.doc hash.doc hashtab.doc hooks.doc init.doc
ioext.doc iselect.doc keywords.doc lang.doc list.doc load.doc macros.doc
mallocs.doc modules.doc numbers.doc objects.doc objprop.doc options.doc
pairs.doc ports.doc print.doc procprop.doc procs.doc properties.doc random.doc
rdelim.doc read.doc root.doc rw.doc scmsigs.doc script.doc simpos.doc smob.doc
sort.doc srcprop.doc stackchk.doc stacks.doc stime.doc strings.doc strop.doc
strorder.doc strports.doc struct.doc symbols.doc throw.doc values.doc
variable.doc vectors.doc version.doc vports.doc weaks.doc symbols-deprecated.doc
ramap.doc unif.doc filesys.doc posix.doc net_db.doc socket.doc regex-posix.doc |
GUILE="/home/portage/tmp/portage/guile-1.6.4/work/guile-1.6.4/pre-inst-guile"
../scripts/snarf-check-and-output-texi --manual > guile.texi || { rm guile.texi;
false; }
make[2]: *** [guile.texi] Erreur 1
[...]

Similar behavior has already been reported twice in the forums without any good
workaround :
- x86 : http://forums.gentoo.org/viewtopic.php?t=72945&highlight=guile
- ppc : http://forums.gentoo.org/viewtopic.php?t=72916&highlight=guile

In fact this error is due to a segmentation fault running the newly compiled
binary libguile/.libs/lt-guile (called by the script). The function
scm_mark_locations seems to be called with a huge internal stack length. This
length is calculated by scm_stack_size which depends on a #define
(SCM_STACK_GROWS_UP) set by configure. With CFLAGS="-O3 -pipe -mcpu=750"
configure define SCM_STACK_GROWS_UP (according to what I found on the net,
that's wrong, ppc stack, like x86, grows down) ; with CFLAGS=""
SCM_STACK_GROWS_UP is not set. So I guess the code used in configure to find the
stack direction is not immune to compiler optimization flags.

Reproducible: Always
Steps to Reproduce:
1.
2.
3.




emerge info :

Portage 2.0.49-r2 (default-ppc-1.4, gcc-3.2.3, glibc-2.2.5-r4,2.3.2-r1,
2.4.21-ppc-r2)
=================================================================
System uname: 2.4.21-ppc-r2 ppc
ACCEPT_KEYWORDS="ppc ~ppc"
AUTOCLEAN="yes"
CFLAGS="-O3 -pipe -mcpu=750"
CHOST="powerpc-unknown-linux-gnu"
COMPILER="gcc3"
CONFIG_PROTECT="/etc /var/qmail/control /usr/share/config
/usr/kde/2/share/config /usr/kde/3/share/config /usr/X11R6/lib/X11/xkb"
CONFIG_PROTECT_MASK="/etc/gconf /etc/env.d"
CXXFLAGS="-O3 -pipe -mcpu=750"
DISTDIR="/home/portage/distfiles"
FEATURES="ccache"
GENTOO_MIRRORS="http://194.83.57.11/sites/www.ibiblio.org/gentoo/
http://ftp.snt.utwente.nl/pub/os/linux/gentoo
http://194.83.57.7/sites/www.ibiblio.org/gentoo/
http://194.83.57.2/sites/www.ibiblio.org/gentoo/
http://194.83.57.3/sites/www.ibiblio.org/gentoo/"
MAKEOPTS="-j2"
PKGDIR="/usr/portage/packages"
PORTAGE_TMPDIR="/home/portage/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY=""
SYNC="rsync://rsync.fr.gentoo.org/gentoo-portage"
USE="oss xv jpeg nls mitshm gif png truetype ppc foomaticdb gnome-libs gdbm
berkdb slang readline bonobo tcltk guile X sdl gpm tcpd pam libwww perl python
esd imlib gnome gtk motif opengl mozilla alsa cups gd spell pdflib java xface
crypt -kde avi mpeg quicktime flash gtkhtml -qt dvd oggvorbis ssl -mysql"


tail -20 config.log :

#define PACKAGE_NAME ""
#define PACKAGE_STRING ""
#define PACKAGE_TARNAME ""
#define PACKAGE_VERSION ""
#define READER_EXTENSIONS 1
#define RETSIGTYPE void
#define SCM_DEBUG_DEPRECATED 0
#define SCM_SINGLES 1
#define SCM_STACK_GROWS_UP 1
#define SCM_WARN_DEPRECATED_DEFAULT "summary"
#define SIZEOF_INT 4
#define SIZEOF_LONG 4
#define SIZEOF_LONG_LONG 8
#define SIZEOF_VOID_P 4
#define STDC_HEADERS 1
#define STDC_HEADERS 1
#define TIME_WITH_SYS_TIME 1
#define WORDS_BIGENDIAN 1
Comment 1 Mitchell 2003-09-30 08:30:46 UTC
You need to lower your CFLAGS & CXXFLAGS.  I tried it with "-O3 -pipe -mcpu=750"
and that didn't work.  It worked when I used "-O1 -pipe -mcpu=750"
Comment 2 Olivier Castan 2003-10-01 00:52:46 UTC
Yes I guess that should work (I've done a workaround that may be similar).
In fact the source code runs fine with -O3 flag, it's only the m4 macro in
configure which incorrectly reports the direction of the stack (in details,
a program is compiled and compare the address of local vars between main
and a function called. Without optimization the answer is correct, with -03
the address are identical and the answer should be unknown and make the configure
fail, but it's only a binary answer : if it don't grows down it is assumed
it grows up). I've found some discussion threads on the subject on the net
: the address are the same because gcc detects one the local vars is never
assigned and so is useless... According to an answer it's a bug in gcc since
ANSI requires to different objects to have different locations... I'm not
good enough in C to conclude.
Comment 3 John Steele Scott 2004-02-25 04:52:21 UTC
Oliver, thanks for documenting your info on the bug here, with that information I was able to create a fix. I have just compiled guile on ppc with -O3. The configure file should be patched as follows (I suspect this patch should be applied to configure.in and sent upstream):

--- configure.orig      2004-02-25 19:54:59.000000000 +1030
+++ configure   2004-02-25 21:09:50.000000000 +1030
@@ -17479,8 +17479,8 @@
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 aux (l) unsigned long l;
-            { int x; exit (l >= ((unsigned long)&x)); }
-          main () { int q; aux((unsigned long)&q); }
+             { volatile int x; x = l;  exit (l >= ((unsigned long)&x)); }
+                       main () { int q; aux((unsigned long)&q); }
 _ACEOF
 rm -f conftest$ac_exeext
 if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
Comment 4 Olivier Castan 2004-02-28 02:54:57 UTC
I'm glad it helped you, but anyway it looks like gcc has a faulty behavior...
Comment 5 Pieter Van den Abeele (RETIRED) gentoo-dev 2004-08-19 17:56:26 UTC
I have reproduced this error. Will look into fixing it.
Comment 6 SpanKY gentoo-dev 2004-08-20 17:22:56 UTC
for future reference pvdabeel, you cant go around ripping KEYWORDS out of packages just because they failed to build on *your* box

in this case, 1.6.4 builds just fine on my ppc, and the reporter even noted that this doesnt seem to be ppc-specific (failed on x86 same exact way)

because you decided to go removing ppc from KEYWORDS you left other packages in the tree broken:
games-action/trackballs/trackballs-1.0.0.ebuild: ~ppc ['>=dev-util/guile-1.6*']

ive gone ahead and added ppc back to the ebuilds like they were since this is *not* a ppc bug
Comment 7 Roman Dilken 2004-12-14 03:21:26 UTC
The texi-error occurs on upgrading fom 1.6.4-r1 to 1.6.6, too. The only problem is that I can't patch the configure-script as below because the guile-macos-posix.patch failes on applying it to an old /var/tmp/portage/guile... tree more than once which prevents me from patching manually the configure-skript...
Comment 8 Kevin 2005-03-23 12:44:46 UTC
Bug 86415:
http://bugs.gentoo.org/show_bug.cgi?id=86415
may be a duplicate of this bug.

SpanKY, how did you build it on your ppc?
Comment 9 Seemant Kulleen (RETIRED) gentoo-dev 2005-04-06 13:21:05 UTC
*** Bug 85670 has been marked as a duplicate of this bug. ***
Comment 10 Alastair Tse (RETIRED) gentoo-dev 2005-06-25 10:21:06 UTC
there's been a replace-flag in guile for a while for -O3, so i can only think that is the only solution so far 
unless the ppc guys come up with something better. 

closing for now.