rustls / rustls-ffi

Use Rustls from any language
Other
128 stars 30 forks source link

curl 8.5.0 build error with 0.12.0: `call to undeclared function` & integer conversion #384

Closed der-eismann closed 8 months ago

der-eismann commented 8 months ago

Hi everyone, please let me know if this needs to be addressed in curl instead, but since building curl worked fine with 0.11.0 and failed with 0.12.0, I felt this is the correct place.

So I built rustls-ffi with make PROFILE=release & rust 1.74.0. Afterwards I tried to build curl 8.5.0 with clang 16 and

$ ./configure \
        --disable-static \
        --with-rustls=/usr
$ make

and as a result I got the following errors:

vtls/rustls.c:418:13: error: call to undeclared function 'rustls_root_cert_store_new'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
    roots = rustls_root_cert_store_new();
            ^
vtls/rustls.c:418:13: note: did you mean 'rustls_root_cert_store_free'?
/usr/include/rustls.h:1018:6: note: 'rustls_root_cert_store_free' declared here
void rustls_root_cert_store_free(const struct rustls_root_cert_store *store);
     ^
vtls/rustls.c:418:11: error: incompatible integer to pointer conversion assigning to 'struct rustls_root_cert_store *' from 'int' [-Wint-conversion]
    roots = rustls_root_cert_store_new();
          ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
vtls/rustls.c:421:14: error: call to undeclared function 'rustls_root_cert_store_add_pem'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
    result = rustls_root_cert_store_add_pem(roots, ca_info_blob->data,
             ^
vtls/rustls.c:431:14: error: call to undeclared function 'rustls_client_config_builder_use_roots'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
    result = rustls_client_config_builder_use_roots(config_builder, roots);
             ^
vtls/rustls.c:441:14: error: call to undeclared function 'rustls_client_config_builder_load_roots_from_file'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
    result = rustls_client_config_builder_load_roots_from_file(
             ^
vtls/rustls.c:441:14: note: did you mean 'rustls_root_cert_store_builder_load_roots_from_file'?
/usr/include/rustls.h:991:15: note: 'rustls_root_cert_store_builder_load_roots_from_file' declared here
rustls_result rustls_root_cert_store_builder_load_roots_from_file(struct rustls_root_cert_store_builder *builder,
              ^
5 errors generated.
make[2]: *** [Makefile:3193: vtls/libcurl_la-rustls.lo] Error 1

Does curl need to update its rustls support? Or is it an issue with this library? Thanks!

ctz commented 8 months ago

Yes, curl currently targets rustls-ffi 0.11. Most likely it is on us to submit a PR to curl to account for the breaking changes we made in 0.12.

der-eismann commented 8 months ago

Ah, I wasn't sure how stable/compatible the APIs are. So should I close this or how do you want to proceed?

cpu commented 8 months ago

Ah, I wasn't sure how stable/compatible the APIs are

We're following the conventional Cargo semver guidelines where:

releases starting with “0.y.z” can treat changes in “y” as a major release, and “z” as a minor release.

It's best to assume each increment of the "y" component is a major release that will be incompatible with previous versions without code changes. Similarly, there's no guarantee of ABI stability across releases at this time.

So should I close this or how do you want to proceed?

Perhaps an issue on the curl repo to track an update to the latest Rustls is the best path forward?

I agree with Ctz that it's likely one of the Rustls maintainers (or a motivated 3rd party :-)) would need to do the work. For me personally I find it time intensive to spin up on a large C project's build system/codebase and so while I'm interested I haven't been able to find the time.

der-eismann commented 8 months ago

Alright, opened https://github.com/curl/curl/issues/12737. Hopefully someone finds the time soon :slightly_smiling_face:

cpu commented 8 months ago

Thanks! I'll close this issue so we can coordinate in the repo where the work needs to be done.

gvanem commented 8 months ago

And BTW, rustls.h still have references to this symbol rustls_client_config_builder_load_roots_from_file() in it's comments and elsewhere: https://github.com/search?q=repo%3Arustls%2Frustls-ffi%20rustls_client_config_builder_load_roots_from_file&type=code