Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 21215 - gcc-3.3: emerge grub fails
Summary: gcc-3.3: emerge grub fails
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] GCC Porting (show other bugs)
Hardware: x86 Linux
: High normal (vote)
Assignee: John Mylchreest (RETIRED)
URL:
Whiteboard:
Keywords:
: 22447 (view as bug list)
Depends on:
Blocks:
 
Reported: 2003-05-18 16:45 UTC by FL
Modified: 2003-09-14 12:03 UTC (History)
7 users (show)

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


Attachments
diff file to allow configure.in configure correctly for gcc 3.3 (configure.diff,1.04 KB, text/x-diff)
2003-06-12 18:36 UTC, Mario Vazquez
Details
diff file to allow configure.in configure correctly for gcc 3.3 (configure.diff,1.04 KB, text/plain)
2003-06-12 18:37 UTC, Mario Vazquez
Details
diff to fix fsys_jfs compile errors (fsys_jfs.diff,344 bytes, text/plain)
2003-06-12 18:39 UTC, Mario Vazquez
Details
fix fsys_reiserfs.diff (fsys_reiserfs.diff,409 bytes, text/plain)
2003-06-12 18:40 UTC, Mario Vazquez
Details
an ebuild to use the CVS snapshot, not completely working... (grub-0.93.20030708.ebuild,1.68 KB, text/plain)
2003-07-28 20:46 UTC, Boyd Waters
Details

Note You need to log in before you can comment on or make changes to this bug.
Description FL 2003-05-18 16:45:38 UTC
fsys_reiserfs.c: In function `next_key':
fsys_reiserfs.c:761: Warnung: operation on `depth' may be undefined
make[2]: *** [pre_stage2_exec-fsys_reiserfs.o] Fehler 1
make[2]: *** Warte auf noch nicht beendete Prozesse...
make[2]: Leaving directory
`/var/tmp/portage/grub-0.93.20030118/work/grub-0.93/stage2'
make[1]: *** [all-recursive] Fehler 1
make[1]: Leaving directory `/var/tmp/portage/grub-0.93.20030118/work/grub-0.93'
make: *** [all] Fehler 2

!!! ERROR: sys-apps/grub-0.93.20030118 failed.
!!! Function src_compile, Line 44, Exitcode 2
!!! (no error message)


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

Actual Results:  
s.o.

Expected Results:  
s.o.

  Portage 2.0.48_pre6 (default-x86-1.4, gcc-3.3, glibc-2.3.2-r1)
=================================================================
System uname: 2.4.20-wolk4.0s i686 AMD Athlon(tm) Processor
GENTOO_MIRRORS="http://gentoo.oregonstate.edu/
http://www.ibiblio.org/pub/Linux/distributions/gentoo"
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"
PORTDIR="/usr/portage"
DISTDIR="/usr/portage/distfiles"
PKGDIR="/usr/portage/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR_OVERLAY="/usr/local/portage"
USE="x86 oss 3dnow avi crypt encode gif jpeg libg++ libwww mikmod mmx mpeg
ncurses nls pdflib png quicktime spell truetype xml2 xmms xv zlib directfb alsa
gdbm berkdb slang readline aalib svga tcltk java X sdl gpm tcpd pam ssl perl
python imlib oggvorbis gtk motif opengl mozilla dvd fbcon gtk2 gtkhtml jikes
tiff xfs xinerama xml xosd -apm -arts -cups -kde -qt -esd -gnome"
COMPILER="gcc3"
CHOST="i686-pc-linux-gnu"
CFLAGS="-march=athlon-tbird -O3 -pipe -fforce-addr -fomit-frame-pointer
-funroll-loops -falign-functions=4 -maccumulate-outgoing-args"
CXXFLAGS="-march=athlon-tbird -O3 -pipe -fforce-addr -fomit-frame-pointer
-funroll-loops -falign-functions=4 -maccumulate-outgoing-args"
ACCEPT_KEYWORDS="x86 ~x86"
MAKEOPTS="-j2"
AUTOCLEAN="yes"
SYNC="rsync://rsync.de.gentoo.org/gentoo-portage"
FEATURES="ccache sandbox distcc userpriv usersandbox"
Comment 1 Martin Schlemmer (RETIRED) gentoo-dev 2003-05-18 20:03:34 UTC
Need some help here.

If I fix the invalid declaration:

-------------------------------------------------------------------
--- grub-0.93/stage2/fsys_reiserfs.c.orig	2003-05-19 01:44:07.000000000 +0200
+++ grub-0.93/stage2/fsys_reiserfs.c	2003-05-19 01:44:15.000000000 +0200
@@ -112,7 +112,7 @@
   /* offset in the log of where to start replay after a crash */
   __u32 j_first_unflushed_offset;
   /* mount id to detect very old transactions */
