Re: fixincludes issue with gcc 4.4.2 build on centos 5.5. 32-bit /i686

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

 



On Mon, Dec 20, 2010 at 2:14 PM, Ian Lance Taylor <iant@xxxxxxxxxx> wrote:
> Hari Kodungallur <hari.mailinglists@xxxxxxxxx> writes:
>
>> I built gcc 4.4.2 from source on a CentOS 32-bit VM. The build went
>> through without much issues.
>> But later when I build our project, I get this error:
>>
>> /opt/gcc-4.4.2/bin/../lib/gcc/i686-pc-linux-gnu/4.4.2/include-fixed/sys/stat.h:317:
>> warning: inline function ‘lstat64’ declared but never defined
>> /opt/gcc-4.4.2/bin/../lib/gcc/i686-pc-linux-gnu/4.4.2/include-fixed/sys/stat.h:286:
>> warning: inline function ‘fstatat64’ declared but never defined
>> /opt/gcc-4.4.2/bin/../lib/gcc/i686-pc-linux-gnu/4.4.2/include-fixed/sys/stat.h:255:
>> warning: inline function ‘fstat64’ declared but never defined
>> /opt/gcc-4.4.2/bin/../lib/gcc/i686-pc-linux-gnu/4.4.2/include-fixed/sys/stat.h:250:
>> warning: inline function ‘stat64’ declared but never defined
>>
>>
>> Looking into the stat.h in include-fixed/sys, it looks like gcc fixes
>> the stat.h to convert these functions to "extern inline int" from
>> being "extern int".
>>
>> Obviously I am either missing some libraries on the system, or I am
>> passing the wrong configure options either while building gcc or while
>> building my project.
>
> This sounds like a fixincludes problem.  I don't see it reported,
> though.  This must have something to do with the patches for "extern
> inline".  The meaning of "extern inline" changes in C99.  glibc adapted
> by using __extern_inline, and gcc uses fixincludes for older versions of
> glibc.  You presumably have an older version.
>
> I don't see why it would change to "extern int", though.  As far as I
> can tell, it should change to "__inline__ int".  It expects to see
> "extern __inline__ int" on the function definition.  It sounds like your
> versions of glibc is using that on a declaration, not a definition,
> which sounds strange to me.
>
> Can you send the complete declaration/definition of, say, lstat64 from
> <sys/stat.h> and from the fixed sys/stat.h?
>
> Ian
>

Thanks Ian. I've been looking through the sys/stat.h and the generated
stat.h and I see that the 64 variants (stat64, lstat64 etc) have a
block of code that get executed only when __OPTIMIZE__ is defined.
This block of code just redirects these function the 'x' functions.
And sure enough, when I tried compiling with -O1 (instead of -O0), the
compilation worked (but I do want a non-optimized build too...).

So, I think it is a combination of the fixincludes "fix" as well as
this block under __OPTIMIZE__. I am not sure why these *64 functions
need to be used only with optimization.
Please let me know if you need me to send anything else.

Here's are the (what I think) relevant portions of stat/fast and
stat64/fstat64 variants from both <sys/stat.h> and from the fixed
sys/stat.h. (and hoping that I didn't screw it up cutting and
pasting!).

>From <sys/stat.h>:
=================

...
...
...

#ifndef __USE_FILE_OFFSET64
/* Get file attributes for FILE and put them in BUF.  */
extern int stat (__const char *__restrict __file,
                struct stat *__restrict __buf) __THROW __nonnull ((1, 2));

/* Get file attributes for the file, device, pipe, or socket
  that file descriptor FD is open on and put them in BUF.  */
extern int fstat (int __fd, struct stat *__buf) __THROW __nonnull ((2));
#else
# ifdef __REDIRECT_NTH
extern int __REDIRECT_NTH (stat, (__const char *__restrict __file,
                                 struct stat *__restrict __buf), stat64)
    __nonnull ((1, 2));
extern int __REDIRECT_NTH (fstat, (int __fd, struct stat *__buf), fstat64)
    __nonnull ((2));
# else
#  define stat stat64
#  define fstat fstat64
# endif
#endif
#ifdef __USE_LARGEFILE64
extern int stat64 (__const char *__restrict __file,
                  struct stat64 *__restrict __buf) __THROW __nonnull ((1, 2));
extern int fstat64 (int __fd, struct stat64 *__buf) __THROW __nonnull ((2));
#endif

...
...
...

#ifndef __USE_FILE_OFFSET64
extern int __fxstat (int __ver, int __fildes, struct stat *__stat_buf)
    __THROW __nonnull ((3));
extern int __xstat (int __ver, __const char *__filename,
                   struct stat *__stat_buf) __THROW __nonnull ((2, 3));
#else
# ifdef __REDIRECT_NTH
extern int __REDIRECT_NTH (__fxstat, (int __ver, int __fildes,
                                     struct stat *__stat_buf), __fxstat64)
    __nonnull ((3));
