bazelbuild / bazel-central-registry

The central registry of Bazel modules for the Bzlmod external dependency system.
https://registry.bazel.build
Apache License 2.0
233 stars 254 forks source link

[Bug]: `curl` module provides non-functional `http_only` flag #2332

Open coryan opened 4 days ago

coryan commented 4 days ago

What happened?

I want to use the curl module with https. But default this module disables https support, but it provides a http_only flag:

https://github.com/bazelbuild/bazel-central-registry/blob/46c3c225b3f95ff91809eca5f86d77bf16b984e4/modules/curl/8.7.1/patches/add_build_file.patch#L24-L32

However, the flag has no effect. Whatever its setting https support is disabled.

Version

Development (host) and target OS/architectures:

For now Linux on x86. Eventually I need this to work on Windows, macOS, and many Linux variants.

Output of bazel --version:

bazel 7.2.1

Version of relevant rules from the WORKSPACE or MODULE.bazel file:

Language(s) and/or frameworks involved:

C++

How to reproduce

This program should work, but returns an error:

#include <iostream>
#include <curl/curl.h>

int main() {
  auto* curl = curl_easy_init();
  if (curl == nullptr) {
    std::cerr << "Error in curl_easy_init()\n";
    return 1;
  }

  curl_easy_setopt(curl, CURLOPT_URL, "https://pki.google.com/roots.pem");
    curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L);

  auto res = curl_easy_perform(curl);
  if (res != CURLE_OK) {
    std::cerr << "Error in curl_easy_perform()\n";
  }
  curl_easy_cleanup(curl);
}

You also need a BUILD file:

package(default_visibility = ["//visibility:public"])

licenses(["notice"])  # Apache 2.0

cc_binary(
    name = "hello",
    srcs = ["hello.cc"],
    deps = ["@curl//:curl"]
)

And a MODULE.bazel file

module(name = "bzlmod-test")

bazel_dep(name = "curl", version = "8.7.1")

Any other information?

It seems to me that this module should have a dependency on boringssl to get https support. The BCR patch should also add USE_OPENSSL and HAVE_BORINGSSL and probably may another macros to local_defines.

keith commented 3 days ago

The current issue should be fixed by either:

https://github.com/bazelbuild/bazel-central-registry/pull/2233 https://github.com/bazelbuild/bazel-central-registry/pull/1943 or https://github.com/bazelbuild/bazel-central-registry/pull/1917

the http_only flag is about disabling things like ftp, not about http vs https