-  __u32 long j_mount_id;
+  __u64 j_mount_id;
 };
 
 /* magic string to find desc blocks in the journal */
-------------------------------------------------------------------

It ends up with this link problem:

-------------------------------------------------------------------
gcc  -g   -o pre_stage2.exec -nostdlib -nostdinc -Wl,-N -Wl,-Ttext -Wl,8200 pre_stage2_exec-asm.o pre_stage2_exec-bios.o pre_stage2_exec-boot.o pre_stage2_exec-builtins.o pre_stage2_exec-char_io.o pre_stage2_exec-cmdline.o pre_stage2_exec-common.o pre_stage2_exec-console.o pre_stage2_exec-disk_io.o pre_stage2_exec-fsys_ext2fs.o pre_stage2_exec-fsys_fat.o pre_stage2_exec-fsys_ffs.o pre_stage2_exec-fsys_jfs.o pre_stage2_exec-fsys_minix.o pre_stage2_exec-fsys_reiserfs.o pre_stage2_exec-fsys_vstafs.o pre_stage2_exec-fsys_xfs.o pre_stage2_exec-gunzip.o pre_stage2_exec-hercules.o pre_stage2_exec-md5.o pre_stage2_exec-serial.o pre_stage2_exec-smp-imps.o pre_stage2_exec-stage2.o pre_stage2_exec-terminfo.o pre_stage2_exec-tparm.o pre_stage2_exec-graphics.o  
pre_stage2_exec-builtins.o(.text+0x3776): In function `terminfo_func':
/space/var/tmp/portage/grub-0.93.20030118/work/grub-0.93/stage2/builtins.c:4347: undefined reference to `memcpy'
pre_stage2_exec-terminfo.o(.text+0x206): In function `ti_set_term':
/space/var/tmp/portage/grub-0.93.20030118/work/grub-0.93/stage2/terminfo.c:250: undefined reference to `memcpy'
pre_stage2_exec-terminfo.o(.text+0x21f): In function `ti_get_term':
/space/var/tmp/portage/grub-0.93.20030118/work/grub-0.93/stage2/terminfo.c:257: undefined reference to `memcpy'
collect2: ld returned 1 exit status
-------------------------------------------------------------------

In stage2/shared.h 'memcpy' is defined as:

  #define memcpy grub_memcpy

which is in char_io.c, and is in above link.
Comment 2 Mark Rickard 2003-05-19 03:21:00 UTC
I don't think you fixed the declaration correctly.  The top of fsys_reiserfs.c has the 
following definitions: 
 
typedef unsigned int __u32; 
typedef unsigned long long __u64; 
 
Therefore, "__u32 long" should be "unsigned int long", not "__u64" or "unsigned 
long long".  Using that definition, I created the following patch that allows grub to 
build without any problems.  It is the one I used when I recompiled my entire 
system with gcc 3.3. 
 
------------------------------------------------------------------- 
--- grub-0.92/stage2/fsys_reiserfs.c-original   2003-03-10 01:09:25.000000000 
-0500 
+++ grub-0.92/stage2/fsys_reiserfs.c    2003-03-10 01:09:47.000000000 -0500 
@@ -112,7 +112,7 @@ 
   /* offset in the log of where to start replay after a crash */ 
   __u32 j_first_unflushed_offset; 
   /* mount id to detect very old transactions */ 
-  __u32 long j_mount_id; 
+  unsigned long int j_mount_id; 
 }; 
 
 /* magic string to find desc blocks in the journal */ 
------------------------------------------------------------------- 
Comment 3 Martin Schlemmer (RETIRED) gentoo-dev 2003-05-19 11:03:31 UTC
Then __u64 is defined wrong in the first place.  What version binutils ?
Comment 4 Mark Rickard 2003-05-19 12:33:19 UTC
sys-devel/binutils-2.13.90.0.18 
 
