Skip to content

AIX 32 bit build is broken #18510

Closed
Closed

Description

@andrewkirillov-ibm

I did this

I was building 8.16.0 release on AIX in 32 bit mode and the build failed (64 bit build is good):

  CC       libcurl_la-altsvc.lo
altsvc.c:230:8: error: call to undeclared library function 'fopen' with type 'FILE *(const char *, const char *)'; ISO C99 and later do not support implicit function declarations [-Werror,-Wimplicit-function-declaration]
  fp = fopen(file, FOPEN_READTEXT);
       ^
altsvc.c:230:8: note: include the header <stdio.h> or explicitly provide a declaration for 'fopen'

The problem is very similar to the issue raised yesterday: #18500

So it looks like for 32 bit builds, the _LARGE_FILES is defined in system headers. And then checking /usr/include/stdio.h we find this:

#ifdef _LARGE_FILES
#define fseeko fseeko64
#define ftello ftello64
#define fgetpos fgetpos64
#define fsetpos fsetpos64
#define fopen fopen64
#define freopen freopen64
#endif /* _LARGE_FILES */

So when doing 32 bit build, fopen becomes a #define.

And now we get back to same problem as yesterday. stdio.h is included from curl_setup.h. At the end of curl_setup.h we include curl_mem_undef.h. And here we do #undef fopen.

I expected the following

I expect a clean build.

curl/libcurl version

curl 8.16.0 tag

operating system

AIX 7.2.5
Only when building in 32 bit mode

Activity

  1. andrewkirillov-ibm commented on Sep 10, 2025

    @andrewkirillov-ibm
    ContributorAuthor

    @vszakats Sorry for not testing 32-bit build too yesterday, my bad. Who could of expect such a difference.

  2. andrewkirillov-ibm commented on Sep 10, 2025

    @andrewkirillov-ibm
    ContributorAuthor

    Maybe a safer option for all this memory related stuff is to do similar as it was done yesterday for accept(), instead of doing #define/#undef.

  3. bagder commented on Sep 10, 2025

    @bagder
    Member

    At least we need to make sure to only undef if we defined it.

  4. vszakats commented on Sep 10, 2025

    @vszakats
    Member

    At least we need to make sure to only undef if we defined it.

    The next hurdle may be the (fopen) calls in memdebug.c, I think.

    A more robust way may be to go with CURL_FOPEN() and the rest (there is a macro with that name already, so needs a bit more thought). Or rig up a special hack for AIX specifically.

    For limiting the #undef, there is this patch I did not merge yesterday:
    793a375

    How does it change things?

  5. andrewkirillov-ibm commented on Sep 10, 2025

    @andrewkirillov-ibm
    ContributorAuthor

    @vszakats Yes, with that little patch AIX 32 bit build is healthy.

  6. vszakats commented on Sep 10, 2025

    @vszakats
    Member

    @andrewkirillov-ibm Ah nice, thanks, I make a PR.

    I suppose this was a non-CURLDEBUG build?

  7. andrewkirillov-ibm commented on Sep 10, 2025

    @andrewkirillov-ibm
    ContributorAuthor

    @vszakats Yes, it was non debug one. The debug build will fail indeed. But we honestly don't do debug builds on AIX, so can survive for now. I am sure by 8.17.0 there will be a cleaner fix.

  8. added a commit that references this issue on Sep 10, 2025
    7abbbed
  9. vszakats commented on Sep 10, 2025

    @vszakats
    Member

    I merged the patch. Ref #18503 with a way to fix this, though only applied for socket functions at the moment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions