jimeh / build-emacs-for-macos

Somewhat hacky script to automate building of Emac.app on macOS.
475 stars 51 forks source link

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

Open smithwinston opened 3 years ago

smithwinston commented 3 years ago

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
jimeh commented 3 years ago

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.

smithwinston commented 3 years ago

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

jimeh commented 3 years ago

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 commented 2 years ago

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

nelo-congenica commented 1 year ago

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

mw4rf commented 12 months ago

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
Colelyman commented 1 month ago

I was able to resolve this on M1 Mac by installing pkg-utils (brew install pkg-utils).

thynus commented 1 month ago

on Mac Book Air M3 macos 14.6

configure: WARNING: Unable to locate a usable pkg-config configure: error: The following required libraries were not found: gnutls

gnutls or gnuntls-dev did not fix. Resolved by sudo port install pkgconfig

jimeh commented 1 month ago

Hmmm, if you run make bootstrap it will install all required dependencies, both Ruby and Homebrew packages. The latter does include pkg-config.

You can look at the Brewfile to see Homebrew dependencies, and Gemfile for Ruby dependencies.

thynus commented 1 month ago

Hmmm, if you run make bootstrap it will install all required dependencies, both Ruby and Homebrew packages. The latter does include pkg-config.

You can look at the Brewfile to see Homebrew dependencies, and Gemfile for Ruby dependencies.

will try 'make bootstrap' ; I am on a macport system and they call the package pkgconfig

jimeh commented 1 month ago

@thynus Ah, I'm afraid you're a bit on your own then, cause the build script is quite tightly integrated with Homebrew, and not just via the use of a Brewfile.

For example, one of the final steps the build script does to make the Emacs.app bundle as self-contained as possible is to embed all external shared libraries located within Homebrew into the app bundle.

So you might need to tweak things a bit for the build script to properly detect shared libraries linked to via macports.