From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: "Charles A. Roelli" Newsgroups: gmane.emacs.bugs Subject: bug#27810: NS runtime feature detection Date: Sat, 12 Aug 2017 15:02:07 +0200 Message-ID: <4c19d548-6686-28f2-2d6e-a3e6281aca27@aurox.ch> References: <20170723121701.GA3730@breton.holly.idiocy.org> <508a4930-feab-588b-0ab9-f55a10ea85ec@aurox.ch> <20170724204404.GA20189@breton.holly.idiocy.org> <20170726215746.GA59679@breton.holly.idiocy.org> <20170801220339.GA57816@breton.holly.idiocy.org> <87dde5f1-0010-584e-2dad-4f0fe932f1fa@aurox.ch> <20170806212929.GA62061@breton.holly.idiocy.org> <5d8b81c3-9a45-d59f-8dd1-c0ccc0a19c78@aurox.ch> <20170810210457.GA85019@breton.holly.idiocy.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------69E0D3199CF5C7EFC4EDACF2" X-Trace: blaine.gmane.org 1502542994 18738 195.159.176.226 (12 Aug 2017 13:03:14 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sat, 12 Aug 2017 13:03:14 +0000 (UTC) User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 Cc: Anders Lindgren , 27810@debbugs.gnu.org To: Alan Third Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Aug 12 15:03:08 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 1dgW4H-0004Oe-P3 for geb-bug-gnu-emacs@m.gmane.org; Sat, 12 Aug 2017 15:03:06 +0200 Original-Received: from localhost ([::1]:51922 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dgW4O-000444-Ap for geb-bug-gnu-emacs@m.gmane.org; Sat, 12 Aug 2017 09:03:12 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:56362) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dgW4I-00043S-52 for bug-gnu-emacs@gnu.org; Sat, 12 Aug 2017 09:03:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dgW4F-0002GT-1o for bug-gnu-emacs@gnu.org; Sat, 12 Aug 2017 09:03:06 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:47719) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dgW4E-0002GB-P6 for bug-gnu-emacs@gnu.org; Sat, 12 Aug 2017 09:03:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1dgW4D-0006Pa-VL for bug-gnu-emacs@gnu.org; Sat, 12 Aug 2017 09:03:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: "Charles A. Roelli" Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 12 Aug 2017 13:03: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.150254294924638 (code B ref 27810); Sat, 12 Aug 2017 13:03:01 +0000 Original-Received: (at 27810) by debbugs.gnu.org; 12 Aug 2017 13:02:29 +0000 Original-Received: from localhost ([127.0.0.1]:56400 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dgW3e-0006PK-39 for submit@debbugs.gnu.org; Sat, 12 Aug 2017 09:02:29 -0400 Original-Received: from sinyavsky.aurox.ch ([37.35.109.145]:59312) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dgW3Y-0006PE-DV for 27810@debbugs.gnu.org; Sat, 12 Aug 2017 09:02:24 -0400 Original-Received: from sinyavsky.aurox.ch (sinyavsky.aurox.ch [127.0.0.1]) by sinyavsky.aurox.ch (Postfix) with ESMTP id 7494E224F8 for <27810@debbugs.gnu.org>; Sat, 12 Aug 2017 12:56:33 +0000 (UTC) Authentication-Results: sinyavsky.aurox.ch (amavisd-new); dkim=pass (1024-bit key) reason="pass (just generated, assumed good)" header.d=aurox.ch DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=aurox.ch; h= content-type:content-type:in-reply-to:mime-version:user-agent :date:date:message-id:from:from:references:to:subject:subject; s=dkim; t=1502542589; x=1503406590; bh=+Gvu4XdiBqoMSoksMlvafkug JoR2u+KzjPANibJ97Jc=; b=r0jSd/pPlhq5axbtsdSeuMe5+dZc5oy+sa0IvKti MScuS1ipNCkX95OFLofjWWeDL4dj8yLROyAwW+plX624VvyQmKk3+4bSD+DtwAr7 Y+YM0wP5AFDZaZR/zQUWVKXA0Wuo1BFbdQ2cTq3FMAcy6ZakbaJFSiWjd/ntZ6Vc fyU= X-Virus-Scanned: Debian amavisd-new at test.virtualizor.com Original-Received: from sinyavsky.aurox.ch ([127.0.0.1]) by sinyavsky.aurox.ch (sinyavsky.aurox.ch [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id UNZTiwshHgsa for <27810@debbugs.gnu.org>; Sat, 12 Aug 2017 12:56:29 +0000 (UTC) Original-Received: from [192.168.1.120] (125.85.192.178.dynamic.wline.res.cust.swisscom.ch [178.192.85.125]) by sinyavsky.aurox.ch (Postfix) with ESMTPSA id E9F33224CF; Sat, 12 Aug 2017 12:56:27 +0000 (UTC) In-Reply-To: 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:135677 Archived-At: This is a multi-part message in MIME format. --------------69E0D3199CF5C7EFC4EDACF2 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit (I fixed the build issue with 'make bootstrap') Attached is the patch to revert my changes. On 12/08/2017 13:13, 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). I don't want to waste time adding code that will hardly > ever be run, so we can take out those forward declarations. Sorry for > the trouble! I will send a patch on top of your new one that removes > them (I'm also having build trouble at the moment). > > 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). > > > On 10/08/2017 23:04, Alan Third wrote: >> On Mon, Aug 07, 2017 at 09:23:10PM +0200, Charles A. Roelli wrote: >>> On 06/08/2017 23:29, Alan Third wrote: >>>> I believe we can make this slightly neater: >>>> >>>> enum NSScrollerStyle { >>>> NSScrollerStyleLegacy = 0, >>>> NSScrollerStyleOverlay = 1 >>>> }; >>> Strange, it doesn't work here: >> We’ll just go with what works, then. >> >>>> I’ve done a bit more reading up on this and I think I’ve misunderstood >>>> how this works, and probably mislead you. >>>> >>>> It seems these functions need to be declared as weak in the definition >>>> of the library they’re supposed to be in. If we declare them in the >>>> Emacs code‐base then the linker, reasonably, expects the functions to >>>> be in the Emacs code‐base. >>> Maybe I'm also confused. I thought we would be able to do this, >>> since: >>> >>> - At link time, the symbol is marked as a weak reference, to be >>> resolved at runtime. >>> >>> - At runtime, the dynamic linker resolves the reference to the weak >>> symbol, setting it to NULL if it isn't available. Normally the >>> definition of the function will be found in a dynamic library that >>> is part of macOS (as far as I understand). >>> >>> The Apple compiler/linker should be capable of doing this, supposedly, >>> as long as you give the magical -Wl,-U,_symbol command line arguments >>> to the linker. See also https://stackoverflow.com/a/34983229. >> That’s quite a good description. I guess that we want to do what >> you’re suggesting, then. I’m not sure how, though. I’ll try to have a >> look through configure.ac to see if I can work it out sometime over >> the weekend. >> >>> I'd like to check, but wouldn't I need to either: >>> >>> a) Statically link libraries Emacs depends on, or >>> b) Include the dependent libraries in the app bundle? >> Yes, I suppose so. I kind of assumed it would statically link at least >> some of them, but I guess not. >> >> I’ve had a look at the build scripts for emacsformacosx.com, but I >> don’t understand what they’re doing. >> >> I’ve attached what I have so far, which I think includes all your >> changes except for the requirements for linker arguments. >> Unfortunately master doesn’t build here now because of some other >> problem so it’s untested. > --------------69E0D3199CF5C7EFC4EDACF2 Content-Type: application/diff; name="remove-forward-compatibility-changes.diff" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="remove-forward-compatibility-changes.diff" ZGlmZiAtLWdpdCBhL3NyYy9tYWNmb250LmggYi9zcmMvbWFjZm9udC5oCmluZGV4IGFiYjM3 Y2QuLjMyODk5OTAgMTAwNjQ0Ci0tLSBhL3NyYy9tYWNmb250LmgKKysrIGIvc3JjL21hY2Zv bnQuaApAQCAtNDUsMTIgKzQ1LDEyIEBAIHN0cnVjdCBtYWNfZ2x5cGhfbGF5b3V0CiAgIENH R2x5cGggZ2x5cGhfaWQ7CiB9OwogCi0jaWYgIWRlZmluZWQgKE1BQ19PU19YX1ZFUlNJT05f MTBfOCkKKyNpZiBNQUNfT1NfWF9WRVJTSU9OX01BWF9BTExPV0VEIDwgMTA4MAogZW51bSB7 CiAgIGtDVEZvbnRUcmFpdEl0YWxpYyA9IGtDVEZvbnRJdGFsaWNUcmFpdCwKICAga0NURm9u dFRyYWl0Qm9sZCA9IGtD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