Portage 2.0.47-r10 (default-x86-1.4, gcc-3.3, glibc-2.3.1-r4) 
================================================================= 
System uname: 2.4.20-ck6-gcc33 i686 AMD Athlon(TM) XP1800+ 
GENTOO_MIRRORS="http://gentoo.oregonstate.edu/ 
http://distro.ibiblio.org/pub/Linux/distributions/gentoo" 
CONFIG_PROTECT="/etc /var/qmail/control /usr/kde/2/share/config 
/usr/kde/3/share/config /usr/X11R6/lib/X11/xkb /usr/kde/3.1/share/config 
/usr/share/config" 
CONFIG_PROTECT_MASK="/etc/gconf /etc/env.d" 
PORTDIR="/usr/portage" 
DISTDIR="/usr/portage/distfiles" 
PKGDIR="/root/packages" 
PORTAGE_TMPDIR="/var/tmp" 
PORTDIR_OVERLAY="/usr/local/portage" 
USE="x86 oss 3dnow apm avi crypt cups encode gif jpeg libg++ mmx mpeg 
ncurses nls pdflib png quicktime spell truetype xml2 xmms xv zlib alsa gdbm 
berkdb slang readline arts tetex svga java mysql X sdl tcpd pam libwww ssl perl 
python esd imlib oggvorbis qt kde motif opengl mozilla acpi sse tiff -gpm 
-mikmod -gtkhtml -bonobo -guile -gnome -gtk" 
COMPILER="gcc3" 
CHOST="i686-pc-linux-gnu" 
CFLAGS="-march=athlon-xp -O3 -pipe -fomit-frame-pointer" 
CXXFLAGS="-march=athlon-xp -O3 -pipe -fomit-frame-pointer" 
ACCEPT_KEYWORDS="x86" 
MAKEOPTS="-j2" 
AUTOCLEAN="yes" 
SYNC="rsync://rsync.us.gentoo.org/gentoo-portage" 
FEATURES="sandbox buildpkg ccache distcc userpriv usersandbox" 
 
Excuse my ignorance, but what does binutils have to do with the definition of 
__u64?  I was looking at the code in grub-0.92/stage2/fsys_reiserfs.c for the 
declaration of __u64.  Based on the comments in the code, it matches the 
definition in linux/include/asm-i386/types.h. 
 
From linux/include/asm-i386/types.h: 
typedef __signed__ char __s8; 
typedef unsigned char __u8; 
 
typedef __signed__ short __s16; 
typedef unsigned short __u16; 
 
typedef __signed__ int __s32; 
typedef unsigned int __u32; 
 
#if defined(__GNUC__) && !defined(__STRICT_ANSI__) 
typedef __signed__ long long __s64; 
typedef unsigned long long __u64; 
#endif 
 
Consequently, I interpreted the "__u32 long" as "unsigned int long" by replacing 
__u32 with its definition.  Nothing more complex than that. 
 
Comment 5 Martin Schlemmer (RETIRED) gentoo-dev 2003-05-19 15:28:20 UTC
Because even with your 'fix' it still have the link problems.
Comment 6 Mark Rickard 2003-05-19 17:08:59 UTC
Call me an idiot, but I didn't notice that you were using grub-0.93.20030118.  It 
works without any problems on grub-0.92-r1.  I will try it on the newer version. 
Comment 7 Martin Schlemmer (RETIRED) gentoo-dev 2003-05-20 14:52:00 UTC
The linking issues (after fixing the j_mount_id declaration), is caused by
the hammer patch.  Nicholas is looking into it.
Comment 8 Hanno Böck gentoo-dev 2003-06-07 14:24:59 UTC
Hi, it seems we are having two bugs here
1. trivial to fix bug in fsys_reiserfs.c
2. linking bug with the "undefined reference to memcpy"-error message.

To the second one, there was a thread on the grub-ml, but I don't understand what they did and what was wrong:
http://mail.gnu.org/archive/html/bug-grub/2003-01/msg00039.html

I'll try out most current GRUB cvs to see if that works.
Comment 9 Robert Moss (RETIRED) gentoo-dev 2003-06-07 21:48:33 UTC
Hidden in the depths of the Other Things Gentoo -> GCC 3.3 thread, there's a CFLAGS-based 'fix' (although a very dirty one) for this:

http://forums.gentoo.org/viewtopic.php?p=357180#357180

It appears that the fsys_reiserfs.c problem may be fixed using the CVS checkout, although I've not tried that. The memcpy thing appears to be part of a greater problem related to the hammer patch which is somewhat beyond me...
Comment 10 Mario Vazquez 2003-06-12 18:36:57 UTC
Created attachment 13181 [details]
diff file to allow configure.in configure correctly for gcc 3.3
Comment 11 Mario Vazquez 2003-06-12 18:37:31 UTC
Created attachment 13182 [details]
diff file to allow configure.in configure correctly for gcc 3.3
Comment 12 Mario Vazquez 2003-06-12 18:39:30 UTC
Created attachment 13183 [details]
diff to fix fsys_jfs compile errors
Comment 13 Mario Vazquez 2003-06-12 18:40:40 UTC
Created attachment 13184 [details]
fix fsys_reiserfs.diff
Comment 14 Mario Vazquez 2003-06-12 18:42:39 UTC
the three diff files uploaded fix problems compiling grub 0.93 with gcc 3.3.  
Modified from previous grub 0.92 patches 
Comment 15 Seemant Kulleen (RETIRED) gentoo-dev 2003-06-18 04:36:08 UTC
*** Bug 22447 has been marked as a duplicate of this bug. ***
Comment 16 Nicholas Wourms 2003-06-29 16:20:43 UTC
Ok folks, here's the solution for the undefined memcpy references:

