Skip to content
This repository has been archived by the owner on Jul 4, 2023. It is now read-only.

git formula not installing (libiconv error?) #9092

Closed
sarahhodne opened this issue Dec 12, 2011 · 19 comments
Closed

git formula not installing (libiconv error?) #9092

sarahhodne opened this issue Dec 12, 2011 · 19 comments

Comments

@sarahhodne
Copy link

I just tried running brew upgrade to upgrade my formulae, and it crashed on installing git. I've tried installing it separately, but that gives me the exact same error message, which you can see in the gist I just posted.

It seems like there's some error with libiconv, but I can't figure out what. Running brew install libiconv doesn't seem to do anything at all (the command generates no output).

Oh, and here's my brew doctor output:

Some "config" scripts were found in your path, but not in system or Homebrew folders.

`./configure` scripts often look for *-config scripts to determine if software packages
are installed, and what additional flags to use when compiling and linking.

Having additional scripts in your path can confuse software installed via Homebrew if
the config script overrides a system or Homebrew provided script of the same name.

/usr/local/MacGPG2/bin
    gpg-error-config ksba-config libassuan-config libgcrypt-config libusb-config pth-config
@jacknagel
Copy link
Contributor

It looks like the git build system is picking up a libiconv that doesn't have 64-bit symbols.

It could be due to the MacGPG stuff, that is known to cause problems.

@mistydemeo
Copy link
Member

Do you see anything if you do brew list --unbrewed | egrep iconv?

@sarahhodne
Copy link
Author

@mistydemeo Big surprise, there's some MacGPG stuff there: https://gist.github.com/1468849

@jacknagel
Copy link
Contributor

Yeah, you'll have to remove, or at least temporarily move, the iconv stuff.

@sarahhodne
Copy link
Author

Hmm, I do use MacGPG though. I'll try and figure it out.

@sarahhodne
Copy link
Author

I moved the MacGPG stuff into my home folder, but I still get the same error.

@jacknagel
Copy link
Contributor

What do you see if you do find / -name libiconv* 2>/dev/null?

@camillol
Copy link
Contributor

Try brew install git --interactive; when you get the shell prompt, do gcc -Wl,-t -liconv | grep iconv. That should tell you where it is finding libiconv.

@sarahhodne
Copy link
Author

Looks like it uses /usr/lib/libiconv.dylib.

› gcc -Wl,-t -liconv | grep iconv
/usr/lib/libiconv.dylib
Undefined symbols for architecture x86_64:
  "_main", referenced from:
      start in crt1.10.6.o
ld: symbol(s) not found for architecture x86_64
collect2: ld returned 1 exit status

@camillol
Copy link
Contributor

That one is fine. The problem is probably some library that you have already installed in homebrew that is linked to MacGPG's libiconv.

@sarahhodne
Copy link
Author

@jacknagel This is what I see. Had to rework the command a bit to remove /Volumes, which scanned all of my backups. Took forever to run...

@sarahhodne
Copy link
Author

Hmm, when looking at the /usr/lib/libiconv.dylib symbols (with nm), it seems like the symbol there is called _iconv_open, and git tries to use _libiconv_open. Not sure if this is relevant, but it seems like it.

@sarahhodne
Copy link
Author

And, it seems like the version installed in /usr/local/Cellar/libiconv uses _libiconv_open. This might be it.

@sarahhodne
Copy link
Author

Yes, that was it. I uninstalled the homebrew version of libiconv (rm -rf /usr/local/Cellar/libiconv && ls -l /usr/local/lib | grep iconv | awk '{ print "/usr/local/lib/"$9 }' | xargs rm), and it worked!

@jacknagel
Copy link
Contributor

Yes, the Hombrew version can interfere with things, which is why it is not normally linked into the prefix; instead of uninstalling you could brew unlink libiconv. Note that removing it may break installed software.

@sarahhodne
Copy link
Author

brew unlink libiconv kept saying there were multiple installed versions of libiconv. I did take a backup, just in case. Also, I tried unlinking manually (ls -l /usr/local/lib | grep iconv | awk '{ print "/usr/local/lib/"$9 }' | xargs rm), but installing git didn't work until I removed the files in /usr/local/Cellar/libiconv.

From what I could gather, this happened because ./configure was ran and decided to use Homebrew's version, but the formula then removes CCFLAGS, LDFLAGS, and the like, but doesn't reset what symbol names to use (I think it changed between versions), and therefore there was a conflict when actually linking.

@flashus
Copy link

flashus commented Jun 22, 2012

brew unlink libiconv solved issue for me. Thanks @jacknagel!

@liamcurry
Copy link

brew unlink libiconv also solved the issues I was having. Thank you @jacknagel.

@dmuth
Copy link

dmuth commented Dec 9, 2012

Since I spent about an hour (and many Google searches) trying to get to the bottom of this, I wanted to add my experience in the hopes that this may help someone else down the road.

I'm on an iMac running OS/X 10.6. Prior to installing Brew, I had both MacPorts and Fink, which may have unintentionally left cruft laying around, even though I'm sure I got it all.

The fix for me ended up being:
brew install libiconv
brew link libiconv

The second step was very important, because I don't believe that those files were linked by default.

Anyway, once I installed libiconv via Brew, Git compiled with no complaints whatsoever!

Hope this helps!

@Homebrew Homebrew locked and limited conversation to collaborators Feb 16, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants