From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: David Reitter Newsgroups: gmane.emacs.bugs Subject: bug#27810: NS runtime feature detection Date: Tue, 12 Sep 2017 16:06:20 -0400 Message-ID: References: <20170812155115.GA14919@breton.holly.idiocy.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 (Mac OS X Mail 10.3 \(3273\)) Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: blaine.gmane.org 1505246849 6472 195.159.176.226 (12 Sep 2017 20:07:29 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 12 Sep 2017 20:07:29 +0000 (UTC) Cc: "Charles A. Roelli" , 27810@debbugs.gnu.org, david+emacsformacosx@porkrind.org, Anders Lindgren , David Caldwell To: Alan Third Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Sep 12 22:07:19 2017 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1drrSc-0000cM-2H for geb-bug-gnu-emacs@m.gmane.org; Tue, 12 Sep 2017 22:07:06 +0200 Original-Received: from localhost ([::1]:38367 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1drrSj-0002jx-1B for geb-bug-gnu-emacs@m.gmane.org; Tue, 12 Sep 2017 16:07:13 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:59298) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1drrSc-0002hm-Sd for bug-gnu-emacs@gnu.org; Tue, 12 Sep 2017 16:07:08 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1drrSY-0006bp-LH for bug-gnu-emacs@gnu.org; Tue, 12 Sep 2017 16:07:06 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:55925) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1drrSY-0006bh-HF for bug-gnu-emacs@gnu.org; Tue, 12 Sep 2017 16:07:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1drrSX-0001iZ-M8 for bug-gnu-emacs@gnu.org; Tue, 12 Sep 2017 16:07:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: David Reitter Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 12 Sep 2017 20:07:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 27810 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 27810-submit@debbugs.gnu.org id=B27810.15052467896562 (code B ref 27810); Tue, 12 Sep 2017 20:07:01 +0000 Original-Received: (at 27810) by debbugs.gnu.org; 12 Sep 2017 20:06:29 +0000 Original-Received: from localhost ([127.0.0.1]:36373 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1drrS0-0001hm-Qj for submit@debbugs.gnu.org; Tue, 12 Sep 2017 16:06:29 -0400 Original-Received: from mail-io0-f178.google.com ([209.85.223.178]:37720) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1drrRz-0001hZ-PK for 27810@debbugs.gnu.org; Tue, 12 Sep 2017 16:06:28 -0400 Original-Received: by mail-io0-f178.google.com with SMTP id j141so54397632ioj.4 for <27810@debbugs.gnu.org>; Tue, 12 Sep 2017 13:06:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=kFYA0SE1ZE4QQY0xp492WCuhNToPrFEROFXsT3FJVrI=; b=rOZV1ErVnenjNtt9bMZplicBJ6Dw85XpBy/7sd2uKnOKRqXNlllU4wHjne8AaJRoKp H7PWY1PAbo+hapFHX3aGmEAtU9aTV2UIGkGs8IRcmNhqAdS7YldFI/b26lrQYiQybNcm tWgoaqkkNB1RGsNX9n2VpwXqIWwZIxaSds5HZ0dBcbfzhqrBJG8+c9/V8LxTQNdu/wZ6 mvUdltkfC8UwFSqVxCtMN1Rq4LztvtRcKzrFdF3HZGbzwvgRLjmb930BGCL5wkpV7/Ht FoDtanJjIdoTvf5n6mSgBtbyEgbZ4apJcjhRvqXD8BTvygadXWtZMm5LLr9p2eZVYAdd tDaQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=kFYA0SE1ZE4QQY0xp492WCuhNToPrFEROFXsT3FJVrI=; b=fj18JaEZotZUT4GIEAq8UNaGk3T4x41Pt2A9AF7GsH0tjmvvOl1ZtnggGCD9NYbN1K shuXLixNJnUGW3a2YeoiaAH5zNh/g4LgkpiGO520tQgVB92FaKK3OR3CYvwgQrk66ykv gn0wZ9YdQjXB+ckPX1D2MWdRFOXquapdL2mXbM8SdSq9/9+uqOo9DEFoSXN4lYNInm70 5YgVoy4tkSy1uPouBKYMUmpBBz7iIwLHSN1xPDEMd34LGoRp34eL4+KaTkdS+XMNxV4w wfi/AwplbpbBRraSImdCOmI/lwWIVFI7OvZG6T7LPCCsxJQSLfjruDTl49OhUQRXnWHu CEAQ== X-Gm-Message-State: AHPjjUiUXo+NQMrbIOPKwCasAc00RQzpagI3tEeSrBktUpZn1kiK6d+V edTBxIr92MQO1g== X-Google-Smtp-Source: AOwi7QDPxQ6EYJISIFI1IZfZHBdN43vRnzNbd1RFzzPgu+UXutj4Mp4fWFWYDQmxxD/zFYoLDPLH2Q== X-Received: by 10.107.136.66 with SMTP id k63mr22603830iod.28.1505246781938; Tue, 12 Sep 2017 13:06:21 -0700 (PDT) Original-Received: from [130.203.152.247] ([130.203.152.247]) by smtp.gmail.com with ESMTPSA id 185sm6249831iov.60.2017.09.12.13.06.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 12 Sep 2017 13:06:21 -0700 (PDT) In-Reply-To: X-Mailer: Apple Mail (2.3273) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:136846 Archived-At: All, If I haven=E2=80=99t replied to this earlier (sorry), I second David=E2=80= =99s comments. =20 The distributed binary version of Aquamacs is built with an environment = that hides installed libraries as far as possible, and with patches that = add runtime checks for the availability of APIs. I never understood why the Emacs build on Macs does so much compile-time = checking, and I can only suspect that there are historical reasons from = GNU/Linux systems where you have source distributions, build locally, = using package managers to take care of dependencies. - David > On Sep 12, 2017, at 4:01 PM, David Caldwell = wrote: >=20 > On 8/12/17 8:51 AM, Alan Third wrote: >> On Sat, Aug 12, 2017 at 01:13:56PM +0200, Charles A. Roelli wrote: >>> Hm, on second thoughts, it seems a bit overwrought to try doing this >>> weak linking only for the sake of forward-compatible builds. It >>> should be enough to support only backward-compatible builds, so that >>> we might one day distribute Emacs as a .dmg (built on the latest = macOS >>> and backwards-compatible with the oldest version of macOS that we >>> support). >>=20 >> I think this makes sense. Especially given we=E2=80=99re not able to = actually >> create a stand=E2=80=90alone .app without implementing something = like... >>=20 >>> I also looked at the emacsformacosx.com build scripts, and it seems >>> like they're making copies of Emacs' dependent dynamic libraries, >>> including them in the application bundle, then using >>> install_name_tool(1) to patch the Emacs binary to depend on them (I >>> don't understand, though, how those scripts resolve dependencies >>> between the dynamic libraries themselves). >=20 > The install_name_tool stuff is to change the absolute paths in the > dynamic library load paths to application relative paths. And only for > extra dependency stuff that gets installed like gnutls (and eventually > more=E2=80=94I'd like ImageMagick, but I haven't been able to get = relative paths > working with its plugin-architecture). >=20 > The relative paths still include the OS that they were compiled on so > the dylibs can find each other but not conflict with the other OS = dylibs. >=20 > For instance, Emacs-Emacs.app/Contents/MacOS/Emacs-x86_64-10_9 has = this > as one of it's load paths: >=20 > @executable_path/lib-x86_64-10_9/libgnutls.30.dylib >=20 > and Emacs.app/Contents/MacOS/lib-x86_64-10_9/libgnutls.30.dylib has > stuff like: >=20 > @executable_path/lib-x86_64-10_9/libp11-kit.0.dylib >=20 > It's pretty straightforward in the end, but it's not documented super > well, and it's sort of tricky that you have to manipulate all these > things manually. >=20 >> I wouldn=E2=80=99t have a problem with putting this capability in, = but I don=E2=80=99t >> have the knowledge nor the inclination to do it myself. >>=20 >> I was going to write something up in INSTALL about building with >> feature detection, but I really don=E2=80=99t know how to put it. I = don=E2=80=99t want >> to give the impression that if you use >> -DMAC_OS_X_VERSION_MIN_ALLOWED=3D1060 that it will magically build a >> portable .app. I began to wonder if it=E2=80=99s worth mentioning at = all since >> I doubt any more than a handful of people will be interested in >> building with this option. >>=20 >> David and David, I hope it=E2=80=99s OK to include you in this. I = thought you >> might be interested and perhaps have some thoughts on what we=E2=80=99r= e >> doing. >>=20 >> Basically, instead of detecting all macOS features at compile=E2=80=90t= ime, >> we=E2=80=99ve stuck in some code to detect them at run=E2=80=90time. = It causes >> compiler warnings, so by default it still limits features to those >> available at build=E2=80=90time, but if you do something like: >>=20 >> ./configure --with-ns CFLAGS=3D"-DMAC_OS_X_VERSION_MIN_REQUIRED=3D10= 60 -O3 -g" >>=20 >> when building on macOS Sierra, you should, in theory, end up with an >> executable that will work correctly on every version of macOS back to >> 10.6, inclusive. We haven=E2=80=99t been able to properly test = portability yet >> as it requires including dynamic libraries. >=20 > I would love that. As far as I know, that's the way Apple recommends > doing feature detection. Many of the complexities of the > EmacsForMacOS.com builds (like all the individual OS compiled = versions) > are because Emacs does compile-time feature detection instead of > run-time. Compiling on old systems means having to jump through hoops > sometimes as different software stops being supported on them. I have = to > download a "portable ruby" binary that homebrew made so that I can run > something newer than 1.8 on old OSes. For master branch builds I have = to > run the autoconf stuff on an up-to-date Debian machine before handing = it > off to the Mac build machines because it's really hard to automate > installing the latest autoconf in a way that supports stuff back to = 10.6 > (Homebrew is not available on 10.6, for instance). >=20 > So having a single backwards compatible version of Emacs would be very > very nice. The build-system is rickety and this would make it more > streamlined. And much easier for a random person to build a universal > app (btw I'd be happy to help produce official Mac builds if that is > ever wanted). >=20 > -David