unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Naofumi Yasufuku <naofumi@yasufuku.dev>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 57015@debbugs.gnu.org
Subject: bug#57015: 29.0.50; macOS: libgccjit was not found: Homebrew libgccjit 12.1.0
Date: Sun, 07 Aug 2022 00:13:23 +0900	[thread overview]
Message-ID: <m1o7wxxv58.fsf@yasufuku.dev> (raw)
In-Reply-To: <834jypzi1b.fsf@gnu.org>

[-- Attachment #1: Type: text/plain, Size: 1809 bytes --]

Hi Eli,

Eli Zaretskii <eliz@gnu.org> writes:
>> From: Naofumi Yasufuku <naofumi@yasufuku.dev>
>> Date: Sat, 06 Aug 2022 20:38:58 +0900
>> 
>> './configure --with-native-compilation' fails if Homebrew libgccjit is
>> updated to 12.1.0.  Attached configure.ac patch fixes this issue.
>> I think the same patch should be applied to emacs-28 branch.
>
> I don't mind installing this on master, but I'd rather document that
> Emacs 28 cannot be built on macOS with such a new libgccjit than
> destabilize the release branch, even if it's only for macOS.  E.g.,
> who says that 'readlink' will always be available on macOS?

Thank you for your indication.  readlink '-f' option is not supported
by BSD-based readlink shipped with old macOS.  Revised patch is
attached.  This patch just choose 'current/libgccjit.dylib' from
multiple libgccjit.dylib paths.

--8<---------------cut here---------------start------------->8---
$ brew ls -v libgccjit | grep -E 'libgccjit\.(so|dylib)$'
/usr/local/Cellar/libgccjit/12.1.0/lib/gcc/current/libgccjit.dylib
/usr/local/Cellar/libgccjit/12.1.0/lib/gcc/12/libgccjit.dylib
$
$ ls -lR /usr/local/Cellar/libgccjit/12.1.0/lib/gcc
total 0
drwxr-xr-x  4 naofumi  admin  128 May  6 16:53 12
drwxr-xr-x  4 naofumi  admin  128 May  6 16:53 current

/usr/local/Cellar/libgccjit/12.1.0/lib/gcc/12:
total 0
lrwxr-xr-x  1 naofumi  admin  28 May  6 16:53 libgccjit.0.dylib -> ../current/libgccjit.0.dylib
lrwxr-xr-x  1 naofumi  admin  26 May  6 16:53 libgccjit.dylib -> ../current/libgccjit.dylib

/usr/local/Cellar/libgccjit/12.1.0/lib/gcc/current:
total 82304
-rw-r--r--  1 naofumi  admin  42138352 Aug  6 18:06 libgccjit.0.dylib
lrwxr-xr-x  1 naofumi  admin        17 May  6 16:53 libgccjit.dylib -> libgccjit.0.dylib
$
--8<---------------cut here---------------end--------------->8---


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: patch #2 --]
[-- Type: text/x-patch, Size: 1537 bytes --]

From 3757f2e69c8aeb392377a83b7b1d06fc401cc8ff Mon Sep 17 00:00:00 2001
From: Naofumi Yasufuku <naofumi@yasufuku.dev>
Date: Sat, 6 Aug 2022 22:10:36 +0900
Subject: [PATCH] Fix libgccjit library path lookup for Homebrew libgccjit
 12.1.0 and above

* configure.ac: Choose the first match from multiple libgccjit.dylib
paths in 'brew ls -v libgccjit' output.  Prefer 'current/libgccjit.dylib'
over '${ver}/libgccjit.dylib'  (Bug#57015)
---
 configure.ac | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/configure.ac b/configure.ac
index 1a264275bd..55dcb93f9a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -4240,8 +4240,15 @@ AC_DEFUN
         if test -n "`$BREW --prefix --installed libgccjit 2>/dev/null`"; then
           MAC_CFLAGS="-I$(dirname $($BREW ls -v libgccjit | \
                                                 grep libgccjit.h))"
-          MAC_LIBS="-L$(dirname $($BREW ls -v libgccjit| \
-                                            grep -E 'libgccjit\.(so|dylib)$'))"
+          MAC_LIBS="-L$(dirname $($BREW ls -v libgccjit | \
+                                  grep -E 'current/libgccjit\.(so|dylib)$' | \
+                                  head -1))"
+          if test "${MAC_LIBS}" = "-L"; then
+            # Try for Homebrew libgccjit < 12.1.0.
+            MAC_LIBS="-L$(dirname $($BREW ls -v libgccjit | \
+                                    grep -E 'libgccjit\.(so|dylib)$' | \
+                                    head -1))"
+          fi
         fi
       fi
 
-- 
2.37.1


[-- Attachment #3: Type: text/plain, Size: 6559 bytes --]


>
> Is it really a problem to use only libgccjit 12.0 and older for the
> release branch?
>

No.  This libgccjit.dylib path problem is specific for the situation of
Homebrew libgccjit 12.1.0 and above.  I found that this problem is
caused by the following Homebrew change:

https://github.com/Homebrew/homebrew-core/commit/eb60b7d88a5bc4ffdff8859e88c4c11f5f403167#diff-14dead016a29e43c6e17b0e951d2a23e62156cf732e7d6d2cf603934397e8670R52

--8<---------------cut here---------------start------------->8---
eb60b7d88a5bc4ffdff8859e88c4c11f5f403167
Author:     Francois-Xavier Coudert <fxcoudert@gmail.com>
AuthorDate: Fri Apr 29 23:47:04 2022 +0200
Commit:     BrewTestBot <1589480+BrewTestBot@users.noreply.github.com>
CommitDate: Fri Aug 5 14:27:51 2022 +0000

Parent:     39c1b9e gcc 12.1.0
Contained:  master

libgccjit 12.1.0

- align with GCC lib dir
--8<---------------cut here---------------end--------------->8---

--8<---------------cut here---------------start------------->8---
+    # Use `lib/gcc/current` to align with the GCC formula.
     args = %W[
       --prefix=#{prefix}
-      --libdir=#{lib}/gcc/#{version.major}
+      --libdir=#{lib}/gcc/current
--8<---------------cut here---------------end--------------->8---


But, unfortunately, macOS Homebrew users have no way to keep installing
libgccjit 11.x at the moment.  Yes, its just a matter of maintaining 
Homebrew libgccjit package... :-< 

gcc packages are maintaned as gcc@VERSION, but libgccjit is not:

--8<---------------cut here---------------start------------->8---
$ brew search gcc
==> Formulae
aarch64-elf-gcc     gcc@5               i686-elf-gcc        scc
gcc ✔               gcc@6               libgccjit ✔         tcc
gcc@10              gcc@7               x86_64-elf-gcc      ncc
gcc@11              gcc@8               grc
gcc@4.9             gcc@9               ghc ✔

==> Casks
gcc-aarch64-embedded                     gcs
gcc-arm-embedded                         icc
$
--8<---------------cut here---------------start------------->8---


--8<---------------cut here---------------start------------->8---
$ ./emacs/28/bin/emacs-28.1.91
dyld[40808]: Library not loaded: '/usr/local/opt/libgccjit/lib/gcc/11/libgccjit.0.dylib'
  Referenced from: '/Users/naofumi/.local/emacs/28/bin/emacs-28.1.91'
  Reason: tried: '/usr/local/opt/libgccjit/lib/gcc/11/libgccjit.0.dylib' (no such file), '/usr/local/lib/libgccjit.0.dylib' (no such file), '/usr/lib/libgccjit.0.dylib' (no such file)
zsh: abort      ./emacs/28/bin/emacs-28.1.91
$
$ otool -L ./emacs/28/bin/emacs-28.1.91
emacs/28/bin/emacs-28.1.91:
        /System/Library/Frameworks/AppKit.framework/Versions/C/AppKit (compatibility version 45.0.0, current version 2113.40.126)
        /System/Library/Frameworks/IOKit.framework/Versions/A/IOKit (compatibility version 1.0.0, current version 275.0.0)
        /System/Library/Frameworks/Carbon.framework/Versions/A/Carbon (compatibility version 2.0.0, current version 165.0.0)
        /System/Library/Frameworks/IOSurface.framework/Versions/A/IOSurface (compatibility version 1.0.0, current version 1.0.0)
        /System/Library/Frameworks/QuartzCore.framework/Versions/A/QuartzCore (compatibility version 1.2.0, current version 1.11.0)
        /usr/local/opt/libtiff/lib/libtiff.5.dylib (compatibility version 14.0.0, current version 14.0.0)
        /usr/local/opt/jpeg/lib/libjpeg.9.dylib (compatibility version 15.0.0, current version 15.0.0)
        /usr/local/opt/libpng/lib/libpng16.16.dylib (compatibility version 54.0.0, current version 54.0.0)
        /usr/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.11)
        /usr/local/opt/giflib/lib/libgif.dylib (compatibility version 0.0.0, current version 7.2.0)
        /usr/local/opt/librsvg/lib/librsvg-2.2.dylib (compatibility version 51.0.0, current version 51.0.0)
        /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1311.100.3)
        /usr/local/opt/glib/lib/libgio-2.0.0.dylib (compatibility version 7201.0.0, current version 7201.3.0)
        /usr/local/opt/gdk-pixbuf/lib/libgdk_pixbuf-2.0.0.dylib (compatibility version 4201.0.0, current version 4201.8.0)
        /usr/local/opt/glib/lib/libgobject-2.0.0.dylib (compatibility version 7201.0.0, current version 7201.3.0)
        /usr/local/opt/glib/lib/libglib-2.0.0.dylib (compatibility version 7201.0.0, current version 7201.3.0)
        /usr/local/opt/gettext/lib/libintl.8.dylib (compatibility version 11.0.0, current version 11.0.0)
        /usr/local/opt/cairo/lib/libcairo.2.dylib (compatibility version 11603.0.0, current version 11603.0.0)
        /System/Library/Frameworks/WebKit.framework/Versions/A/WebKit (compatibility version 1.0.0, current version 613.1.17)
        /usr/lib/libxml2.2.dylib (compatibility version 10.0.0, current version 10.9.0)
        /usr/lib/libncurses.5.4.dylib (compatibility version 5.4.0, current version 5.4.0)
        /usr/local/opt/gnutls/lib/libgnutls.30.dylib (compatibility version 64.0.0, current version 64.1.0)
        /usr/local/opt/little-cms2/lib/liblcms2.2.dylib (compatibility version 3.0.0, current version 3.13.0)
        /usr/local/opt/jansson/lib/libjansson.4.dylib (compatibility version 19.0.0, current version 19.0.0)
        /usr/local/opt/gmp/lib/libgmp.10.dylib (compatibility version 15.0.0, current version 15.1.0)
        /usr/local/opt/libgccjit/lib/gcc/11/libgccjit.0.dylib (compatibility version 0.0.0, current version 0.0.1)
        /System/Library/Frameworks/CFNetwork.framework/Versions/A/CFNetwork (compatibility version 1.0.0, current version 1331.0.7)
        /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 1858.112.0)
        /System/Library/Frameworks/CoreGraphics.framework/Versions/A/CoreGraphics (compatibility version 64.0.0, current version 1557.5.4)
        /System/Library/Frameworks/CoreServices.framework/Versions/A/CoreServices (compatibility version 1.0.0, current version 1141.1.0)
        /System/Library/Frameworks/CoreText.framework/Versions/A/CoreText (compatibility version 1.0.0, current version 1.0.0)
        /System/Library/Frameworks/Foundation.framework/Versions/C/Foundation (compatibility version 300.0.0, current version 1858.112.0)
        /usr/lib/libobjc.A.dylib (compatibility version 1.0.0, current version 228.0.0)
$
--8<---------------cut here---------------end--------------->8---


Regards,
  Naofumi

  reply	other threads:[~2022-08-06 15:13 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-06 11:38 bug#57015: 29.0.50; macOS: libgccjit was not found: Homebrew libgccjit 12.1.0 Naofumi Yasufuku
2022-08-06 12:13 ` Eli Zaretskii
2022-08-06 15:13   ` Naofumi Yasufuku [this message]
     [not found]     ` <m1les1xrag.fsf@yasufuku.dev>
2022-08-06 16:44       ` Eli Zaretskii
2022-08-06 18:30         ` Naofumi Yasufuku
2022-08-08  6:03         ` bug#57015: bug#57029: macos cannot build emacs after updated gcc and libgccjit to 12.1 Gerd Möllmann
2022-08-08  8:08           ` Andreas Schwab
2022-08-08 12:57             ` Gerd Möllmann
2022-08-07  9:57   ` bug#57015: 29.0.50; macOS: libgccjit was not found: Homebrew libgccjit 12.1.0 Stefan Kangas
2022-08-07 10:24     ` Eli Zaretskii
2022-08-07 10:57       ` Stefan Kangas
2022-08-07 11:32         ` Eli Zaretskii
2022-08-07 12:03           ` Stefan Kangas
2022-08-07 12:55         ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-08-07 13:14           ` Eli Zaretskii
2022-08-07 13:52             ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-08-07 14:26             ` Stefan Kangas
2022-08-07 14:32               ` Eli Zaretskii
2022-08-08  6:23               ` bug#57015: bug#57029: macos cannot build emacs after updated gcc and libgccjit to 12.1 Gerd Möllmann
2022-08-07 12:58     ` Lars Ingebrigtsen
2022-08-09 15:33 ` bug#57015: 29.0.50; macOS: libgccjit was not found: Homebrew libgccjit 12.1.0 Dario Gjorgjevski
2022-08-10 14:42   ` Naofumi Yasufuku
2022-08-10 15:52     ` Eli Zaretskii
2022-08-10 16:14       ` Stefan Kangas
2022-08-11 16:20         ` Eli Zaretskii
2022-08-16 13:28           ` Dario Gjorgjevski
2022-08-16 13:44             ` Eli Zaretskii
2022-08-16 13:58               ` Dario Gjorgjevski
2022-08-16 14:08                 ` Eli Zaretskii
2022-08-16 14:17                   ` Dario Gjorgjevski
2022-08-16 14:32                 ` Stefan Kangas
2022-08-16 15:08                   ` Dario Gjorgjevski
2022-08-16 15:48                     ` Stefan Kangas
2022-08-16 15:52                   ` Eli Zaretskii
2022-08-19  7:24                     ` bug#57015: bug#57029: macos cannot build emacs after updated gcc and libgccjit to 12.1 Gerd Möllmann
2022-08-19  7:38                       ` Eli Zaretskii
2022-08-19  9:05                         ` Gerd Möllmann
2022-09-05 18:43                           ` Lars Ingebrigtsen
     [not found] <5F111D5A-02D2-438E-B469-1C602BF8D00E@gmail.com>
2022-08-06 15:03 ` bug#57015: 29.0.50; macOS: libgccjit was not found: Homebrew libgccjit 12.1.0 Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m1o7wxxv58.fsf@yasufuku.dev \
    --to=naofumi@yasufuku.dev \
    --cc=57015@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).