Open Source Development

Power Open Source Development

Explore the open source tools and capabilities for building and deploying modern applications on IBM Power platforms including AIX, IBM i, and Linux.


#Power


#Power

 View Only
  • 1.  AIX system headers woes

    Posted Fri March 22, 2024 10:56 PM

    Hello IBM community,

    I keep running into the same problems with AIX. It's always about redefinitions in the system headers. In most cases it comes down to either "conflicting types" or "functions that differ only in their return type cannot be overloaded".
    Of course I had a look around and found a bunch of reports in that regard but no good, general answer. I spotted the _LARGE_FILE constants but couldn't find a combination of defines to get rid of the related errors. Using gcc or XL makes no difference. Here are some examples:

    /usr/include/sys/mman.h:154:15: error: conflicting types for 'mmap64'
      154 |         extern void     *mmap64(void *, size_t, int, int, int, off64_t);
          |                          ^
    /usr/include/sys/mman.h:149:15: note: previous declaration is here
      149 |         extern void     *mmap(void *, size_t, int, int, int, off_t);
          |                          ^
    /usr/include/sys/mman.h:89:15: note: expanded from macro 'mmap'
       89 | #define mmap    mmap64
          |                 ^

    /usr/include/sys/lockf.h:64:13: error: conflicting types for 'lockf64'
       64 |         extern int lockf64 (int, int, off64_t);
          |                    ^
    /usr/include/sys/lockf.h:62:13: note: previous declaration is here
       62 |         extern int lockf (int, int, off_t);
          |                    ^
    /usr/include/sys/lockf.h:56:15: note: expanded from macro 'lockf'
       56 | #define lockf lockf64

    /usr/include/unistd.h:198:25: error: functions that differ only in their return type cannot be overloaded
      198 | extern off64_t  _NOTHROW(lseek64, (int, off64_t, int));
          |        ~~~~~~~           ^
    /usr/include/comp_macros.h:47:26: note: expanded from macro '_NOTHROW'
       47 | #define _NOTHROW(_F, _B) _F _B throw()
          |                          ^
    /usr/include/unistd.h:196:23: note: previous declaration is here
      196 | extern off_t _NOTHROW(lseek, (int, off_t, int));
          |        ~~~~~          ^
    /usr/include/unistd.h:67:15: note: expanded from macro 'lseek'
       67 | #define lseek lseek64
          |               ^
    /usr/include/comp_macros.h:47:26: note: expanded from macro '_NOTHROW'
       47 | #define _NOTHROW(_F, _B) _F _B throw()
          |                          ^

    /usr/include/unistd.h:918:23: error: conflicting types for 'ftruncate64'
      918 |         extern int              _NOTHROW(ftruncate64, (int, off64_t));
          |                                          ^
    /usr/include/unistd.h:916:23: note: previous declaration is here
      916 |         extern int              _NOTHROW(ftruncate, (int, off_t));
          |                                          ^
    /usr/include/unistd.h:840:19: note: expanded from macro 'ftruncate'
      840 | #define ftruncate       ftruncate64
          |                         ^

    /usr/include/unistd.h:975:23: error: conflicting types for 'truncate64'
      975 |         extern int              _NOTHROW(truncate64, (const char *, off64_t));
          |                                          ^
    /usr/include/unistd.h:973:23: note: previous declaration is here
      973 |         extern int              _NOTHROW(truncate, (const char *, off_t));
          |                                          ^
    /usr/include/unistd.h:841:18: note: expanded from macro 'truncate'
      841 | #define truncate        truncate64
          |                         ^

    /usr/include/unistd.h:994:18: error: conflicting types for 'pread64'
      994 |         extern ssize_t          pread64(int, void *, size_t, off64_t);
          |                                 ^
    /usr/include/unistd.h:991:18: note: previous declaration is here
      991 |         extern ssize_t          pread(int, void *, size_t, off_t);
          |                                 ^
    /usr/include/unistd.h:987:16: note: expanded from macro 'pread'
      987 | #define pread           pread64
          |                         ^

    Any help with sorting these properly would be most welcome!



    ------------------------------
    jack smith
    ------------------------------

    #AIXOpenSource


  • 2.  RE: AIX system headers woes

    Posted Mon March 25, 2024 04:36 AM

    Hi Jack,

    it requires a little bit more information - a code snippet you try to compile and which produces the errors.

    From the first sight it looks like you use 64-bit functions but compiling for 32-bit or vice versa.



    ------------------------------
    Andrey Klyachkin

    https://www.power-devops.com
    ------------------------------



  • 3.  RE: AIX system headers woes

    Posted Mon March 25, 2024 07:43 PM

    Thanks for the reply!

    I'm not sure when I'll get to the machine next due to the short easter week. So I might only be able to prepare an example after the holidays.
    However, one case I remember clearly is mariadb's xtradb. Compiling that brought up a particularly high number of these errors. But I also ran into them with a bunch of other foss programs as well. That's why I posted it in the open source section although it's about AIX' own headers.

    As to 32/64 bit, I always use -maix64 and have set OBJECT_MODE=64. What I don't have set by default is -maix64 as LDFLAGS. These header errors however are no linker issues so that shouldn't be a problem.



    ------------------------------
    jack smith
    ------------------------------