Replies: 4 comments 20 replies
-
@Homebrew/linux can you help? |
Beta Was this translation helpful? Give feedback.
-
If I'm not mistaken, on a system like CentOS, the very first formula that should be getting installed during the initial install is |
Beta Was this translation helpful? Give feedback.
-
I'm running into this issue on RHEL 7.4. Since that distro's copies of curl and git are too old, I placed newer versions in the path. The installer doesn't detect that the version of glibc is too old and install a newer version. Nor does it install curl and git, so that subsequent brew calls keep complaining about these.
|
Beta Was this translation helpful? Give feedback.
-
gcc is also failing to build:
|
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hey,
When trying to bootstrap Homebrew on Centos 7, I've successfully used my own versions of curl and git (manually built from source) to install gcc@5 (after I've edited its formula to use its bottle), but I can't seem to install glibc. For reference, my brew config is
and the error message I get is
I've done a little investigating myself and it seems that in the version of glibc that Homebrew installs, 2.23, the source that springs this error comes from here:
https://elixir.bootlin.com/glibc/glibc-2.23/source/elf/get-dynamic-info.h#L143
For convenience, this is the encompassing code block:
It appears that the assertion
assert (info[DT_RPATH] == NULL);
is only checked if the macroRTLD_BOOTSTRAP
is defined. That macro is defined here:https://elixir.bootlin.com/glibc/glibc-2.23/source/elf/rtld.c#L349.
From https://stackoverflow.com/questions/44224327/loading-the-dynamic-linker and https://titanwolf.org/Network/Articles/Article?AID=37989c11-53d7-4ae9-a459-d7ca2567a6da#gsc.tab=0, it appears that this bootstrap code is how ld.so relocates itself into binaries, as it is itself a shared object file. Thus, it appears something has gone wrong with this self-relocation process. But I'm not sure how to proceed. Any thoughts?
EDIT:
After doing some more digging, I think there might be a legitimate issue with how Homebrew patches ELF files/shared object libraries, with respect to installing glibc. Running objdump and searching for RPATH on the version of ld.so that homebrew installs versus the system install, I get
Which seems to indicate to me that homebrew (when compiling from source) is naively patching all ELF/shared object files to set their RPATH to the Homebrew libraries, but because ld.so is self relocating it itself does not need its RPATH set (and specifically guards against this). However, I'm not sure my analysis is entirely correct and there might be some further issues with my system configuration, as I've seen some other users of Centos 7 around here successfully use homebrew on their systems.
EDIT 2:
Digging into the homebrew source a little bit, I found where homebrew does the ELF patching for linux:
https://github.com/Homebrew/brew/blob/master/Library/Homebrew/extend/os/linux/keg_relocate.rb
It appears that there is an attempt to not patch ld.so by homebrew, as can be seen in this code block near the top:
However, this does not appear to be triggering on my system. I'm wondering if this is reproducible on any other Centos 7 systems like mine? Maybe somebody could also check the RPATH of their homebrew ld.so with readelf/objdump.
EDIT 3:
I have tried fixing this myself by using my manually compiled version of patchelf to remove the erroneous rpath from my ld.so, like so
which seems to have successfully removed rpath, but upon running
brew postinstall
I get the same error message as above. Maybe the locale binary from homebrew glibc has the old version of ld.so inside of it? I'm very hazy on the details of the compilation of glibc. Hopefully this problem can just be stopped at the source by ensuring ld.so really does not have its rpath patched during homebrew's installation of glibc.EDIT 4:
I have fixed my problem. In EDIT 3, I had failed to notice that the error message when executing
ld.so
had changed toindicating that
ld.so
also had had itsRUNPATH
set. Indeed, runningobjdump
again gives meindicating that homebrew had also set the
RUNPATH
ofld.so
to an empty string. Removing this withpatchelf
let me successfully runbrew postinstall
. I will leave this up in case anybody finds this interesting or wants to probe further into how this happened.Beta Was this translation helpful? Give feedback.
All reactions