Homebrew-core: gnutls install with --build-from-source fails on 10.15.4

Created on 30 Mar 2020  路  12Comments  路  Source: Homebrew/homebrew-core

Please note we will close your issue without comment if you delete, do not read or do not fill out the issue checklist below and provide ALL the requested information. If you repeatedly fail to use the issue template, we will block you from ever submitting issues to Homebrew again.

  • [X] ran brew update and can still reproduce the problem?
  • [X] ran brew doctor, fixed all issues and can still reproduce the problem?
  • [X] ran brew gist-logs <formula> (where <formula> is the name of the formula that failed) and included the output link?

brew gist-logs output is:
Error: Not Found

  • [X] if brew gist-logs didn't work: ran brew config and brew doctor and included their output with your issue?

Here is the gist with brew config; brew doctor; and brew install ... output:

https://gist.github.com/dbart/f86efefabbeedeccafc5a1a8fc6e57fa

What you were trying to do (and why)

Eventually I want to compile a static gnutls library. The default recipe includes --disable-static, so eventually I will use brew edit gnutls to change that option to --enable-static, but before I do that it should be able to actually compile with no changes, so for now I'm running brew install --build-from-source gnutls with no changes to the gnutls recipe.

Based on https://github.com/Homebrew/homebrew-core/issues/2938 I ran

xcode-select --install but the command-line tools are already installed, and brew reinstall nettle but that doesn't change the outcome. I've included the output of these commands in the command output section below.

What happened (include command output)

clang throws an error


Command output

legolas:~ admin$ brew install --build-from-source gnutls
==> Downloading https://www.gnupg.org/ftp/gcrypt/gnutls/v3.6/gnutls-3.6.12.tar.xz

################################################################## 100.0%

==> ./configure --disable-static --prefix=/usr/local/Cellar/gnutls/3.6.12 --sysconfdir=/usr/local/etc --with-default-trust-store-file=/usr/local/etc/openssl/cert.pem --disable-guile --disable-heartbeat-support --with-p11-kit gl_cv_func_ft
==> make install
Last 15 lines from /Users/admin/Library/Logs/Homebrew/gnutls/02.make:
ld: weak import of symbol '___darwin_check_fd_set_overflow' not supported because of option: -no_weak_imports for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[3]: * [gnutls-cli-debug] Error 1
make[3]:
Waiting for unfinished jobs....
libtool: link: clang -fno-common -W -Wabsolute-value -Waddress -Waddress-of-packed-member -Wall -Wattributes -Wbad-function-cast -Wbuiltin-macro-redefined -Wcast-align -Wchar-subscripts -Wcomment -Wcomments -Wcpp -Wdangling-else -Wdate-time -Wdeprecated -Wdeprecated-declarations -Wdisabled-optimization -Wdiv-by-zero -Wdouble-promotion -Wduplicate-decl-specifier -Wempty-body -Wendif-labels -Wenum-compare -Wexpansion-to-defined -Wextra -Wformat-extra-args -Wformat-security -Wformat-zero-length -Wignored-attributes -Wignored-qualifiers -Wimplicit -Wimplicit-function-declaration -Wimplicit-int -Wincompatible-pointer-types -Winit-self -Wint-conversion -Wint-to-pointer-cast -Winvalid-pch -Wlogical-not-parentheses -Wmain -Wmemset-transposed-args -Wmissing-braces -Wmissing-declarations -Wmissing-field-initializers -Wmissing-include-dirs -Wmissing-prototypes -Wmultichar -Wnarrowing -Wnested-externs -Wnonnull -Wnull-dereference -Wodr -Wold-style-definition -Woverflow -Woverride-init -Wpacked -Wparentheses -Wpointer-arith -Wpointer-sign -Wpointer-to-int-cast -Wpragmas -Wreturn-type -Wsequence-point -Wshadow -Wshift-count-negative -Wshift-count-overflow -Wshift-negative-value -Wsizeof-array-argument -Wsizeof-pointer-div -Wsizeof-pointer-memaccess -Wstrict-aliasing -Wstrict-prototypes -Wswitch -Wswitch-bool -Wtautological-compare -Wtrigraphs -Wtype-limits -Wuninitialized -Wunknown-pragmas -Wunused -Wunused-function -Wunused-label -Wunused-local-typedefs -Wunused-parameter -Wunused-result -Wunused-value -Wunused-variable -Wvarargs -Wvariadic-macros -Wvolatile-register-var -Wwrite-strings -Wno-missing-field-initializers -Wno-unused-parameter -fdiagnostics-show-option -g -O2 -Wl,-no_weak_imports -o .libs/gnutls-serv serv.o udp-serv.o common.o -Wl,-framework -Wl,CoreFoundation ../lib/.libs/libgnutls.dylib -L/usr/local/Cellar/p11-kit/0.23.20/lib -lp11-kit -lidn2 -lunistring -L/usr/local/Cellar/libtasn1/4.16.0/lib -ltasn1 -L/usr/local/Cellar/nettle/3.4.1/lib -lnettle -lhogweed -lgmp ./.libs/libcmd-serv.a libopts/.libs/libopts.a ../gl/.libs/libgnu.a gl/.libs/libgnu_gpl.a -lintl -framework CoreFoundation -framework Security
ld: weak import of symbol '___darwin_check_fd_set_overflow' not supported because of option: -no_weak_imports for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[3]:
[gnutls-serv] Error 1
libtool: link: clang -fno-common -W -Wabsolute-value -Waddress -Waddress-of-packed-member -Wall -Wattributes -Wbad-function-cast -Wbuiltin-macro-redefined -Wcast-align -Wchar-subscripts -Wcomment -Wcomments -Wcpp -Wdangling-else -Wdate-time -Wdeprecated -Wdeprecated-declarations -Wdisabled-optimization -Wdiv-by-zero -Wdouble-promotion -Wduplicate-decl-specifier -Wempty-body -Wendif-labels -Wenum-compare -Wexpansion-to-defined -Wextra -Wformat-extra-args -Wformat-security -Wformat-zero-length -Wignored-attributes -Wignored-qualifiers -Wimplicit -Wimplicit-function-declaration -Wimplicit-int -Wincompatible-pointer-types -Winit-self -Wint-conversion -Wint-to-pointer-cast -Winvalid-pch -Wlogical-not-parentheses -Wmain -Wmemset-transposed-args -Wmissing-braces -Wmissing-declarations -Wmissing-field-initializers -Wmissing-include-dirs -Wmissing-prototypes -Wmultichar -Wnarrowing -Wnested-externs -Wnonnull -Wnull-dereference -Wodr -Wold-style-definition -Woverflow -Woverride-init -Wpacked -Wparentheses -Wpointer-arith -Wpointer-sign -Wpointer-to-int-cast -Wpragmas -Wreturn-type -Wsequence-point -Wshadow -Wshift-count-negative -Wshift-count-overflow -Wshift-negative-value -Wsizeof-array-argument -Wsizeof-pointer-div -Wsizeof-pointer-memaccess -Wstrict-aliasing -Wstrict-prototypes -Wswitch -Wswitch-bool -Wtautological-compare -Wtrigraphs -Wtype-limits -Wuninitialized -Wunknown-pragmas -Wunused -Wunused-function -Wunused-label -Wunused-local-typedefs -Wunused-parameter -Wunused-result -Wunused-value -Wunused-variable -Wvarargs -Wvariadic-macros -Wvolatile-register-var -Wwrite-strings -Wno-missing-field-initializers -Wno-unused-parameter -fdiagnostics-show-option -g -O2 -Wl,-no_weak_imports -o .libs/gnutls-cli cli.o common.o socket.o benchmark-cipher.o benchmark.o benchmark-tls.o ocsptool-common.o -Wl,-framework -Wl,CoreFoundation ../lib/.libs/libgnutls.dylib -L/usr/local/Cellar/p11-kit/0.23.20/lib -L/usr/local/Cellar/libtasn1/4.16.0/lib -L/usr/local/Cellar/nettle/3.4.1/lib -lm ../libdane/.libs/libgnutls-dane.dylib /private/tmp/gnutls-20200330-63870-c9h72u/gnutls-3.6.12/lib/.libs/libgnutls.dylib -lp11-kit -lidn2 -lunistring -ltasn1 -lnettle -lhogweed -lgmp -lunbound ./.libs/libcmd-cli.a libopts/.libs/libopts.a ../gl/.libs/libgnu.a gl/.libs/libgnu_gpl.a -lintl -framework CoreFoundation -framework Security
ld: weak import of symbol '___darwin_check_fd_set_overflow' not supported because of option: -no_weak_imports for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[3]:
[gnutls-cli] Error 1
make[2]:
[install-recursive] Error 1
make[1]:
[install] Error 2
make: *
* [install-recursive] Error 1

READ THIS: https://docs.brew.sh/Troubleshooting

legolas:~ admin$ pkg-config --libs hogweed
-L/usr/local/Cellar/nettle/3.4.1/lib -lhogweed

legolas:~ admin$ ls -l /usr/local/Cellar/nettle/3./lib/libhogweed
-rw-r--r-- 1 admin staff 210260 Mar 30 15:04 /usr/local/Cellar/nettle/3.4.1/lib/libhogweed.4.5.dylib
lrwxr-xr-x 1 admin staff 20 Dec 4 2018 /usr/local/Cellar/nettle/3.4.1/lib/libhogweed.4.dylib -> libhogweed.4.5.dylib
-r--r--r-- 1 admin staff 346192 Dec 4 2018 /usr/local/Cellar/nettle/3.4.1/lib/libhogweed.a
lrwxr-xr-x 1 admin staff 20 Dec 4 2018 /usr/local/Cellar/nettle/3.4.1/lib/libhogweed.dylib -> libhogweed.4.5.dylib

legolas:~ admin$ xcode-select --install
xcode-select: error: command line tools are already installed, use "Software Update" to install updates

legolas:~ admin$ brew reinstall nettle
==> Reinstalling nettle
==> Downloading https://homebrew.bintray.com/bottles/nettle-3.4.1.catalina.bottle.tar.gz
==> Downloading from https://akamai.bintray.com/33/338da826ad5127a98f1658c01f2bd128aa9383b3581c9beebc0f0ebc88b0d089?__gda__=exp=1585595813~hmac=41c40dfd2304c616ea5ccdb81af37a1bf501b6d91efbb3ce3980fbe27fa0c72f&response-content-disposition=

################################################################## 100.0%

==> Pouring nettle-3.4.1.catalina.bottle.tar.gz
馃嵑 /usr/local/Cellar/nettle/3.4.1: 85 files, 2.1MB


What you expected to happen

I expected brew to compile and install gnutls.

Step-by-step reproduction instructions (by running brew install commands)

brew install --build-from-source gnutls

outdated

Most helpful comment

I was able to get it to install by changing the make line in gnutls.rb to:

    system "make", "LDFLAGS=", "install"

FWIW. This wasn't quite as brute-force as it may sound: the offending flag was the only thing in LDFLAGS in the Makefile.

All 12 comments

I have seen this in erlang too. To be honest, I have no idea why yet. It's possibly because of Xcode 11.4 rather than 10.15.4.

I've run into this as well. I'm using Xcode 11.3.1, not 11.4.

Unfortunately, there isn't much we can do from Homebrew's side. It would be worth reporting the issue to GnuTLS and/or Apple.

Erlang have fixed it on their side in the upcoming 22.3.1.

So if gnutls can't be built from source in homebrew, how is homebrew able to provide gnutls at all? What magic is the homebrew team doing to compile gnutls and package it? Are they just building it with an older version of MacOS / XCode?

The last time we needed to compile GnuTLS, Xcode 11.4 wasn't released. It would only be an issue if a GnuTLS update was released... which looking at their website was yesterday.

So we are indeed unable to provide the latest version until we find a way to solve this problem or upstream patches it.

Ok, thanks. I'll look into filing a bug with gnutls, if they don't have one for this already.

It looks like some other projects had similar problems and fixed it like this. Not sure if that's enough though.

The fixes in other projects seem to be disabling a linker option that is added and on by default in Homebrew (https://github.com/Homebrew/homebrew-core/issues/3727 has context, commits in https://github.com/Homebrew/brew/pull/721). Go ran into something similar about 4 years ago, and worked around it in Homebrew, according to https://github.com/golang/go/issues/16770 (commit https://github.com/Homebrew/brew/commit/31052a924f2d39df69a0e202972b5a9806ff5ac8).

Homebrew/brew@31052a9 made it opt-in, so it is not on by default anymore and hasn't been for a long time.

It's explicitly enabled by GnuTLS itself: https://gitlab.com/gnutls/gnutls/-/blob/5b595e8e52653f6c5726a4cdd8fddeb6e83804d2/configure.ac#L123-133

Aha, I see; sorry, I misread the diff. I reported the issue upstream: https://gitlab.com/gnutls/gnutls/-/issues/966

I was able to get it to install by changing the make line in gnutls.rb to:

    system "make", "LDFLAGS=", "install"

FWIW. This wasn't quite as brute-force as it may sound: the offending flag was the only thing in LDFLAGS in the Makefile.

@dabrahams I've create a MR with the code change you mentioned. Could you review it?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

gregvirgin picture gregvirgin  路  3Comments

kiendang picture kiendang  路  3Comments

ghost picture ghost  路  3Comments

tglawless picture tglawless  路  3Comments

jakepetroules picture jakepetroules  路  3Comments