grub-0.97 compile issues

Stan Sander ssande at sandia.gov
Tue Nov 1 12:22:24 PST 2005


First a brief summary of what I've done to this point.  The system board 
in my linux box at home died, which forced the issue for me to upgrade.  
I settled on an AMD64 dual core processor, 2GB RAM, with a Gigabyte 
K8N-Pr o SLI board.  Not that any of that makes any difference. Once 
assembled, I was able to boot my original OS which by now is a 
"frankenstein" of sorts that started it's life a few years back as a 
Suse 7.1 system, since I have downloaded and compiled so many things (I 
haven't used rpm's since the system was originally installed.)  Am I a 
candidate for LFS or what??!! Anyway, the system is as stable as ever 
and even booted the 2.6.13.4 kernel  I had just built in preparation for 
doing a standard LFS build when the old board died.  Only thing that 
doesn't work is X (video hardware changed) and the serial ports, neither 
of which I care about at this point.  I copied OS onto my second hard 
drive and configured the system to boot from it whilst I re-partitioned 
and built an LFS system on the other drive.  Almost all has been done 
according to the cross-lfs book from 2005-10-28.  I'm following the 
instructions from the web using lynx on one tty while I compile on 
another.  The only deviations have been when copying the linux kernel 
headers, I copied asm-x86_64 instead of asm-i386 as the book stated.  
This got me around a problem building glibc and was based on a 
suggestion I found in a search of the mailing list archives.  The second 
deviation is I built a minimal 2.6.13.4 kernel instead of the 2.6.12.? 
called out in the book.  Now on the issues at hand. 

Basically I have been unable to get the configure for grub-0.97 to run 
successfully.  I have hit two issues so far and want to make sure I'm 
not shooting myself in the foot.  Both of these have seemed rather easy 
to fix, but I'd appreciate your opinions to make sure I'm not setting 
myself up for more trouble ahead.   Here is the first  problem:

 /lfs/sources/grub-0.97 >./configure --prefix=/lfs/usr 
--host=x86_64-pc-linux-gnu
configure: WARNING: If you wanted to set the --build type, don't use --host.
    If a cross compiler is detected then cross compile mode will be used.
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking for x86_64-pc-linux-gnu-strip... x86_64-pc-linux-gnu-strip
checking build system type... i686-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking whether to enable maintainer-specific portions of Makefiles... no
checking for x86_64-pc-linux-gnu-gcc... x86_64-pc-linux-gnu-gcc
checking for x86_64-pc-linux-gnu-gcc... (cached) x86_64-pc-linux-gnu-gcc
checking for C compiler default output file name... configure: error: C 
compiler cannot create executables
See `config.log' for more details.

The relevant part of config.log shows:

configure:2421: checking for C compiler default output file name
configure:2424: x86_64-pc-linux-gnu-gcc -m32    conftest.c  >&5
/lfs/cross-tools/bin/../lib/gcc/x86_64-pc-linux-gnu/4.0.2/../../../../x86_64-pc-linux-gnu/
bin/ld: skipping incompatible 
/lfs/cross-tools/bin/../lib/gcc/x86_64-pc-linux-gnu/4.0.2/./
libgcc.a when searching for -lgcc
/lfs/cross-tools/bin/../lib/gcc/x86_64-pc-linux-gnu/4.0.2/../../../../x86_64-pc-linux-gnu/
bin/ld: skipping incompatible 
/lfs/cross-tools/bin/../lib/gcc/x86_64-pc-linux-gnu/4.0.2/li
bgcc.a when searching for -lgcc
/lfs/cross-tools/bin/../lib/gcc/x86_64-pc-linux-gnu/4.0.2/../../../../x86_64-pc-linux-gnu/
bin/ld: skipping incompatible 
/cross-tools/lib/gcc/x86_64-pc-linux-gnu/4.0.2/./libgcc.a wh
en searching for -lgcc
/lfs/cross-tools/bin/../lib/gcc/x86_64-pc-linux-gnu/4.0.2/../../../../x86_64-pc-linux-gnu/
bin/ld: skipping incompatible 
/cross-tools/lib/gcc/x86_64-pc-linux-gnu/4.0.2/libgcc.a when
 searching for -lgcc
/lfs/cross-tools/bin/../lib/gcc/x86_64-pc-linux-gnu/4.0.2/../../../../x86_64-pc-linux-gnu/
bin/ld: cannot find -lgcc
collect2: ld returned 1 exit status
configure:2427: $? = 1
configure: failed program was:
| /* confdefs.h.  */
|
| #define PACKAGE_NAME "GRUB"
| #define PACKAGE_TARNAME "grub"
| #define PACKAGE_VERSION "0.97"
| #define PACKAGE_STRING "GRUB 0.97"
| #define PACKAGE_BUGREPORT "bug-grub at gnu.org"
| #define PACKAGE "grub"
| #define VERSION "0.97"
| /* end confdefs.h.  */
|
| int
| main ()
| {
|
|   ;
|   return 0;
| }
configure:2466: error: C compiler cannot create executables
See `config.log' for more details.

## ---------------- ##
## Cache variables. ##
## ---------------- ##

ac_cv_build=i686-pc-linux-gnu
ac_cv_build_alias=i686-pc-linux-gnu
ac_cv_env_CC_set=set
ac_cv_env_CC_value=x86_64-pc-linux-gnu-gcc
ac_cv_env_CFLAGS_set=
ac_cv_env_CFLAGS_value=
ac_cv_env_CPPFLAGS_set=
ac_cv_env_CPPFLAGS_value=
ac_cv_env_CPP_set=
ac_cv_env_CPP_value=
ac_cv_env_LDFLAGS_set=
ac_cv_env_LDFLAGS_value=
ac_cv_env_build_alias_set=
ac_cv_env_build_alias_value=
ac_cv_env_host_alias_set=set
ac_cv_env_host_alias_value=x86_64-pc-linux-gnu
ac_cv_env_target_alias_set=
ac_cv_env_target_alias_value=
ac_cv_host=x86_64-pc-linux-gnu
ac_cv_host_alias=x86_64-pc-linux-gnu
ac_cv_path_install='/usr/bin/install -c'
ac_cv_prog_AWK=gawk
ac_cv_prog_CC=x86_64-pc-linux-gnu-gcc
ac_cv_prog_STRIP=x86_64-pc-linux-gnu-strip
ac_cv_prog_make_make_set=yes

## ----------------- ##
## Output variables. ##
## ----------------- ##

ACLOCAL='${SHELL} /lfs/sources/grub-0.97/missing --run aclocal-1.9'
AMDEPBACKSLASH=''
AMDEP_FALSE=''
AMDEP_TRUE=''
AMTAR='${SHELL} /lfs/sources/grub-0.97/missing --run tar'
AUTOCONF='${SHELL} /lfs/sources/grub-0.97/missing --run autoconf'
AUTOHEADER='${SHELL} /lfs/sources/grub-0.97/missing --run autoheader'
AUTOMAKE='${SHELL} /lfs/sources/grub-0.97/missing --run automake-1.9'
AWK='gawk'
BUILD_EXAMPLE_KERNEL_FALSE=''
BUILD_EXAMPLE_KERNEL_TRUE=''
CC='x86_64-pc-linux-gnu-gcc'
CCAS=''
CCASFLAGS=''
CCDEPMODE=''
CFLAGS='-m32 '
CPP=''
CPPFLAGS=''
CYGPATH_W='echo'
DEFS=''
DEPDIR=''

OK, so CFLAGS somehow got set to -m32.   I think I found the place in 
configure where this was happening and corrected it.  Below is a patch 
for what I did:

diff -u configure.orig configure
--- configure.orig      Tue Nov  1 06:05:57 2005
+++ configure   Tue Nov  1 12:13:55 2005
@@ -1977,7 +1977,7 @@
 fi

 if test "x$host_cpu" = xx86_64; then
-  CFLAGS="-m32 $CFLAGS"
+  CFLAGS="-m64 $CFLAGS"
 fi

 #


This changes the CFLAGS setting to -m64.   Is that the right way to 
address this?

Problem #2:


The relevant portion of config.log:

configure:3870: checking whether x86_64-pc-linux-gnu-objcopy works for 
absolute addresses
configure:3883: x86_64-pc-linux-gnu-gcc -c -m64 -g  -Wall 
-Wmissing-prototypes -Wunused -W
shadow -Wpointer-arith -falign-jumps=1 -falign-loops=1 
-falign-functions=1 -Wundef conftes
t.c >&5
conftest.c:3: warning: no previous prototype for 'cmain'
configure:3886: $? = 0
configure:3896: x86_64-pc-linux-gnu-gcc -m64 -g -nostdlib -Wl,-N 
-Wl,-Ttext -Wl,2000 conft
est.o -o conftest.exec
/lfs/cross-tools/bin/../lib/gcc/x86_64-pc-linux-gnu/4.0.2/../../../../x86_64-pc-linux-gnu/
bin/ld: warning: cannot find entry symbol _start; defaulting to 
0000000000002000
configure:3899: $? = 0
configure:3907: x86_64-pc-linux-gnu-objcopy -O binary conftest.exec conftest
configure:3910: $? = 0
configure:3896: x86_64-pc-linux-gnu-gcc -m64 -g -nostdlib -Wl,-N 
-Wl,-Ttext -Wl,8000 conft
est.o -o conftest.exec
/lfs/cross-tools/bin/../lib/gcc/x86_64-pc-linux-gnu/4.0.2/../../../../x86_64-pc-linux-gnu/
bin/ld: warning: cannot find entry symbol _start; defaulting to 
0000000000008000
configure:3899: $? = 0
configure:3907: x86_64-pc-linux-gnu-objcopy -O binary conftest.exec conftest
configure:3910: $? = 0
configure:3918: cmp -s conftest.old conftest
configure:3921: $? = 1
configure:3932: result: no
configure:3935: error: GRUB requires a working absolute objcopy; upgrade 
your binutils

## ---------------- ##
## Cache variables. ##
## ---------------- ##

ac_cv_build=i686-pc-linux-gnu
ac_cv_build_alias=i686-pc-linux-gnu
ac_cv_c_compiler_gnu=yes
ac_cv_env_CC_set=set
ac_cv_env_CC_value=x86_64-pc-linux-gnu-gcc
ac_cv_env_CFLAGS_set=
ac_cv_env_CFLAGS_value=
ac_cv_env_CPPFLAGS_set=
ac_cv_env_CPPFLAGS_value=
ac_cv_env_CPP_set=
ac_cv_env_CPP_value=
ac_cv_env_LDFLAGS_set=
ac_cv_env_LDFLAGS_value=
ac_cv_env_build_alias_set=
ac_cv_env_build_alias_value=
ac_cv_env_host_alias_set=set
ac_cv_env_host_alias_value=x86_64-pc-linux-gnu
ac_cv_env_target_alias_set=
ac_cv_env_target_alias_value=
ac_cv_exeext=
ac_cv_host=x86_64-pc-linux-gnu
ac_cv_host_alias=x86_64-pc-linux-gnu
ac_cv_objext=o
ac_cv_path_install='/usr/bin/install -c'
ac_cv_prog_AWK=gawk
ac_cv_prog_CC=x86_64-pc-linux-gnu-gcc
ac_cv_prog_OBJCOPY=x86_64-pc-linux-gnu-objcopy
ac_cv_prog_RANLIB=x86_64-pc-linux-gnu-ranlib
ac_cv_prog_STRIP=x86_64-pc-linux-gnu-strip
ac_cv_prog_cc_g=yes
ac_cv_prog_cc_stdc=
ac_cv_prog_make_make_set=yes
am_cv_CC_dependencies_compiler_type=gcc3
grub_cv_asm_uscore=no
grub_cv_prog_objcopy_absolute=no

Ok, so I think the answer here is to set 
grub_cv_prog_objcopy_absolute=yes in the config.cache file since we do 
not have a cmp program that can handle 64 bit executables while I'm 
still booted in the 32 bit environment.  Should I do this and then 
change the configure options to point to a config.cache file? 

I'm not a programmer and I don't know C, so I could be going about this 
all wrong.  All suggestions welcome. 


-- 
Stan Sander - CSU Special Projects  (505)284-4915
ASAP, LLC, Contractor assigned to Sandia National Laboratories
Unix Systems/Server Administrator 

Microsoft: You've got questions. We've got a dancing paperclip.





More information about the cross-lfs mailing list