Skip to content
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

curl formula fails on MacBook Pro M1 running macOS Big Sur 11.2.3, using Homebrew 3.0.11 #21

Closed
ctsrc opened this issue Apr 6, 2021 · 9 comments

Comments

@ctsrc
Copy link

ctsrc commented Apr 6, 2021

Hi, I tried to use the Homebrew formula for curl + quiche, but even after working around the issue noted in #19 by doing as cloudflare/cloudflare-docs#929 suggests instead, I run into problems.

mkdir -p ~/tmp/
curl -o ~/tmp/curl.rb https://raw.githubusercontent.com/cloudflare/homebrew-cloudflare/master/curl.rb
brew install --HEAD -s ~/tmp/curl.rb
Error: Failed to load cask: /Users/user/tmp/curl.rb
Cask 'curl' is unreadable: wrong constant name #<Class:0x0000000124c02dd8>
Warning: Treating /Users/user/tmp/curl.rb as a formula.
==> Cloning https://github.com/curl/curl.git
Cloning into '/Users/user/Library/Caches/Homebrew/curl--git'...
==> Checking out branch master
Already on 'master'
Your branch is up to date with 'origin/master'.
==> ./buildconf
==> git clone --recursive https://github.com/cloudflare/quiche
==> cargo build --release --features pkg-config-meta,qlog
==> ./configure --prefix=/opt/homebrew/Cellar/curl/HEAD-4b4401e --with-secure-transport --without-ca-
Last 15 lines from /Users/user/Library/Logs/Homebrew/curl/04.configure:
checking for libnghttp2 options with pkg-config... found
configure: -l is -lnghttp2
configure: -I is -I/opt/homebrew/Cellar/nghttp2/1.43.0/include
configure: -L is -L/opt/homebrew/Cellar/nghttp2/1.43.0/lib
checking for nghttp2_session_set_local_window_size in -lnghttp2... yes
checking for nghttp2/nghttp2.h... yes
checking for pkg-config... (cached) /opt/homebrew/Library/Homebrew/shims/mac/super/pkg-config
checking for libngtcp2 options with pkg-config... no
checking for pkg-config... (cached) /opt/homebrew/Library/Homebrew/shims/mac/super/pkg-config
checking for quiche options with pkg-config... found
configure: -l is -lquiche
configure: -I is -I/private/tmp/curl-20210406-16525-fy62x7/quiche/include
configure: -L is -L/private/tmp/curl-20210406-16525-fy62x7/quiche/target/release
checking for quiche_connect in -lquiche... no
configure: error: couldn't use quiche

Do not report this issue to Homebrew/brew or Homebrew/core!