extern int __REDIRECT_NTH (__xstat, (int __ver, __const char *__filename,
                                    struct stat *__stat_buf), __xstat64)
    __nonnull ((2, 3));
# else
#  define __fxstat __fxstat64
#  define __xstat __xstat64
# endif
#endif

#ifdef __USE_LARGEFILE64
extern int __fxstat64 (int __ver, int __fildes, struct stat64 *__stat_buf)
    __THROW __nonnull ((3));
extern int __xstat64 (int __ver, __const char *__filename,
                     struct stat64 *__stat_buf) __THROW __nonnull ((2, 3));
#endif


...
...
...

# if defined __USE_LARGEFILE64 \
 && (! defined __USE_FILE_OFFSET64 \
     || (defined __REDIRECT_NTH && defined __OPTIMIZE__))
extern __inline__ int
__NTH (stat64 (__const char *__path, struct stat64 *__statbuf))
{
 return __xstat64 (_STAT_VER, __path, __statbuf);
}

extern __inline__ int
__NTH (fstat64 (int __fd, struct stat64 *__statbuf))
{
 return __fxstat64 (_STAT_VER, __fd, __statbuf);
}
# endif


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

>From fixed sys/stat.h:
======================

...
...
...

#ifndef __USE_FILE_OFFSET64
/* Get file attributes for FILE and put them in BUF.  */
#ifdef __GNUC_GNU_INLINE__
extern
#endif
__inline__ int stat (__const char *__restrict __file,
                struct stat *__restrict __buf) __THROW __nonnull ((1, 2));

/* Get file attributes for the file, device, pipe, or socket
  that file descriptor FD is open on and put them in BUF.  */
#ifdef __GNUC_GNU_INLINE__
extern
#endif
__inline__ int fstat (int __fd, struct stat *__buf) __THROW __nonnull ((2));
#else
# ifdef __REDIRECT_NTH
#ifdef __GNUC_GNU_INLINE__
extern
#endif
__inline__ int __REDIRECT_NTH (stat, (__const char *__restrict __file,
                                 struct stat *__restrict __buf), stat64)
    __nonnull ((1, 2));
#ifdef __GNUC_GNU_INLINE__
extern
#endif
__inline__ int __REDIRECT_NTH (fstat, (int __fd, struct stat *__buf), fstat64)
    __nonnull ((2));
# else
#  define stat stat64
#  define fstat fstat64
# endif
#endif
#ifdef __USE_LARGEFILE64
#ifdef __GNUC_GNU_INLINE__
extern
#endif
__inline__ int stat64 (__const char *__restrict __file,
                  struct stat64 *__restrict __buf) __THROW __nonnull ((1, 2));
#ifdef __GNUC_GNU_INLINE__
extern
#endif
__inline__ int fstat64 (int __fd, struct stat64 *__buf) __THROW __nonnull ((2));
#endif

...
...
...

/* Wrappers for stat and mknod system calls.  */
#ifndef __USE_FILE_OFFSET64
extern int __fxstat (int __ver, int __fildes, struct stat *__stat_buf)
    __THROW __nonnull ((3));
extern int __xstat (int __ver, __const char *__filename,
                   struct stat *__stat_buf) __THROW __nonnull ((2, 3));
#else
# ifdef __REDIRECT_NTH
extern int __REDIRECT_NTH (__fxstat, (int __ver, int __fildes,
                                     struct stat *__stat_buf), __fxstat64)
    __nonnull ((3));
extern int __REDIRECT_NTH (__xstat, (int __ver, __const char *__filename,
                                    struct stat *__stat_buf), __xstat64)
    __nonnull ((2, 3));
# else
#  define __fxstat __fxstat64
#  define __xstat __xstat64
# endif
#endif

#ifdef __USE_LARGEFILE64
extern int __fxstat64 (int __ver, int __fildes, struct stat64 *__stat_buf)
    __THROW __nonnull ((3));
extern int __xstat64 (int __ver, __const char *__filename,
                     struct stat64 *__stat_buf) __THROW __nonnull ((2, 3));
#endif


...
...
...

# if defined __USE_LARGEFILE64 \
 && (! defined __USE_FILE_OFFSET64 \
     || (defined __REDIRECT_NTH && defined __OPTIMIZE__))
#ifdef __GNUC_GNU_INLINE__
extern
#endif
__inline__ int
__NTH (stat64 (__const char *__path, struct stat64 *__statbuf))
{
 return __xstat64 (_STAT_VER, __path, __statbuf);
}

#ifdef __GNUC_GNU_INLINE__
extern
#endif
__inline__ int
__NTH (fstat64 (int __fd, struct stat64 *__statbuf))
{
 return __fxstat64 (_STAT_VER, __fd, __statbuf);
}
#  endif
# endif


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


thanks,
-Hari


[PS: Ian, sorry for the duplicate email.. I didn't hit reply-all before]



[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