build-emacs-for-macos icon indicating copy to clipboard operation
build-emacs-for-macos copied to clipboard

configure fails with `error: The following required libraries were not found: gnutls`

Open smithwinston opened this issue 3 years ago • 6 comments

For some reason build-emacs-for-macos started failing recently during the Emacs configure phase -- not being able to find gnutls:

bash-5.1$ ./build-emacs-for-macos --git-sha 8ed46b7646de7166aa8bbd3b5d29a4947316c900 feature/native-comp
==> INFO: Fetching info for git ref: 8ed46b7646de7166aa8bbd3b5d29a4947316c900
==> INFO: emacs-mirror-emacs-8ed46b7.tgz already exists locally, attempting to use.
==> INFO: emacs-mirror-emacs-8ed46b7 source tree exists, attempting to use.
==> CMD: ./autogen.sh
Checking whether you have the necessary tools...
(Read INSTALL.REPO for more details on building Emacs)
Checking for autoconf (need at least version 2.65) ... ok
Your system has the required tools.
Running 'autoreconf -fi -I m4' ...
You can now run './configure'.
==> INFO: Detecting native-comp support: Supported
==> INFO: Compiling from source. This will take a while...
==> INFO: Compiling with native-comp enabled
==> CMD: ./configure --with-ns --with-modules --enable-locallisppath=/Library/Application Support/Emacs/${version}/site-lisp:/Library/Application Support/Emacs/site-lisp --with-xwidgets --with-native-compilation --without-rsvg
checking for xcrun... xcrun
...
...
...
checking for GifMakeMapObject in -lgif... yes
configure: error: The following required libraries were not found:
     gnutls
Maybe some development libraries/packages are missing?
To build anyway, give:
     --with-gnutls=ifavailable
as options to configure.
ERROR: Exit code: 1

However it's definitely installed, it's listed in the Brewfile and I've manually reinstalled it:

bash-5.1$ brew list | grep gnutls
gnutls
bash-5.1$ pkg-config --list-all | grep gnutls
gnutls                              GnuTLS - Transport Security Layer implementation for the GNU system
gnutls-dane                         GnuTLS-DANE - DANE security library for the GNU system

This is macOS 10.15 Catalina with Xcode 12.4 and an up-to-date homebrew install:

bash-5.1$ sw_vers
ProductName:	Mac OS X
ProductVersion:	10.15.7
BuildVersion:	19H524

smithwinston avatar Apr 17 '21 04:04 smithwinston

Apologies for not getting back to you sooner. Have you had any luck solving this?

I'm afraid I've not seen this issue before, and I haven't been able to think of a way to re-produce it either.

Only thing I can think of is that might have some environment variable set in your shell in such a way that it interferes with Emacs' configure script. I would guess prime suspects would be CFLAGS, LDFLAGS, PKG_CONFIG_PATH, and LIBRARY_PATH.

jimeh avatar May 22 '21 20:05 jimeh

I never did figure it out and stuck with the previously working commit.

smithwinston avatar Jun 15 '21 00:06 smithwinston

Hmm, it seems the configure script runs this to determine if gnutls is available:

pkg-config --exists --print-errors 'gnutls >= 2.12.2'

On success it'll return a exit code of 0 and print nothing.

Potentially your gnutls is out of date? Otherwise I'd try to reinstall the gnutls homebrew formula for good measure:

brew reinstall gnutls

jimeh avatar Jun 16 '21 10:06 jimeh

@smithwinston is still is an issue for you? Did you manage to get it working?

jimeh avatar Nov 27 '21 05:11 jimeh

You may want to check that you have a usable pkg-config installed. That resolvedthe issue for me when I hit this problem.

nelo-congenica avatar Aug 30 '23 19:08 nelo-congenica

I had the same issue with emacs-plus@29 on a Mac Intel.

Issue

gnutls depends on the p11-kit package.

The command pkg-config --exists --print-errors 'gnutls >= 2.12.2' complained about the p11-kit-1 package :

Package p11-kit-1 was not found in the pkg-config search path. Perhaps you should add the directory containing `p11-kit-1.pc' to the PKG_CONFIG_PATH environment variable Package 'p11-kit-1', required by 'gnutls', not found

brew doctortold me this packages was installed, but not linked. However, I had another issue when I tried to link it :

Error: Could not symlink lib/pkcs11/p11-kit-client.so /usr/local/lib/pkcs11 is not writable.

Solution

  1. Make the folder writable (changing owner) : sudo chown -R `whoami`:admin /usr/local/lib
  2. Link p11-kit : brew link p11-kit
  3. Install emacs-plus as usual brew install emacs-plus --with-native-comp

mw4rf avatar Sep 19 '23 07:09 mw4rf