Sorry for the typo in pasting the sample program.

Here is the complete one.

#include <sys/types.h>
#define _LARGE_FILES 1
#include <stdio.h>
int main()
{
   return 0;
}


On Fri, Dec 19, 2025 at 6:02 PM Sangamesh Mallayya
<[email protected]> wrote:
>
> In AIX, build fails while trying to compile gcc/diagnostics/sarif-sink.cc.
> Here is the snapshot of the error we are getting.
>
> In file included from /opt/freeware/src/packages/BUILD/gcc/gcc/system.h:46,
>                  from 
> /opt/freeware/src/packages/BUILD/gcc/gcc/diagnostics/sarif-sink.cc:34:
> /opt/freeware/lib/gcc/powerpc-ibm-aix7.3.0.0/13/include-fixed/stdio.h:593:12: 
> error: conflicting declaration of C function 'int fgetpos64(FILE*, fpos64_t*)'
>   593 | extern int fgetpos64(FILE *, fpos64_t *);
>       |            ^~~~~~~~~
>
> This happens when we include sys/types.h before defining _LARGE_FILES.
> We can see similar errors with this sample program.
>
> int main()
> {
>    return 0;
> }
>
> In gcc/diagnostics/sarif-sink.cc we are including config.h after #include 
> <sys/un.h> which intern including sys/types.h and causing the conflicting 
> errors.
> Including config.h before including sys/un.h should solve this error.
>
> The patch is to fix the build break on AIX.
>
> gcc/ChangeLog:
>         * diagnostics/sarif-sink.cc: Move config.h before sys/un.h for non 
> __MINGW32__ targets.
> ---
>  gcc/diagnostics/sarif-sink.cc | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/gcc/diagnostics/sarif-sink.cc b/gcc/diagnostics/sarif-sink.cc
> index 1356919ff80..43a4f1a3d91 100644
> --- a/gcc/diagnostics/sarif-sink.cc
> +++ b/gcc/diagnostics/sarif-sink.cc
> @@ -18,15 +18,19 @@ You should have received a copy of the GNU General Public 
> License
>  along with GCC; see the file COPYING3.  If not see
>  <http://www.gnu.org/licenses/>.  */
>
> +#ifndef __MINGW32__
> +#include "config.h"
> +#endif
> +
>  #ifdef __MINGW32__
>  #include <winsock2.h>
>  #include <afunix.h>
> +#include "config.h"
>  #else
>  #include <sys/un.h>
>  #include <sys/socket.h>
>  #endif
>
> -#include "config.h"
>  #define INCLUDE_LIST
>  #define INCLUDE_MAP
>  #define INCLUDE_STRING
> --
> 2.41.0
>


-- 
Thanks & Regards,
Sangamesh

Reply via email to