Traceback (most recent call last):
	25: from /opt/homebrew/Library/Homebrew/build.rb:227:in `<main>'
	24: from /opt/homebrew/Library/Homebrew/build.rb:134:in `install'
	23: from /opt/homebrew/Library/Homebrew/utils.rb:558:in `with_env'
	22: from /opt/homebrew/Library/Homebrew/build.rb:139:in `block in install'
	21: from /opt/homebrew/Library/Homebrew/formula.rb:1234:in `brew'
	20: from /opt/homebrew/Library/Homebrew/formula.rb:2280:in `stage'
	19: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/forwardable.rb:230:in `stage'
	18: from /opt/homebrew/Library/Homebrew/resource.rb:91:in `stage'
	17: from /opt/homebrew/Library/Homebrew/resource.rb:116:in `unpack'
	16: from /opt/homebrew/Library/Homebrew/resource.rb:198:in `mktemp'
	15: from /opt/homebrew/Library/Homebrew/mktemp.rb:63:in `run'
	14: from /opt/homebrew/Library/Homebrew/mktemp.rb:63:in `chdir'
	13: from /opt/homebrew/Library/Homebrew/mktemp.rb:63:in `block in run'
	12: from /opt/homebrew/Library/Homebrew/resource.rb:117:in `block in unpack'
	11: from /opt/homebrew/Library/Homebrew/download_strategy.rb:102:in `stage'
	10: from /opt/homebrew/Library/Homebrew/download_strategy.rb:110:in `chdir'
	 9: from /opt/homebrew/Library/Homebrew/resource.rb:121:in `block (2 levels) in unpack'
	 8: from /opt/homebrew/Library/Homebrew/formula.rb:2300:in `block in stage'
	 7: from /opt/homebrew/Library/Homebrew/utils.rb:558:in `with_env'
	 6: from /opt/homebrew/Library/Homebrew/formula.rb:2301:in `block (2 levels) in stage'
	 5: from /opt/homebrew/Library/Homebrew/formula.rb:1241:in `block in brew'
	 4: from /opt/homebrew/Library/Homebrew/build.rb:175:in `block (2 levels) in install'
	 3: from /Users/user/tmp/curl.rb:70:in `install'
	 2: from /opt/homebrew/Library/Homebrew/formula.rb:2073:in `system'
	 1: from /opt/homebrew/Library/Homebrew/formula.rb:2073:in `open'
/opt/homebrew/Library/Homebrew/formula.rb:2137:in `block in system': Failed executing: ./configure --disable-debug --disable-dependency-tracking --disable-silent-rules --prefix=/opt/homebrew/Cellar/curl/HEAD-4b4401e --with-secure-transport --without-ca-bundle --without-ca-path --with-ssl=/private/tmp/curl-20210406-16525-fy62x7/quiche/deps/boringssl/src --with-quiche=/private/tmp/curl-20210406-16525-fy62x7/quiche/target/release --enable-alt-svc (BuildError)
	5: from /opt/homebrew/Library/Homebrew/brew.rb:155:in `<main>'
	4: from /opt/homebrew/Library/Homebrew/brew.rb:167:in `rescue in <main>'
	3: from /opt/homebrew/Library/Homebrew/exceptions.rb:494:in `dump'
	2: from /opt/homebrew/Library/Homebrew/exceptions.rb:440:in `issues'
	1: from /opt/homebrew/Library/Homebrew/exceptions.rb:444:in `fetch_issues'
/opt/homebrew/Library/Homebrew/utils/github.rb:66:in `issues_for_formula': undefined method `full_name' for nil:NilClass (NoMethodError)
@GwynethLlewelyn
Copy link

Oh, this is weird; now I have exactly the same issue as described above, although I'm on an old Macbook Pro with an Intel chip!

Weirdly enough, the error which breaks the build:

checking for quiche_connect in -lquiche... no
configure: error: couldn't use quiche

... does not occur when building curl + quiche according to these instructions from the official curl repository (even though they allegedly use the same code...), which builds fine.

@frozenpandaman
Copy link

Cask '[...]' is unreadable: wrong constant name

I solved this by running the command with the --formula option:

brew install --formula --HEAD -s your-formula.rb

@xmlking
Copy link

xmlking commented Dec 4, 2021

still getting following error with brew install --formula --HEAD -s curl.rb

Env: Intel iMac

sw_vers
ProductName:	macOS
ProductVersion:	12.0.1
BuildVersion:	21A559

Error:

brew install --formula --HEAD -s curl.rb
==> Cloning https://github.com/curl/curl.git
Updating /Users/schintha/Library/Caches/Homebrew/curl--git
==> Checking out branch master
Already on 'master'
Your branch is up to date with 'origin/master'.
HEAD is now at de3911e9c RELEASE-NOTES: synced
==> autoreconf -fi
==> git clone --recursive https://github.com/cloudflare/quiche
Error: An exception occurred within a child process:
  Utils::Inreplace::Error: inreplace failed
Cargo.toml:
  expected replacement of /^crate-type = .*/ with "crate-type = [\"staticlib\"]"

@gaoyifan
Copy link

@xmlking
an upstream modification
cloudflare/quiche@bbe6e2a#diff-2e9d962a08321605940b5a657135052fbcef87b5e360662bb527c96d9a615542L75

lead to inreplace command failed

inreplace "Cargo.toml", /^crate-type = .*/, "crate-type = [\"staticlib\"]"

@therealgilles
Copy link

Is the temporary fix to comment out the inreplace line?

@gaoyifan
Copy link