pass "-minline-all-stringopts" to CFLAGS after unsetting them.  I'll upload an updated grub with some patches and this cflag to fix it.
Comment 17 Boyd Waters 2003-07-28 20:43:26 UTC
I have just built a GRUB CVS snapshot from 2003-July-08 that compiles with GCC 3.3-r1 
now in portage -- no messing around with CFLAGS seemed necessary. 
 
I have an ebuild, but it's a hack of the current grub ebuild. I would like help to make it 
better. Also, the grub that's currently in CVS seems broken to me, which is why I'm 
using a snapshot. 
 
--watersb 
(I am the person who posted to to the Gentoo Forums regarding the -minline-stringops 
kludge...)  
 
 
Comment 18 Boyd Waters 2003-07-28 20:46:50 UTC
Created attachment 15167 [details]
an ebuild to use the CVS snapshot, not completely working...

This ebuild is a tiny modification of the current grub ebuild. It compiles and
installs, I think; grub complains about an error at the install stage. It could
use some help!

But it does compile on GCC 3.3, and against the kernel 2.6 headers.
Comment 20 John Mylchreest (RETIRED) gentoo-dev 2003-08-19 01:39:39 UTC
ebuild with patches, tested and aplly/compile cleanly can be found at:
http://dev.gentoo.org/~johnm

Azarah, if you want me to take this bug just gimme a shout.
Comment 21 Travis Tilley (RETIRED) gentoo-dev 2003-09-01 16:44:32 UTC
GRUB still wont compile with >=sys-devel/gcc-3.3, and still is easily fixed by a patch I submitted "2003-06-08 10:15 EST" in a bug marked as a duplicate of this one. The patches listed in this bug, as far as I can tell, contain the important parts of that patch (but not a few changes that arent really as important).

so... 85 days later we've still only recently started (47 days ago) using a compiler that was released 129 days ago (gcc 3.2.3), and this bug hasnt been given all that much attention even though there is a fix readily available.

My opinion might not matter much, but everything I use works with gcc 3.3.1 or patches are available. I dont know about much else other than what I use and what I've seen bugs for on bugs.gentoo.org so I could very easily be mistaken... but I think some work should be done towards transitioning to gcc 3.3.1 (especially with it's code speed improvements, at least compared to 3.3 or 3.2.3 for me... and taking into account I use the new gcc 3.3+ -ftracer flag). I think that packages that dont compile using gcc 3.3.1 now can either be patched or accomidated for by giving gcc 3.3* it's own slot for convenience and compiling apps that need to using gcc 3.2.3.

I am completely unaware of whether or not all needed patches have been ported to gcc 3.3.1 but I've been using it for everything I can. -damn- have I noticed a difference (on my 1.8Ghz celeron system) in comparison to the latest GRP binaries for pentium4 which are indeed compiled with some pretty aggressive optimisations if the default CFLAGS setting is any indicator, and all I use for CFLAGS is "-pipe -O3 -march=pentium4 -ftracer".

bah. and please forgive me for placing the above rant in a bug report... but what's the holdup on this patch set? Are there issues with this I'm completely unaware of here? Would it be possible to get this in the portage tree, even if only as an unstable ebuild with it's arch set to "-x86"?
Comment 22 Priit Laes (IRC: plaes) 2003-09-11 16:31:45 UTC
Travis is absolutely right. This bug has scared away at least one new gentoo user. (not me, but my friend). This patch works so ffs please change the portage.
Comment 23 John Mylchreest (RETIRED) gentoo-dev 2003-09-12 00:59:33 UTC
With all due respect can i please ask for you to be patient in relation to bugs, many of us are very busy.
Anywho, I have taken this bug on board and i will do it after work today.
in the meantime i have had this ebuild around for a while now:
http://dev.gentoo.org/~johnm/

yo might find it of use.
Comment 24 John Mylchreest (RETIRED) gentoo-dev 2003-09-14 10:57:25 UTC
Added to portage.
please emerge sync and try again in approx. 15 minutes.
Enjoy :)
Comment 25 John Mylchreest (RETIRED) gentoo-dev 2003-09-14 12:03:44 UTC
marking fixed