ARMmbed / homebrew-formulae

homebrew ("the missing package manager for OS X") formulae from the mbed team.
Apache License 2.0
126 stars 39 forks source link

Conflict with avr-gcc #12

Closed ralphrmartin closed 7 years ago

ralphrmartin commented 7 years ago

I also have avr-gcc installed on my system. This causes a conflict:

==> Upgrading armmbed/formulae/arm-none-eabi-gcc 

...

==> cp -r arm-none-eabi bin lib share /usr/local/Cellar/arm-none-eabi-gcc/6-2016-q4-update/

Error: The `brew link` step did not complete successfully

The formula built, but is not symlinked into /usr/local

Could not symlink lib/libcc1.0.so

Target /usr/local/lib/libcc1.0.so is a symlink belonging to avr-gcc. You can unlink it:

  brew unlink avr-gcc
niklarm commented 7 years ago

I've gotten the same issue, but I don't recall this happening before. @mjs-arm is lib/libcc1.0.so new, maybe since gcc6?

niklarm commented 7 years ago

The way that gcc deals with this is to compile with a versioned lib path: Installing it into /usr/local/lib/gcc/6/ for example. The issue with this is that I can't retroactively apply this to the precompiled arm-none-eabi releases, and I'm not sure we can change the folder structure in the tarball in the future either without breaking other peoples setups.

niklarm commented 7 years ago

Hm, it's not obvious to me why libcc1 is put into /lib, instead of /lib/gcc/arm-none-eabi like the rest of the lib files.

niklarm commented 7 years ago

libcc1 is put into /lib on purpose in libcc1/Makefile.am:41:

cc1libdir = $(libdir)/$(libsuffix)

This change was introduced in https://github.com/gcc-mirror/gcc/commit/ab103e33b2aae243b231eba689e0b99418fa1663 to "Let GDB reuse GCC's parser.".

niklarm commented 7 years ago

That's all fine, cc1libdir is not to blame, the issue is that the mac tarball simply ships with the default --libdir, which is /lib. ~We need to do the same as for the gcc formula, and set --libdir to something like /lib/gcc/arm-none-eabi, then it won't conflict with anything else other than our own versions.~ see below

niklarm commented 7 years ago

As a fix I've recommended avr-gcc to be built with --libdir set, see https://github.com/osx-cross/homebrew-avr/issues/41. ~I've raised an internal issue to fix this for new releases.~

niklarm commented 7 years ago

No, actually we just don't need to symlink the /lib folder from the tarball. It is internal to the gcc toolchain anyways. We don't need to recompile the toolchain this way. I'll prepare a PR.

niklarm commented 7 years ago

Unlinking is not enough, you'll need to uninstall, update then reinstall:

brew uninstall arm-none-eabi-gcc
brew update
brew install arm-none-eabi-gcc
ralphrmartin commented 7 years ago

Thanks. I can confirm this seems to work ok.