unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: "Gerd Möllmann" <gerd.moellmann@gmail.com>
Cc: gregory@heytings.org, larsi@gnus.org, 57849@debbugs.gnu.org,
	akrl@sdf.org
Subject: bug#57849: 29.0.50; MacOS ld warning from native compilation
Date: Sat, 17 Sep 2022 10:31:55 +0300	[thread overview]
Message-ID: <83wna21mok.fsf@gnu.org> (raw)
In-Reply-To: <m235cqxygr.fsf@Mini.fritz.box> (message from Gerd Möllmann on Sat, 17 Sep 2022 09:16:20 +0200)

> Cc: Gregory Heytings <gregory@heytings.org>, Lars Ingebrigtsen <larsi@gnus.org>,
>  57849@debbugs.gnu.org
> From: Gerd Möllmann <gerd.moellmann@gmail.com>
> Date: Sat, 17 Sep 2022 09:16:20 +0200
> 
> That failed miserably.  What I tried:
> 
> (1) See with which options elns are compiled/linked.
> 
> (let ((native-comp-driver-options '("-v")))
>   (native-compile "/Users/gerd/emacs/crash.el"))
> 
> gives an output ending with
> 
>  /opt/homebrew/Cellar/gcc/12.2.0/bin/../libexec/gcc/aarch64-apple-darwin21/12/collect2 -syslibroot /Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk/ -dynamic -arch arm64 -macosx_version_min 12.0.0 -o /var/folders/1d/k_6t25f94sl83szqbf8gpkrh0000gn/T//libgccjit-YMST3m/fake.so -L/opt/homebrew/Cellar/gcc/12.2.0/bin/../lib/gcc/current/gcc/aarch64-apple-darwin21/12 -L/opt/homebrew/Cellar/gcc/12.2.0/bin/../lib/gcc/current/gcc -L/opt/homebrew/Cellar/gcc/12.2.0/bin/../lib/gcc/current/gcc/aarch64-apple-darwin21/12/../../.. /var/folders/1d/k_6t25f94sl83szqbf8gpkrh0000gn/T//ccbfcNDH.o -undefined dynamic_lookup -dylib -dylib_install_name crash-e892b236-cea0f727.eln -lemutls_w -lgcc -lSystem -lgcc -no_compact_unwind -rpath @loader_path -rpath /opt/homebrew/Cellar/gcc/12.2.0/lib/gcc/current/gcc/aa
 rch64-apple-darwin21/12 -rpath /opt/homebrew/Cellar/gcc/12.2.0/lib/gcc/current/gcc -rpath /opt/homebrew/Cellar/gcc/12.2.0/lib/gcc/current
> ld: warning: -undefined dynamic_lookup may not work with chained fixups
> 
> That is, it builds a shared object (-dynamic).
> 
> (2) -bundle_loader requires -bundle.  Ld gives an error if
> -bundle_loader is used without -bundle.  A "bundle" in Mach-O, which is
> what MacOS is using instead of ELF, say, is something different than a
> shared library.  Example:
> 
> gcc -v -o eln.dylib -twolevel_namespace -undefined dynamic_lookup -dylib -bundle_loader hansi eln.c
> ld: -bundle_loader can only be used with -bundle
> 
> (3) Tried to add -bundle like this
> 
> (let ((native-comp-driver-options '("-v" "-bundle")))
>   (native-compile "/Users/gerd/emacs/crash.el"))
> 
> but it fails
> 
> Compiling /Users/gerd/.emacs.d/eln-cache/29_0_50-72ec8db5/crash-e892b236-cea0f727.eln...
> Using built-in specs.
> aarch64-apple-darwin21-gcc-12: error: -bundle not allowed with -dynamiclib
> COLLECT_GCC=aarch64-apple-darwin21-gcc-12
> 
> I odn't know how to remove the -dynamic from (1).
> 
> As an aside, -bundler_loader actually requires an argument <executable>,
> which would be Emacs in our case.  What that means for Emacs' build
> process is unclear to me, but it doesn't feel good.
> 
> So, I declare this a complete failure.
> 
> Anyone with an idea what else to try?

Is this somehow an Emacs-specific problem, or is this a general
problem with libgccjit on those versions of macOS?  If the latter, I
think this should be taken up with the libgccjit developers first, and
we should then do as they say, if that makes sense.

> Otherwise my proposal is to
> either add something to etc/PROBLEMS describing how to add "-Wl,-w", or
> add that option by default on Darwin.

If what the libgccjit developers say doesn't fit our needs, or if this
is an Emacs-specific problem, thgen yes, using -Wl,-w is probably the
way to go.

> I didn't check if emacs-28 has the same problem, but I don't see why it
> wouldn't.

It's okay to make that change on the emacs-28 branch, if someone can
verify that it works on that branch.

> If we add -Wl by default, an open question is if -w is supported on all
> all versions of MacOS that Emacs supports, which I can't find a definite
> answer to.

I think -w is such an old option that it'd be unthinkable for it not
to be supported.





  reply	other threads:[~2022-09-17  7:31 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-16  5:48 bug#57849: 29.0.50; MacOS ld warning from native compilation Gerd Möllmann
2022-09-16 10:51 ` Lars Ingebrigtsen
2022-09-16 12:34   ` Gerd Möllmann
2022-09-16 12:39     ` Lars Ingebrigtsen
2022-09-16 12:44       ` Gerd Möllmann
2022-09-16 12:44   ` Gregory Heytings
2022-09-16 12:50     ` Gerd Möllmann
2022-09-16 13:05       ` Gerd Möllmann
2022-09-16 13:39         ` Gerd Möllmann
2022-09-16 13:52           ` Eli Zaretskii
2022-09-16 14:01             ` Gerd Möllmann
2022-09-16 21:53       ` Andrea Corallo
2022-09-17  4:45         ` Gerd Möllmann
2022-09-17  7:16           ` Gerd Möllmann
2022-09-17  7:31             ` Eli Zaretskii [this message]
2022-09-17  8:17               ` Gerd Möllmann
2022-09-17  8:57                 ` Gerd Möllmann
2022-09-19  5:19                   ` Gerd Möllmann
2024-05-18  6:30                     ` Gerd Möllmann

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=83wna21mok.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=57849@debbugs.gnu.org \
    --cc=akrl@sdf.org \
    --cc=gerd.moellmann@gmail.com \
    --cc=gregory@heytings.org \
    --cc=larsi@gnus.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).