#3103 closed defect (fixed)

rtems-tools on CentOS 7 Build Failure

Reported by: Joel Sherrill Owned by: chrisj@…
Priority: normal Milestone: 5.1
Component: tool Version: 5
Severity: critical Keywords:
Cc: Blocked By:
Blocking:

Description

A build failure for rtems-tools on the master has been reported on CentOS 7. This is my notes as I try to reproduce it.

[joel@localhost rtems-tools]$ ./waf configure
Setting top to : /home/joel/rtems-work/rtems-tools
Setting out to : /home/joel/rtems-work/rtems-tools/build
Version : 4.12.78bbe4c1a31d (4.12)
Checking for program 'python' : /usr/bin/python
Checking for python version >= 2.6.6 : 2.7.5
Checking for 'gcc' (C compiler) : /usr/bin/gcc
Checking for 'g++' (C++ compiler) : /usr/bin/g++
Checking for header alloca.h : yes
Checking for header fcntl.h : yes
Checking for header process.h : not found
Checking for header stdlib.h : yes
Checking for header string.h : yes
Checking for header strings.h : yes
Checking for header sys/file.h : yes
Checking for header sys/stat.h : yes
Checking for header sys/time.h : yes
Checking for header sys/types.h : yes
Checking for header sys/wait.h : yes
Checking for header unistd.h : yes
Checking for header vfork.h : not found
Checking for function getrusage : yes
Checking for program 'm4' : /usr/bin/m4
Checking for header sys/wait.h : yes
Checking for function kill : yes
Checking for 'gcc' (C compiler) : /usr/bin/gcc
Checking for 'g++' (C++ compiler) : /usr/bin/g++
Checking for 'g++' (C++ compiler) : /usr/bin/g++
Checking for function open64 : not found
Checking for function stat64 : not found
'configure' finished successfully (0.786s)
=========================================================
[joel@localhost rtems-tools]$ ./waf -j 1 --verbose
Waf: Entering directory `/home/joel/rtems-work/rtems-tools/build'
[ 88/151] Compiling rtemstoolkit/rld-process.cpp
11:58:16 runner ['/usr/bin/g++', '-pipe', '-g', '-O2', '-Wall', '-Wextra', '-pedantic', '-Irtemstoolkit', '-I../rtemstoolkit', '-Irtemstoolkit/elftoolchain/libelf', '-I../rtemstoolkit/elftoolchain/libelf', '-Irtemstoolkit/elftoolchain/common', '-I../rtemstoolkit/elftoolchain/common', '-Irtemstoolkit/libiberty', '-I../rtemstoolkit/libiberty', '-DHAVE_CONFIG_H=1', '-DRTEMS_VERSION="4.12"', '-DRTEMS_RELEASE="4.12.78bbe4c1a31d"', '-DFASTLZ_LEVEL=1', '../rtemstoolkit/rld-process.cpp', '-c', '-o/home/joel/rtems-work/rtems-tools/build/rtemstoolkit/rld-process.cpp.7.o']
In file included from ../rtemstoolkit/libiberty/libiberty.h:42:0,

from ../rtemstoolkit/rld-process.cpp:64:

../rtemstoolkit/libiberty/ansidecl.h:169:64: error: new declaration ‘char* basename(const char*)’

# define ATTRIBUTE_NONNULL(m) attribute ((nonnull (m)))


../rtemstoolkit/libiberty/libiberty.h:112:64: note: in expansion of macro ‘ATTRIBUTE_NONNULL’

extern char *basename (const char *) ATTRIBUTE_RETURNS_NONNULL ATTRIBUTE_NONNULL(1);


In file included from ../rtemstoolkit/rld-process.cpp:24:0:
/usr/include/string.h:599:26: error: ambiguates old declaration ‘const char* basename(const char*)’

extern "C++" const char *basename (const char *filename)


In file included from ../rtemstoolkit/libiberty/libiberty.h:42:0,

from ../rtemstoolkit/rld-process.cpp:64:

../rtemstoolkit/libiberty/ansidecl.h:169:64: error: declaration of ‘int vasprintf(char, const char*, va_list_tag*)’ has a different exception specifier

# define ATTRIBUTE_NONNULL(m) attribute ((nonnull (m)))


../rtemstoolkit/libiberty/ansidecl.h:198:80: note: in expansion of macro ‘ATTRIBUTE_NONNULL’

#define ATTRIBUTE_PRINTF(m, n) attribute ((format (printf, m, n))) ATTRIBUTE_NONNULL(m)


../rtemstoolkit/libiberty/libiberty.h:651:55: note: in expansion of macro ‘ATTRIBUTE_PRINTF’

extern int vasprintf (char , const char *, va_list) ATTRIBUTE_PRINTF(2,0);


In file included from ../rtemstoolkit/rld-process.cpp:23:0:
/usr/include/stdio.h:399:12: error: from previous declaration ‘int vasprintf(char, const char*, va_list_tag*) throw ()’

extern int vasprintf (char restrict ptr, const char *restrict f,


Waf: Leaving directory `/home/joel/rtems-work/rtems-tools/build'
Build failed

-> task in 'rld' failed with exit status 1:

{task 23048432: cxx rld-process.cpp -> rld-process.cpp.7.o}

['/usr/bin/g++', '-pipe', '-g', '-O2', '-Wall', '-Wextra', '-pedantic', '-Irtemstoolkit', '-I../rtemstoolkit', '-Irtemstoolkit/elftoolchain/libelf', '-I../rtemstoolkit/elftoolchain/libelf', '-Irtemstoolkit/elftoolchain/common', '-I../rtemstoolkit/elftoolchain/common', '-Irtemstoolkit/libiberty', '-I../rtemstoolkit/libiberty', '-DHAVE_CONFIG_H=1', '-DRTEMS_VERSION="4.12"', '-DRTEMS_RELEASE="4.12.78bbe4c1a31d"', '-DFASTLZ_LEVEL=1', '../rtemstoolkit/rld-process.cpp', '-c', '-o/home/joel/rtems-work/rtems-tools/build/rtemstoolkit/rld-process.cpp.7.o']
==================================================================
Looking down into libiberty.h, I picked on basename()

/* HAVE_DECL_* is a three-state macro: undefined, 0 or 1. If it is

undefined, we haven't run the autoconf check so provide the
declaration without arguments. If it is 0, we checked and failed
to find the declaration so provide a fully prototyped one. If it
is 1, we found it so don't provide any declaration at all. */

#if !HAVE_DECL_BASENAME

#if defined (GNU_LIBRARY )
defined (linux) \
defined (FreeBSD) defined (OpenBSD) defined (NetBSD) \
defined (CYGWIN) defined (CYGWIN32) defined (MINGW32) \
defined (DragonFly) defined (HAVE_DECL_BASENAME)

extern char *basename (const char *) ATTRIBUTE_RETURNS_NONNULL ATTRIBUTE_NONNULL(1);
#else
/* Do not allow basename to be used if there is no prototype seen. We

either need to use the above prototype or have one from
autoconf which would result in HAVE_DECL_BASENAME being set. */

#define basename basename_cannot_be_used_without_a_prototype
#endif
#endif
============================================
The native CentOS 7 has this definition of basename:

# ifndef basename
/* Return the file name within directory of FILENAME. We don't

declare the function if the `basename' macro is available (defined
in <libgen.h>) which makes the XPG version of this function
available. */

# ifdef CORRECT_ISO_CPP_STRING_H_PROTO
extern "C++" char *basename (char *filename)

THROW asm ("basename") nonnull ((1));

extern "C++" const char *basename (const char *filename)

THROW asm ("basename") nonnull ((1));

# else
extern char *basename (const char *filename) THROW nonnull ((1));
# endif
# endif
#endif

==============================
I think we are getting the C++ prototype from string.h and a conflicting C prototype from libiberty.h

Change History (2)

comment:1 Changed on 08/20/17 at 07:22:34 by Chris Johns <chrisj@…>

Resolution: fixed
Status: newclosed

In f2bb439/rtems-tools:

rtemstoolkit/libiberty: Fix broken configure detection.

The file libiberty.h requires some configure macros to control some parts
and these are not provided so the file did not match what was needed. Hard
code the result and remove the need for the macros. The related calls
are not provided in our libiberty usage and not needed.

Closes #3103.

comment:2 Changed on 11/09/17 at 06:27:14 by Sebastian Huber

Milestone: 4.12.05.1

Milestone renamed

Note: See TracTickets for help on using tickets.