gaoyifan commented Dec 15, 2021

@therealgilles It might work.

Sharing my workaround:

diff --git a/curl.rb b/curl.rb
index c216931..3572e72 100644
--- a/curl.rb
+++ b/curl.rb
@@ -39,7 +39,7 @@ class Curl < Formula
     system "autoreconf", "-fi" if build.head?

     # build boringssl
-    system "git", "clone", "--recursive", "https://github.com/cloudflare/quiche"
+    system "git", "clone", "--branch=0.10.0", "--recursive", "https://github.com/cloudflare/quiche"

     # build quiche
     cd "quiche" do

@crcastle
Copy link

I was getting the same error that @xmlking reported above on a 2020 Intel MBP (MacOS Monterey 12.1). @gaoyifan's suggestion allowed the build to complete successfully and curl to work with h3 / quic.

Brew build output
❯ brew install --formula --HEAD -s curl.rb
==> Cloning https://github.com/curl/curl.git
Updating /Users/crcastle/Library/Caches/Homebrew/curl--git
==> Checking out branch master
Already on 'master'
Your branch is up to date with 'origin/master'.
HEAD is now at 2c1dbc1af tests: Add test for CURLOPT_HTTP200ALIASES
==> autoreconf -fi
==> git clone --branch=0.10.0 --recursive https://github.com/cloudflare/quiche
==> cargo build --release --features ffi,pkg-config-meta,qlog
==> ./configure --prefix=/usr/local/Cellar/curl/HEAD-2c1dbc1 --with-secure-transport --without-ca-bundle --without-ca-path --with-ssl=/private/tmp/curl-202112
==> make install
==> make install -C scripts
==> Caveats
curl is keg-only, which means it was not symlinked into /usr/local,
because macOS already provides this software and installing another version in
parallel can cause all kinds of trouble.

If you need to have curl first in your PATH, run:
  echo 'fish_add_path /usr/local/opt/curl/bin' >> ~/.config/fish/config.fish

For compilers to find curl you may need to set:
  set -gx LDFLAGS "-L/usr/local/opt/curl/lib"
  set -gx CPPFLAGS "-I/usr/local/opt/curl/include"

For pkg-config to find curl you may need to set:
  set -gx PKG_CONFIG_PATH "/usr/local/opt/curl/lib/pkgconfig"


fish completions have been installed to:
  /usr/local/opt/curl/share/fish/vendor_completions.d
==> Summary
🍺  /usr/local/Cellar/curl/HEAD-2c1dbc1: 498 files, 9.1MB, built in 3 minutes 55 seconds
==> Running `brew cleanup curl`...
Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP.
Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).
Removing: /Users/crcastle/Library/Caches/Homebrew/curl--7.80.0... (1.2MB)
Removing: /Users/crcastle/Library/Caches/Homebrew/curl--7.80.0_1... (1.2MB)
Curl version output
❯ /usr/local/opt/curl/bin/curl --version
curl 7.81.0-DEV (x86_64-apple-darwin21.2.0) libcurl/7.81.0-DEV SecureTransport (BoringSSL) zlib/1.2.11 brotli/1.0.9 zstd/1.5.0 libidn2/2.3.2 quiche/0.10.0 librtmp/2.3
Release-Date: [unreleased]
Protocols: dict file ftp ftps gopher gophers http https imap imaps ldap ldaps mqtt pop3 pop3s rtmp rtsp smb smbs smtp smtps telnet tftp
Features: alt-svc AsynchDNS brotli HSTS HTTP3 IDN IPv6 Largefile libz MultiSSL NTLM NTLM_WB SSL UnixSockets zstd

I'm not sure it's the right long-term fix though, so hesitant to make a PR.

@junhochoi
Copy link
Contributor

curl.rb is updated (#43). Please try again.

@GwynethLlewelyn
Copy link

curl.rb is updated (#43). Please try again.

I can confirm that it works perfectly under my Mac! (macOS Big Sur 11.6.4 on a MacBook Pro (Retina, 15-inch, Mid 2014))

@dknecht dknecht closed this as completed Feb 7, 2022
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 a pull request may close this issue.

9 participants