avr-binutils conflict with existing x86_64-elf-binutils

11
closed
gustavonihei
gustavonihei
Posted 7 months ago

avr-binutils conflict with existing x86_64-elf-binutils #243

After the bump of avr-binutils to version 2.36.1, it seems to conflict with x86_64-elf-binutils installation of the same 2.36.1 version:

==> Pouring avr-binutils-2.36.1.catalina.bottle.tar.gz
Error: The `brew link` step did not complete successfully
The formula built, but is not symlinked into /usr/local
Could not symlink lib/bfd-plugins/libdep.so
Target /usr/local/lib/bfd-plugins/libdep.so
is a symlink belonging to x86_64-elf-binutils. You can unlink it:
  brew unlink x86_64-elf-binutils

To force the link and overwrite all conflicting files:
  brew link --overwrite avr-binutils

To list all files that would be deleted:
  brew link --overwrite --dry-run avr-binutils

Possible conflicting files are:
/usr/local/lib/bfd-plugins/libdep.so -> /usr/local/Cellar/x86_64-elf-binutils/2.36.1/lib/bfd-plugins/libdep.so

If the link is forced via the brew link --overwrite avr-binutils, both avr-ld and x86_64-elf-ld seem to work, but I am afraid this shouldn't be necessary:

$ avr-ld -v
GNU ld (GNU Binutils) 2.36.1
$ x86_64-elf-ld -v
GNU ld (GNU Binutils) 2.36.1
ladislas
ladislas
Created 7 months ago

This is really strange, I don't know why they would conflict.

ladislas
ladislas
Created 7 months ago

I've tried something, but I'm really not sure on how to fix this.

Can you try fcc36c4 and let me know?

ralphrmartin
ralphrmartin
Created 7 months ago

Similar happens with arm-linux-gnueabihf-binutils

See https://github.com/Homebrew/homebrew-core/issues/78849

gustavonihei
gustavonihei
Created 7 months ago

I've tried something, but I'm really not sure on how to fix this.

Can you try fcc36c4 and let me know?

I've just tested it, but it didn't resolve the conflict.

One important detail that I've realized is that the libdep.so symlink is not created during the install of x86_64-elf-gcc, but during the install of avr-gcc. Even so, the symlink points to the libdep.so of x86_64-elf-binutils package.

Here is the steps for reproducing the issue:

$ brew uninstall avr-gcc avr-binutils
Uninstalling /usr/local/Cellar/[email protected]/9.3.0_3... (1,749 files, 207.3MB)
Uninstalling /usr/local/Cellar/avr-binutils/2.36.1... (159 files, 23.4MB)

$ brew uninstall x86_64-elf-gcc x86_64-elf-binutils
Uninstalling /usr/local/Cellar/x86_64-elf-gcc/11.1.0... (615 files, 129.8MB)
Uninstalling /usr/local/Cellar/x86_64-elf-binutils/2.36.1... (189 files, 34.6MB)

$ brew install x86_64-elf-gcc
==> Downloading https://ghcr.io/v2/homebrew/core/x86_64-elf-binutils/manifests/2.36.1
==> Downloading https://ghcr.io/v2/homebrew/core/x86_64-elf-binutils/blobs/sha256:98a1c41b67cda5c8552edf16e826aada8f29409da4477301db7ce861c6e93295
==> Downloading https://ghcr.io/v2/homebrew/core/x86_64-elf-gcc/manifests/11.1.0-1
==> Downloading https://ghcr.io/v2/homebrew/core/x86_64-elf-gcc/blobs/sha256:c5e485f635596a59826e07708ccc497cc950503a4711fe83faf9aafa5ebeb914
==> Installing dependencies for x86_64-elf-gcc: x86_64-elf-binutils
==> Installing x86_64-elf-gcc dependency: x86_64-elf-binutils
==> Pouring x86_64-elf-binutils--2.36.1.big_sur.bottle.tar.gz
🍺  /usr/local/Cellar/x86_64-elf-binutils/2.36.1: 189 files, 34.6MB
==> Installing x86_64-elf-gcc
==> Pouring x86_64-elf-gcc--11.1.0.big_sur.bottle.1.tar.gz
🍺  /usr/local/Cellar/x86_64-elf-gcc/11.1.0: 615 files, 129.8MB

$ find /usr/local/ -name libdep.so
/usr/local//Cellar/x86_64-elf-binutils/2.36.1/lib/bfd-plugins/libdep.so

$ cd $(brew --repository)/Library/Taps/osx-cross/homebrew-avr

$ git checkout fcc36c4
HEAD is now at fcc36c4 Set --libdir - fix #243

$ HOMEBREW_NO_AUTO_UPDATE=1 brew install avr-gcc
==> Installing [email protected] from osx-cross/avr
==> Downloading https://github.com/osx-cross/homebrew-avr/releases/download/avr-binutils-2.36.1/avr-binutils-2.36.1.big_sur.bottle.tar.gz
==> Downloading from https://github-releases.githubusercontent.com/30939945/d4e01980-c53f-11eb-8ce4-639a0401e406?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSV
######################################################################## 100.0%
==> Downloading https://github.com/osx-cross/homebrew-avr/releases/download/[email protected]_3/avr-gcc%409-9.3.0_3.big_sur.bottle.tar.gz
==> Downloading from https://github-releases.githubusercontent.com/30939945/f514d600-c549-11eb-8afb-57a7015a2f3f?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSV
######################################################################## 100.0%
==> Installing dependencies for osx-cross/avr/[email protected]: avr-binutils
==> Installing osx-cross/avr/[email protected] dependency: avr-binutils
==> Pouring avr-binutils-2.36.1.big_sur.bottle.tar.gz
Error: The `brew link` step did not complete successfully
The formula built, but is not symlinked into /usr/local
Could not symlink lib/bfd-plugins/libdep.so
Target /usr/local/lib/bfd-plugins/libdep.so
is a symlink belonging to x86_64-elf-binutils. You can unlink it:
  brew unlink x86_64-elf-binutils

To force the link and overwrite all conflicting files:
  brew link --overwrite avr-binutils

To list all files that would be deleted:
  brew link --overwrite --dry-run avr-binutils

Possible conflicting files are:
/usr/local/lib/bfd-plugins/libdep.so -> /usr/local/Cellar/x86_64-elf-binutils/2.36.1/lib/bfd-plugins/libdep.so
==> Summary
🍺  /usr/local/Cellar/avr-binutils/2.36.1: 159 files, 23.4MB
==> Installing osx-cross/avr/[email protected]
==> Pouring avr-gcc
==> Caveats
For Mac computers with Apple silicon, avr-gcc might need Rosetta 2 to work properly.
You can learn more about Rosetta 2 here:
    > https://support.apple.com/en-us/HT211861
==> Summary
🍺  /usr/local/Cellar/[email protected]/9.3.0_3: 1,749 files, 207.3MB
==> Caveats
==> [email protected]
For Mac computers with Apple silicon, avr-gcc might need Rosetta 2 to work properly.
You can learn more about Rosetta 2 here:
    > https://support.apple.com/en-us/HT211861

$ find /usr/local/ -name libdep.so
/usr/local//lib/bfd-plugins/libdep.so
/usr/local//Cellar/x86_64-elf-binutils/2.36.1/lib/bfd-plugins/libdep.so
/usr/local//Cellar/avr-binutils/2.36.1/lib/bfd-plugins/libdep.so
ladislas
ladislas
Created 7 months ago

@gustavonihei You must install binutils from source. The commit I sent does not point to a bottle yet. Use the -s option

ladislas
ladislas
Created 7 months ago

@ralphrmartin Thanks for the info. The update they mention for this formula was updating binutils from 2.35 to 2.36. Maybe this caused the issue but I don't know how.

Do elf and gnueabielf conflit with one another? Can you try?

ladislas
ladislas
Created 7 months ago

@gustavonihei I've forced push to the branch to remove the bottle block and force building from source, commit is now f1cbdc2

ralphrmartin
ralphrmartin
Created 7 months ago

"Do elf and gnueabielf conflict with one another? Can you try?"

I basically have a choice of leaving avr-binutils as it is, or overwriting with arm-linux-gnueabihf-binutils. I am not quite sure how to test for a conflict, but if you give me some specific instructions, I'll certainly try to find out.

ladislas
ladislas
Created 7 months ago

I'm ooo at the moment, so I cannot really try myself. The idea is:

# remove everythting completely
brew uninstall --ignore-dependencies avr-binutils
brew uninstall --ignore-dependencies x86_64-elf-binutils
brew uninstall --ignore-dependencies arm-linux-gnueabihf-binutils

# install x86_64-elf-binutils --> it should not complain
brew install x86_64-elf-binutils

# install arm-linux-gnueabihf-binutils
brew install arm-linux-gnueabihf-binutils

If there is a conflict, then it should be fixed in brew/core as both formula are located there. I'll follow the same fix here when they provide one.

UPDATE: I just managed to test it and the same conflict happens 💥

ralphrmartin
ralphrmartin
Created 7 months ago

Yes, I tested it too and got the conflict. Thanks for reporting to my original issue in homebrew/core.

Previous