You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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:
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.
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
@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.
Activity
andrewkirillov-ibm commentedon Sep 10, 2025
@vszakats Sorry for not testing 32-bit build too yesterday, my bad. Who could of expect such a difference.
andrewkirillov-ibm commentedon Sep 10, 2025
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.bagder commentedon Sep 10, 2025
At least we need to make sure to only undef if we defined it.
vszakats commentedon Sep 10, 2025
The next hurdle may be the
(fopen)calls inmemdebug.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?
andrewkirillov-ibm commentedon Sep 10, 2025
@vszakats Yes, with that little patch AIX 32 bit build is healthy.
vszakats commentedon Sep 10, 2025
@andrewkirillov-ibm Ah nice, thanks, I make a PR.
I suppose this was a non-
CURLDEBUGbuild?andrewkirillov-ibm commentedon Sep 10, 2025
@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.
curl_mem_undef.h: limit `#undef` to `CURLDEBUG` for non-allocaction o…
vszakats commentedon Sep 10, 2025
I merged the patch. Ref #18503 with a way to fix this, though only applied for socket functions at the moment.
build: avoid overriding system symbols for fopen functions