bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#45934: native-comp - Dylib ID of ELN files not optimal


From: Davide Restivo
Subject: bug#45934: native-comp - Dylib ID of ELN files not optimal
Date: Sat, 23 Jan 2021 17:13:23 +0100

Ciao Andrea,

Please find below inline my answers. Sorry for the late reply :).

Regards,
Davide


> yes my question was on what the dylib ID is and what's is purpose.

A `dylib ID` a.k.a. `install_name` is the unique identifier that a library
provides to an executable that links against it. Once an executable
links against a library, the install_name values is stored in the linking
application and used at runtime to find the .dylib location.

Very important is that there cannot be, as far as I understood, two .dylib
loaded at the same time with the same dylib ID. I guess this was the
reason for the strange behaviour (unmapped .eln) we discussed
some time ago [1].

> Okay, we should be able to work it around but as anticipated only using
> GCC >= 9, that is indeed not very satisfactory.

Maybe you could conditionally enable the `install_name` support only if GCC >=9.
I will add a dependency in my Homebrew GNU/Emacs Formula to GCC-10, that
is anyway the Homebrew default.


> My question is: if is homebrew the owner of this build process shouldn't
> be its responsibility to keep the ID unique?

Unfortunately this is not the case since Homebrew simply change the dylib ID
basepath from `sandbox` to `installation directory`. I have already opened an
‘issue’ to homebrew core developers but they suggested to properly set the
install_name. Please see [2] and [3] for more insights.


> How do you work around this issue now?


What I have implemented as a workaround is the replacing of the original dylib 
ID
i.e. /private/tmp/libgccjit-3AyZly/fake.so with  <sandbox_path>/<filename>.eln.

Below the ruby code snippet.

```
        # Change .eln files dylib ID to avoid that after the
        # post-install phase all of the *.eln files end up with the
        # same ID. See: https://github.com/Homebrew/brew/issues/9526
        # and https://github.com/Homebrew/brew/pull/10075
        Dir.glob(contents_dir/"native-lisp/*/*.eln").each do |f|
          fo = MachO::MachOFile.new(f)
          ohai "Change dylib_id of ELN files before post_install phase"
          fo.dylib_id = "#{contents_dir}/" + f
          fo.write!
        end
      end
```


[1] 
https://github.com/daviderestivo/homebrew-emacs-head/issues/23#issuecomment-695175926
[2] https://github.com/Homebrew/brew/issues/9526
[3] https://github.com/Homebrew/brew/pull/10075



reply via email to

[Prev in Thread] Current Thread [Next in Thread]