Skip to content

Patch #3090 - Fix and test S3 enabled builds #3122

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

mannreis
Copy link
Contributor

@mannreis mannreis commented Apr 15, 2025

After #3090 merged I cannot build the main netcdf branch with:
cmake ../ -DNETCDF_ENABLE_NCZARR=ON -DNETCDF_ENABLE_S3_INTERNAL=ON

This PR tries to fix the most of it but there are a lot of confusion around:
NC_sortenvv, nczm_sortenvv and NC_freeenv vs NCZ_freeenv

@DennisHeimbigner can you please check?


Fixes #3147

@DennisHeimbigner
Copy link
Collaborator

-NC_s3sdkclose(void* s3client0, NCS3INFO* info, int deleteit, char** errmsgp)
+NC_s3sdkclose(void* s3client0, char** errmsgp)

I am confused by this PR. For example, what is the reason you are changing the signature of this function?

@mannreis
Copy link
Contributor Author

mannreis commented Jun 12, 2025

@DennisHeimbigner if you compile the current main branch in the following way you'll see the problem:

git clone https://github.com/Unidata/netcdf-c.git
mkdir netcdf-c/build
cd netcdf-c/build
cmake ../ -DNETCDF_ENABLE_NCZARR=ON -DNETCDF_ENABLE_S3_INTERNAL=ON
cmake --build . -j 16

The PR is just to show that the current main is broken when enabling S3.

/home/reis/netcdf-c/libnczarr/zmap_s3sdk.c: In function 'zs3open':
/home/reis/netcdf-c/libnczarr/zmap_s3sdk.c:230:16: warning: implicit declaration of function 'NC_s3sdkgetkeys'; did you mean 'NC_s3sdkdeletekey'? [-Wimplicit-function-declaration]
  230 |     if((stat = NC_s3sdkgetkeys(z3map->s3client,z3map->s3.bucket,z3map->s3.rootkey,&nkeys,NULL,&z3map->errmsg)))
      |                ^~~~~~~~~~~~~~~
      |                NC_s3sdkdeletekey
/home/reis/netcdf-c/libnczarr/zmap_s3sdk.c: In function 'zs3truncate':
/home/reis/netcdf-c/libnczarr/zmap_s3sdk.c:264:47: warning: passing argument 2 of 'NC_s3sdkclose' from incompatible pointer type [-Wincompatible-pointer-types]
  264 |     if(s3client) {stat=NC_s3sdkclose(s3client,&info,1,NULL);}
      |                                               ^~~~~
      |                                               |
      |                                               NCS3INFO *
In file included from /home/reis/netcdf-c/libnczarr/zincludes.h:46,
                 from /home/reis/netcdf-c/libnczarr/zmap_s3sdk.c:6:
/home/reis/netcdf-c/include/ncs3sdk.h:64:51: note: expected 'char **' but argument is of type 'NCS3INFO *'
   64 | EXTERNL int NC_s3sdkclose(void* s3client0, char** errmsgp);
      |                                            ~~~~~~~^~~~~~~
/home/reis/netcdf-c/libnczarr/zmap_s3sdk.c:264:24: error: too many arguments to function 'NC_s3sdkclose'
  264 |     if(s3client) {stat=NC_s3sdkclose(s3client,&info,1,NULL);}
      |                        ^~~~~~~~~~~~~
In file included from /home/reis/netcdf-c/libnczarr/zincludes.h:46,
                 from /home/reis/netcdf-c/libnczarr/zmap_s3sdk.c:6:
/home/reis/netcdf-c/include/ncs3sdk.h:64:13: note: declared here
   64 | EXTERNL int NC_s3sdkclose(void* s3client0, char** errmsgp);
      |             ^~~~~~~~~~~~~
/home/reis/netcdf-c/libnczarr/zmap_s3sdk.c: In function 'zs3close':
/home/reis/netcdf-c/libnczarr/zmap_s3sdk.c:410:40: warning: passing argument 2 of 'NC_s3sdkclose' from incompatible pointer type [-Wincompatible-pointer-types]
  410 |         NC_s3sdkclose(z3map->s3client, &z3map->s3, deleteit, &z3map->errmsg);
      |                                        ^~~~~~~~~~
      |                                        |
      |                                        NCS3INFO *
