Re: Build Error

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, May 10, 2010 at 4:12 PM, mike <mikereape@xxxxxxxxxx> wrote:
> On 05/10/2010 11:15 AM, Sandeep Soni wrote:
>>
>> On Mon, May 10, 2010 at 3:33 PM, Sandeep Soni<soni.sandeepb@xxxxxxxxx>
>>  wrote:
>>
>>>
>>> Hi,
>>>
>>> I tried to build GCC again from the svn repository but make gave me an
>>> error in the end that said,
>>>
>>> ../../trunk/gcc/lto/lto-elf.c: In function 'validate_file' :
>>> ../../trunk/gcc/lto/lto-elf.c:539:3:error: implicit declaration of
>>> function 'elf_getshdrstrndx' [-Werror=implicit-function-declaration]
>>>
>>> cc1:all warnings being treated as errors
>>> make[3]:*** [lto/lto-elf.o] Error 1
>>> Leaving directory '/home/sandy/Development/build/gcc'
>>>
>>> make[3]:*** [all-stage2-gcc] Error 2
>>> Leaving directory '/home/sandy/Development/build'
>>>
>>> make[1]:*** [stage2-bubble] Error 2
>>> Leaving directory '/home/sandy/Development/build'
>>>
>>> make:*** [all] Error 2
>>>
>>> Hi, I'm having similar problems.
>>>
>
> Hi, I'm having similar problems.
>
> I get a similar result.  The output I get is:
>
>> lto/lto-elf.o: In function `lto_elf_file_open':
>> lto-elf.c:(.text+0xcb5): undefined reference to `elf_getshdrstrndx'
>> collect2: ld returned 1 exit status
>> make[3]: *** [lto1] Error 1
>> make[3]: Leaving directory `/home/mike/gcc-obj-dir/gcc'
>> make[2]: *** [all-stage2-gcc] Error 2
>> make[2]: Leaving directory `/home/mike/gcc-obj-dir'
>> make[1]: *** [stage2-bubble] Error 2
>> make[1]: Leaving directory `/home/mike/gcc-obj-dir'
>> make: *** [all] Error 2
>
> Just to get the question of config.log out of the way here are the only two
> errors I get.  Note that the result of the first is "buggy but acceptable"
> and that the second has to do with 'ac_nonexistent.h'.  I still have no idea
> what that is supposed to be.
>
> First:
>>
>> configure:5841: checking for version 0.10 of PPL
>> configure:5858: gcc -c -g -O2  -I$$r/$(HOST_SUBDIR)/gmp -I$$s/gmp
>> -I$$s/mpc/src   conftest.c >&5
>> configure:5858: $? = 0
>> configure:5859: result: yes
>> configure:5936: checking for version 0.15.5 (or later revision) of CLooG
>> configure:5953: gcc -c -g -O2  -DCLOOG_PPL_BACKEND
>>  -I$$r/$(HOST_SUBDIR)/gmp -I$$s/gmp -I$$s/mpc/src    conftest.c >&5
>> configure:5953: $? = 0
>> configure:5969: gcc -c -g -O2  -DCLOOG_PPL_BACKEND
>>  -I$$r/$(HOST_SUBDIR)/gmp -I$$s/gmp -I$$s/mpc/src    conftest.c >&5
>> conftest.c: In function 'main':
>> conftest.c:16: error: 'choke' undeclared (first use in this function)
>> conftest.c:16: error: (Each undeclared identifier is reported only once
>> conftest.c:16: error: for each function it appears in.)
>> conftest.c:16: error: expected ';' before 'me'
>> configure:5969: $? = 1
>> configure: failed program was:
>> | /* confdefs.h */
>> | #define PACKAGE_NAME ""
>> | #define PACKAGE_TARNAME ""
>> | #define PACKAGE_VERSION ""
>> | #define PACKAGE_STRING ""
>> | #define PACKAGE_BUGREPORT ""
>> | #define PACKAGE_URL ""
>> | #define LT_OBJDIR ".libs/"
>> | /* end confdefs.h.  */
>> | #include "cloog/cloog.h"
>> | int
>> | main ()
>> | {
>> |
>> |   #if CLOOG_VERSION_MAJOR != 0 || CLOOG_VERSION_MINOR != 15 ||
>> CLOOG_VERSION_REVISION < 9
>> |   choke me
>> |   #endif
>> |
>> |   ;
>> |   return 0;
>> | }
>> configure:5973: result: buggy but acceptable
>
> Second:
>>
>> configure:6092: checking how to run the C preprocessor
>> configure:6123: gcc -E  -I/usr/include/libelf conftest.c
>> configure:6123: $? = 0
>> configure:6137: gcc -E  -I/usr/include/libelf conftest.c
>> conftest.c:10:28: error: ac_nonexistent.h: No such file or directory
>> configure:6137: $? = 1
>> configure: failed program was:
>> | /* confdefs.h */
>> | #define PACKAGE_NAME ""
>> | #define PACKAGE_TARNAME ""
>> | #define PACKAGE_VERSION ""
>> | #define PACKAGE_STRING ""
>> | #define PACKAGE_BUGREPORT ""
>> | #define PACKAGE_URL ""
>> | #define LT_OBJDIR ".libs/"
>> | /* end confdefs.h.  */
>> | #include <ac_nonexistent.h>
>> configure:6162: result: gcc -E
>> configure:6182: gcc -E  -I/usr/include/libelf conftest.c
>> configure:6182: $? = 0
>> configure:6196: gcc -E  -I/usr/include/libelf conftest.c
>> conftest.c:10:28: error: ac_nonexistent.h: No such file or directory
>> configure:6196: $? = 1
>> configure: failed program was:
>> | /* confdefs.h */
>> | #define PACKAGE_NAME ""
>> | #define PACKAGE_TARNAME ""
>> | #define PACKAGE_VERSION ""
>> | #define PACKAGE_STRING ""
>> | #define PACKAGE_BUGREPORT ""
>> | #define PACKAGE_URL ""
>> | #define LT_OBJDIR ".libs/"
>> | /* end confdefs.h.  */
>> | #include <ac_nonexistent.h>
>
> Going back to the error at the end of the build the error is 'undefined
> reference to `undefined reference to `elf_getshdrstrndx''.  However if I
> grep for 'elf_getshdrstrndx' in /usr/include I get:
>>
>> [mike@desktop gcc-obj-dir]$ grep -r 'elf_getshdrstrndx' /usr/include/
>> /usr/include/libelf.h:extern int elf_getshdrstrndx (Elf *__elf, size_t
>> *__dst);
>> /usr/include/libelf/libelfP.h:extern int __elf_getshdrstrndx_internal (Elf
>> *__elf, size_t *__dst)
>> /usr/include/libelf/libelf.h:extern int elf_getshdrstrndx (Elf *__elf,
>> size_t *__dst);
>> /usr/include/libelf/elf32_checksum.c:  if  (INTUSE(elf_getshdrstrndx)
>> (elf, &shstrndx) < 0)
>> /usr/include/libelf/elf_getshdrstrndx.c:elf_getshdrstrndx (elf, dst)
>> /usr/include/libelf/elf_getshdrstrndx.c:INTDEF(elf_getshdrstrndx)
>> /usr/include/libelf/elf_getshdrstrndx.c:strong_alias (elf_getshdrstrndx,
>> elf_getshstrndx)
>> [mike@desktop gcc-obj-dir]$
>
> so clearly the source is there and declared in libelf.h.
>
> Furthermore, to repeat the first two lines of the message at the end of the
> build are:
>
>> lto/lto-elf.o: In function `lto_elf_file_open':
>> lto-elf.c:(.text+0xcb5): undefined reference to `elf_getshdrstrndx'
>
> but in fact `elf_getshdrstrndx' is invoked in 'validate_file' and not
> 'lto_elf_file_open'.  Here are the two relevant definitions:
>
>> validate_file (lto_elf_file *elf_file)
>> {
>>  const char *elf_ident;
>>
>>  /* Some aspects of the libelf API are dependent on whether the
>>     object file is a 32-bit or 64-bit file.  Determine which kind of
>>     file this is now.  */
>>  elf_ident = elf_getident (elf_file->elf, NULL);
>>  if (!elf_ident)
>>    {
>>      error ("could not read ELF identification information: %s",
>>          elf_errmsg (0));
>>      return false;
>>
>>    }
>>
>>  if (!cached_file_attrs.initialized)
>>    {
>>      switch (elf_ident[EI_CLASS])
>>    {
>>    case ELFCLASS32:
>>      cached_file_attrs.bits = 32;
>>      break;
>>
>>    case ELFCLASS64:
>>      cached_file_attrs.bits = 64;
>>      break;
>>
>>    default:
>>      error ("unsupported ELF file class");
>>      return false;
>>    }
>>
>>      memcpy (cached_file_attrs.elf_ident, elf_ident,
>>          sizeof cached_file_attrs.elf_ident);
>>    }
>>
>>  if (memcmp (elf_ident, cached_file_attrs.elf_ident,
>>          sizeof cached_file_attrs.elf_ident))
>>    return false;
>>
>>  /* Check that the input file is a relocatable object file with the
>> correct
>>     architecture.  */
>>  switch (cached_file_attrs.bits)
>>    {
>>    case 32:
>>      if (!validate_ehdr32 (elf_file))
>>    return false;
>>      break;
>>
>>    case 64:
>>      if (!validate_ehdr64 (elf_file))
>>    return false;
>>      break;
>>
>>    default:
>>      gcc_unreachable ();
>>    }
>>
>>  /* Read the string table used for section header names.  */
>>  if (elf_getshdrstrndx (elf_file->elf, &elf_file->sec_strtab) == -1)
>>    {
>>      error ("could not locate ELF string table: %s", elf_errmsg (0));
>>      return false;
>>    }
>>
>>  cached_file_attrs.initialized = true;
>>  return true;
>> }
>
> and
>>
>> /* Open ELF file FILENAME.  If WRITABLE is true, the file is opened for
>> write
>>   and, if necessary, created.  Otherwise, the file is opened for reading.
>>   Returns the opened file.  */
>>
>> lto_file *
>> lto_elf_file_open (const char *filename, bool writable)
>> {
>>  lto_elf_file *elf_file;
>>  lto_file *result = NULL;
>>  off_t offset;
>>  long loffset;
>>  off_t header_offset;
>>  const char *offset_p;
>>  char *fname;
>>  int consumed;
>>
>>  offset_p = strrchr (filename, '@');
>>  if (offset_p
>> && offset_p != filename
>> && sscanf (offset_p, "@%li%n", &loffset, &consumed) >= 1
>> && strlen (offset_p) == (unsigned int)consumed)
>>    {
>>      fname = (char *) xmalloc (offset_p - filename + 1);
>>      memcpy (fname, filename, offset_p - filename);
>>      fname[offset_p - filename] = '\0';
>>      offset = (off_t)loffset;
>>      /* elf_rand expects the offset to point to the ar header, not the
>>         object itself. Subtract the size of the ar header (60 bytes).
>>         We don't uses sizeof (struct ar_hd) to avoid including ar.h */
>>      header_offset = offset - 60;
>>    }
>>  else
>>    {
>>      fname = xstrdup (filename);
>>      offset = 0;
>>      header_offset = 0;
>>    }
>>
>>  /* Set up.  */
>>  elf_file = XCNEW (lto_elf_file);
>>  result = (lto_file *) elf_file;
>>  lto_file_init (result, fname, offset);
>>  elf_file->fd = -1;
>>
>>  /* Open the file.  */
>>  elf_file->fd = open (fname, writable ? O_WRONLY|O_CREAT|O_BINARY
>>                       : O_RDONLY|O_BINARY, 0666);
>>  if (elf_file->fd == -1)
>>    {
>>      error ("could not open file %s", fname);
>>      goto fail;
>>    }
>>
>>  /* Initialize the ELF library.  */
>>  if (elf_version (EV_CURRENT) == EV_NONE)
>>    {
>>      error ("ELF library is older than that used when building GCC");
>>      goto fail;
>>    }
>>
>>  /* Open the ELF file descriptor.  */
>>  elf_file->elf = elf_begin (elf_file->fd, writable ? ELF_C_WRITE :
>> ELF_C_READ,
>>                 NULL);
>>  if (!elf_file->elf)
>>    {
>>      error ("could not open ELF file: %s", elf_errmsg (0));
>>      goto fail;
>>    }
>>
>>  if (offset != 0)
>>    {
>>      Elf *e;
>>      off_t t = elf_rand (elf_file->elf, header_offset);
>>      if (t != header_offset)
>>        {
>>          error ("could not seek in archive");
>>          goto fail;
>>        }
>>
>>      e = elf_begin (elf_file->fd, ELF_C_READ, elf_file->elf);
>>      if (e == NULL)
>>        {
>>          error("could not find archive member");
>>          goto fail;
>>        }
>>      elf_end (elf_file->elf);
>>      elf_file->elf = e;
>>    }
>>
>>  if (writable)
>>    {
>>      init_ehdr (elf_file);
>>      elf_file->shstrtab_stream = XCNEW (struct lto_output_stream);
>>      /* Output an empty string to the section header table.  This becomes
>> the
>>     name of the initial NULL section.  */
>>      lto_output_1_stream (elf_file->shstrtab_stream, '\0');
>>    }
>>  else
>>    if (!validate_file (elf_file))
>>      goto fail;
>>
>>  return result;
>>
>>  fail:
>>  if (result)
>>    lto_elf_file_close (result);
>>  return NULL;
>> }
>
> The C source comes from 'lto-elf.c'.  A grep for it in the source directory
> '~/LLJVM/gcc/gcc-4.5.0/gcc-4.5.0-3' gives:
>>
>> ~/LLJVM/gcc/gcc-4.5.0/gcc-4.5.0-3/gcc/lto/lto-elf.c
>
> Furthermore, a find in the object directory 'gcc-obj-dir' gives:
>>
>> [mike@desktop gcc-obj-dir]$ find . -name lto-elf.o -print
>> ./gcc/lto/lto-elf.o
>
> I've attached 'lto-elf.c' and 'lto-elf.o' from those two locations in case
> it's any help.
>
> I'd be very grateful for any help.  I'm really stuck.
>
> Thanks in advance,
> Mike
>

It seems this error was because of an older libelf.

I installed elfutils-libelf-devel-0.145-1 and that worked.

However, now I face a different error that says:

make[2]: Entering directory `/home/Sandy/Development/build'
make[3]: Entering directory `/home/Sandy/Development/build'
rm -f stage_current
make[3]: Leaving directory `/home/Sandy/Development/build'
Comparing stages 2 and 3
warning: gcc/cc1-checksum.o differs
warning: gcc/cc1obj-checksum.o differs
warning: gcc/cc1plus-checksum.o differs
Bootstrap comparison failure!
gcc/gcc.o differs
gcc/plugin.o differs
make[2]: *** [compare] Error 1
make[2]: Leaving directory `/home/Sandy/Development/build'
make[1]: *** [stage3-bubble] Error 2
make[1]: Leaving directory `/home/Sandy/Development/build'
make: *** [all] Error 2

Stlll stuck.

I followed the same procedure mentioned in the first mail.

Is this a known error?
-- 
Cheers
Sandy


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux