From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Alan Third Newsgroups: gmane.emacs.devel Subject: Re: ./configure --with-native-compilation on macos (11.5.2 Big Sur) Date: Fri, 10 Sep 2021 21:53:52 +0100 Message-ID: References: <6266D349-AE54-452E-AFE4-AA9BA52BE291@traduction-libre.org> <9DC1AA65-7DCF-439D-8891-8787C28F03D6@traduction-libre.org> <5F33DEC8-5272-41B7-A113-32A69A2E7357@traduction-libre.org> <4921CF13-07A1-48B2-8115-E74428B4020B@traduction-libre.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="bt7f9BUx4QTcoJtJ" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="30495"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Emacs Devel To: Jean-Christophe Helary Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Fri Sep 10 22:54:50 2021 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mOnXu-0007hf-8c for ged-emacs-devel@m.gmane-mx.org; Fri, 10 Sep 2021 22:54:50 +0200 Original-Received: from localhost ([::1]:48952 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mOnXs-0000Ok-RT for ged-emacs-devel@m.gmane-mx.org; Fri, 10 Sep 2021 16:54:48 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:42174) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mOnXA-0008Ay-JB for emacs-devel@gnu.org; Fri, 10 Sep 2021 16:54:04 -0400 Original-Received: from outbound.soverin.net ([2a01:4f8:fff0:65::8:228]:43587) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mOnX5-0007DA-Tb for emacs-devel@gnu.org; Fri, 10 Sep 2021 16:54:03 -0400 Original-Received: from smtp.soverin.net (unknown [10.10.3.24]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by outbound.soverin.net (Postfix) with ESMTPS id B0DF2A1; Fri, 10 Sep 2021 20:53:55 +0000 (UTC) Original-Received: from smtp.soverin.net (smtp.soverin.net [159.69.232.138]) by soverin.net DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=idiocy.org; s=soverin; t=1631307235; bh=5uFYkhHHFM/gSH+4Jc+Iz+NEEZtak5jLxV1c+9iiBc0=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=gZjjlmJZ+kcDvqYxzbWKrGs77FbNcOfKSn2zw7s3g2EsqKXGbYrZcvvnI8mTRmSPe k/a0pJVy6tgftX6qUE+40B5nWmC0jt/npbEAr6LY+alc2WT3hKmPOuN8RvGJuHHBAj 0JbLgZqYc2zacQxthSlLvx2TZPt2YW44oC9dX/+m52cs923Qn330/ltkNbmHeaMSnH 6KdBinfnIzFjBbufzRFilJgrQ+rpSvvRN6foTxzUOO7T2Lh0B2bDouG9APNEBEl67x yjnqKnLAwOChDQ7yaxfihkffcbAhhZnA8Orui8VCAL066vtUQaEodU/qqlsB72sXFv DIl6jZyhC/2hA== Original-Received: from alan by faroe.holly.idiocy.org with local (Exim 4.94.2) (envelope-from ) id 1mOnWy-001V3h-4I; Fri, 10 Sep 2021 21:53:52 +0100 Mail-Followup-To: Alan Third , Jean-Christophe Helary , Emacs Devel Content-Disposition: inline In-Reply-To: <4921CF13-07A1-48B2-8115-E74428B4020B@traduction-libre.org> Received-SPF: pass client-ip=2a01:4f8:fff0:65::8:228; envelope-from=alan@idiocy.org; helo=outbound.soverin.net X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:274527 Archived-At: --bt7f9BUx4QTcoJtJ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Fri, Sep 10, 2021 at 09:35:02AM +0900, Jean-Christophe Helary wrote: > > > > On Sep 10, 2021, at 6:07, Alan Third wrote: > > > > On Thu, Sep 09, 2021 at 08:44:47AM +0900, Jean-Christophe Helary wrote: > >> > >> And the third version of the patch you sent produced the same error... :( > >> > >> I have just totally removed brew and macports to remove all the > >> cruft and reinstalled only the packages that I needed (and their > >> dependencies). > > > > What about running > > > > HAVE_MACPORTS="" ./configure > > > > ? > > > > I have no idea if that will work. > > It did. > > :-) OK, at least we have a work-around. Can you try the attached patch. I noticed what I think is a mistake in setting up CFLAGS and LIBS for libgccjit, not just in macOS but generally, so I've fixed that and tidied the rest of the macOS code. -- Alan Third --bt7f9BUx4QTcoJtJ Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="0001-Fix-libgccjit-detection-on-macOS.patch" >From 3424621a2076b6cea03fa4a411168aa99ff60a06 Mon Sep 17 00:00:00 2001 From: Alan Third Date: Thu, 9 Sep 2021 22:33:01 +0100 Subject: [PATCH] Fix libgccjit detection on macOS * configure.ac: Combine the Homebrew and MacPorts detection so they will not create nonsense flags if both are installed. --- configure.ac | 64 ++++++++++++++++++++++++++++------------------------ 1 file changed, 34 insertions(+), 30 deletions(-) diff --git a/configure.ac b/configure.ac index 418a62fd5e..1146b581cd 100644 --- a/configure.ac +++ b/configure.ac @@ -3822,40 +3822,44 @@ AC_DEFUN AC_MSG_ERROR(['--with-native-compilation' requires zlib]) fi - # Ensure libgccjit installed by Homebrew can be found. - if test -n "$BREW"; then - if test -n "`$BREW --prefix --installed libgccjit 2>/dev/null`"; then - BREW_LIBGCCJIT_INCLUDE=$(dirname $($BREW ls -v libgccjit | \ - grep libgccjit.h)) - BREW_LIBGCCJIT_LIB=$(dirname $($BREW ls -v libgccjit| \ - grep libgccjit.so\$)) - CFLAGS="$CFLAGS -I${BREW_LIBGCCJIT_INCLUDE}" - LDFLAGS="$LDFLAGS -L${BREW_LIBGCCJIT_LIB}" + SAVE_CFLAGS=$CFLAGS + SAVE_LIBS=$LIBS + + if test "${opsys}" = "darwin"; then + # Ensure libgccjit installed by Homebrew or macports can be found. + if test -n "$BREW"; then + 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 libgccjit.so\$))" + fi fi - fi - # Ensure libgccjit installed by MacPorts can be found. - if test -n "$HAVE_MACPORTS"; then - # Determine which gcc version has been installed (gcc11, for - # instance). - PORT_PACKAGE=$(port installed active | grep '^ *gcc@<:@0-9@:>@* ' | \ - awk '{ print $1; }') - MACPORTS_LIBGCCJIT_INCLUDE=$(dirname $(port contents $PORT_PACKAGE | \ - grep libgccjit.h)) - MACPORTS_LIBGCCJIT_LIB=$(dirname $(port contents $PORT_PACKAGE | \ - grep libgccjit.dylib)) - CFLAGS="$CFLAGS -I${MACPORTS_LIBGCCJIT_INCLUDE}" - LDFLAGS="$LDFLAGS -L${MACPORTS_LIBGCCJIT_LIB}" + if test -n "$HAVE_MACPORTS"; then + # Determine which gcc version has been installed (gcc11, for + # instance). + PORT_PACKAGE=$(port installed active | grep '^ *gcc@<:@0-9@:>@* ' | \ + awk '{ print $1; }') + if test -n "$PORT_PACKAGE"; then + MAC_CFLAGS="-I$(dirname $(port contents $PORT_PACKAGE | \ + grep libgccjit.h))" + MAC_LIBS="-L$(dirname $(port contents $PORT_PACKAGE | \ + grep libgccjit.dylib))" + fi + fi + + if test -n "$MAC_CFLAGS" && test -n "$MAC_LIBS"; then + CFLAGS="$CFLAGS ${MAC_CFLAGS}" + LIBS="$LIBS ${MAC_LIBS}" + fi fi # Check if libgccjit is available. AC_CHECK_LIB(gccjit, gcc_jit_context_acquire, [], [libgccjit_not_found]) AC_CHECK_HEADERS(libgccjit.h, [], [libgccjit_dev_not_found]) - emacs_save_LIBS=$LIBS - LIBS="-lgccjit" # Check if libgccjit really works. AC_RUN_IFELSE([libgccjit_smoke_test], [], [libgccjit_broken]) - LIBS=$emacs_save_LIBS HAVE_NATIVE_COMP=yes case "${opsys}" in # mingw32 loads the library dynamically. @@ -3863,17 +3867,17 @@ AC_DEFUN # OpenBSD doesn't have libdl, all the functions are in libc netbsd|openbsd) LIBGCCJIT_LIBS="-lgccjit" ;; + darwin) + LIBGCCJIT_CFLAGS="${MAC_CFLAGS}" + LIBGCCJIT_LIBS="${MAC_LIBS} -lgccjit -ldl";; *) LIBGCCJIT_LIBS="-lgccjit -ldl" ;; esac NEED_DYNLIB=yes AC_DEFINE(HAVE_NATIVE_COMP, 1, [Define to 1 if native compiler is available.]) - # Ensure libgccjit installed by MacPorts can be found. - if test -n "$HAVE_MACPORTS"; then - LIBGCCJIT_CFLAGS="$LIBGCCJIT_CFLAGS -I${MACPORTS_LIBGCCJIT_INCLUDE}" - LIBGCCJIT_LIBS="-L${MACPORTS_LIBGCCJIT_LIB} $LIBGCCJIT_LIBS" - fi + CFLAGS=$SAVE_CFLAGS + LIBS=$SAVE_LIBS fi AC_DEFINE_UNQUOTED(NATIVE_ELISP_SUFFIX, ".eln", [System extension for native compiled elisp]) -- 2.30.2 --bt7f9BUx4QTcoJtJ--