In file included from /home/reis/netcdf-c/libnczarr/zincludes.h:46,
                 from /home/reis/netcdf-c/libnczarr/zmap_s3sdk.c:6:
/home/reis/netcdf-c/include/ncs3sdk.h:64:51: note: expected 'char **' but argument is of type 'NCS3INFO *'
   64 | EXTERNL int NC_s3sdkclose(void* s3client0, char** errmsgp);
      |                                            ~~~~~~~^~~~~~~
/home/reis/netcdf-c/libnczarr/zmap_s3sdk.c:410:9: error: too many arguments to function 'NC_s3sdkclose'
  410 |         NC_s3sdkclose(z3map->s3client, &z3map->s3, deleteit, &z3map->errmsg);
      |         ^~~~~~~~~~~~~
In file included from /home/reis/netcdf-c/libnczarr/zincludes.h:46,
                 from /home/reis/netcdf-c/libnczarr/zmap_s3sdk.c:6:
/home/reis/netcdf-c/include/ncs3sdk.h:64:13: note: declared here
   64 | EXTERNL int NC_s3sdkclose(void* s3client0, char** errmsgp);
      |             ^~~~~~~~~~~~~
/home/reis/netcdf-c/libnczarr/zmap_s3sdk.c: In function 'zs3search':
/home/reis/netcdf-c/libnczarr/zmap_s3sdk.c:466:44: warning: conversion to 'size_t' {aka 'long unsigned int'} from 'int' may change the sign of the result [-Wsign-conversion]
  466 |             const char* is = nclistget(tmp,i);
      |                                            ^
/home/reis/netcdf-c/libnczarr/zmap_s3sdk.c:468:52: warning: conversion to 'size_t' {aka 'long unsigned int'} from 'int' may change the sign of the result [-Wsign-conversion]
  468 |                 const char* js = nclistget(matches,j);
      |                                                    ^
/home/reis/netcdf-c/libnczarr/zmap_s3sdk.c: In function 's3clear':
/home/reis/netcdf-c/libnczarr/zmap_s3sdk.c:508:20: warning: implicit declaration of function 'NC_s3sdksearch'; did you mean 'NC_s3sdkread'? [-Wimplicit-function-declaration]
  508 |         if((stat = NC_s3sdksearch(s3client, bucket, rootkey, &nkeys, &list, NULL)))
      |                    ^~~~~~~~~~~~~~
      |                    NC_s3sdkread
gmake[2]: *** [libnczarr/CMakeFiles/nczarr.dir/build.make:443: libnczarr/CMakeFiles/nczarr.dir/zmap_s3sdk.c.o] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:3057:

Feel free to close it or add to it.

@mannreis mannreis changed the title Patch #3090 Patch #3090 - Fix and test S3 enabled builds Jun 25, 2025
@mannreis mannreis marked this pull request as ready for review June 25, 2025 15:07
@mannreis
Copy link
Contributor Author

Just so that it doesn't go noticed: that both Github actions workflows on windows, cygwin and mingw have explicitly disabled S3 builds. Should we dare changing that?!

@DennisHeimbigner
Copy link
Collaborator

We should be able to enable it (using internal s3 sdk) for cygwin. Not sure about mingw.

@mannreis mannreis force-pushed the patch-3090 branch 5 times, most recently from 6f8324e to 5d4a2c7 Compare June 26, 2025 12:34
@mannreis mannreis marked this pull request as draft June 26, 2025 12:44
@mannreis mannreis force-pushed the patch-3090 branch 3 times, most recently from 572c200 to 3dbbbf8 Compare June 26, 2025 13:32
@DennisHeimbigner
Copy link
Collaborator

I am seriously confused about what is going on here.

@WardF
Copy link
Member

WardF commented Jun 26, 2025

@mannreis I'm setting up to examine and test locally; for standardization purposes, which version of the s3 sdk are you working against?

@mannreis
Copy link
Contributor Author

I'm sorry for the noise. I tried to modify the GitHub actions workflows to build with the internal S3 sdk (same as I was working with) but it was a trial and error journey. That's why I squashed commits and force pushed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Failing builds with S3 enabled
3 participants