I recently installed Fedora Core 3 and tried to compile the grub package for L4 using gcc 3.4.2, I got some trivial compilation errors. Upon trying the compilation on different machine with gcc 3.1 I found some code following deprecated practices that escapes as warnings in < 3.4.2 but throws compilation errors with 3.4.2. Here are three such case I found in the grub package. If this is indeed the case it might be helpful to make the necessary changes to the repository code.

 

------------------------------------------------------------------------------------------------------------------------------------------

 

1) stage2/builtins.c

for gcc version 3.4.2 20041017 (Red Hat 3.4.2-6.fc3):

 

builtins.c:886: error: missing terminating " character

builtins.c:887: error: `Version' undeclared (first use in this function)

builtins.c:887: error: (Each undeclared identifier is reported only once

builtins.c:887: error: for each function it appears in.)

builtins.c:887: error: syntax error before ':' token

builtins.c:887:20: invalid suffix "x" on integer constant

 

for gcc version 3.1:

 

builtins.c:886:20: warning: multi-line string literals are deprecated

 

 

2)stage2/fsys_reiserfs.c

for gcc version 3.4.2 20041017 (Red Hat 3.4.2-6.fc3):

 

typedef unsigned int __u32;

__u32 long j_mount_id;

 

gives this error:

fsys_reiserfs.c:115: error: long, short, signed or unsigned used invalidly for

`j_mount_id'

 

gcc version 3.1:allows it

 

3)stage2/smp-imps.c

For switch-case construct: switch(i){

                                                Case 1: break;

                                                …

                                                Default:

                                    }

 

3.1 gives:

            warning: deprecated use of label at end of compound statement

 

3.4.2 will not allow this:

smp-imps.c:437: error: label at end of compound statement

 

------------------------------------------------------------------------------------------------------------------------------------------

After changing the files and getting over the compilation errors I get some linking errors.

 

Here is the trace:

 

gcc -DHAVE_CONFIG_H -I. -I. -I.. -I../stage1  -Wall -Wmissing-prototypes

-Wunused -Wshadow -Wpointer-arith -malign-jumps=1 -malign-loops=1

-malign-functions=1 -Wundef -Os -fno-builtin -nostdinc  -DSUPPORT_SERIAL=1

-DSUPPORT_HERCULES=1 -DFSYS_EXT2FS=1 -DFSYS_FAT=1 -DFSYS_FFS=1 -DFSYS_MINIX=1

-DFSYS_REISERFS=1 -DFSYS_VSTAFS=1 -DUSE_MD5_PASSWORDS=1 -g -c -o

pre_stage2_exec-md5.o `test -f md5.c || echo './'`md5.c

md5.c:1: warning: -malign-loops is obsolete, use -falign-loops

md5.c:1: warning: -malign-jumps is obsolete, use -falign-jumps

md5.c:1: warning: -malign-functions is obsolete, use -falign-functions

gcc  -g   -o pre_stage2.exec -nostdlib -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-common.o pre_stage2_exec-char_io.o

pre_stage2_exec-cmdline.o pre_stage2_exec-disk_io.o pre_stage2_exec-gunzip.o

pre_stage2_exec-fsys_ext2fs.o pre_stage2_exec-fsys_fat.o

pre_stage2_exec-fsys_ffs.o pre_stage2_exec-fsys_minix.o

pre_stage2_exec-fsys_reiserfs.o pre_stage2_exec-fsys_vstafs.o

pre_stage2_exec-hercules.o pre_stage2_exec-serial.o pre_stage2_exec-smp-imps.o

pre_stage2_exec-stage2.o pre_stage2_exec-md5.o

pre_stage2_exec-builtins.o(.text+0x138b): In function `install_func':

/home/jayesh/grub/stage2/builtins.c:1801: undefined reference to `memcpy'

pre_stage2_exec-builtins.o(.text+0x144b):/home/jayesh/grub/stage2/builtins.c:1846:

undefined reference to `memcpy'

pre_stage2_exec-builtins.o(.text+0x2b17): In function `setup_func':

/home/jayesh/grub/stage2/builtins.c:3672: undefined reference to `memcpy'

collect2: ld returned 1 exit status

make[2]: *** [pre_stage2.exec] Error 1

make[2]: Leaving directory `/home/jayesh/grub/stage2'

make[1]: *** [all-recursive] Error 1

make[1]: Leaving directory `/home/jayesh/grub'

make: *** [all] Error 2

 

 

 

My versions of gcc and ld are as follows:

 

 [jayesh@orion grub]$ ld -v

GNU ld version 2.15.92.0.2 20040927

 

[jayesh@orion grub]$ gcc -v

Reading specs from /usr/lib/gcc/i386-redhat-linux/3.4.2/specs

Configured with: ../configure --prefix=/usr --mandir=/usr/share/man

--infodir=/usr/share/info --enable-shared --enable-threads=posix

--disable-checking --with-system-zlib --enable-__cxa_atexit

--disable-libunwind-exceptions --enable-java-awt=gtk --host=i386-redhat-linux

Thread model: posix

gcc version 3.4.2 20041017 (Red Hat 3.4.2-6.fc3)

 

 

I am not sure what is wrong with the linking of memcpy function. Please advise.

 

Thanks.

 

Jayesh