mac: Install MacVim

Today, trying to compile MacVim I ran into a problem with some shared libraries:

...
Undefined symbols:
  "_iconv_close", referenced from:
      _buf_write in fileio.o
      _readfile in fileio.o
      _readfile in fileio.o
...

The problem has to do with lib search path. I don’t know yet why isn’t used the system path (under /usr/lib) rather than the one used by macports.

Well, the thing is that the libiconv2.dylib under /opt/local/lib doesn’t have the _iconv_close function (among others):

[madtrick { lib } ]pwd
/opt/local/lib
 
[madtrick { lib } ]nm libiconv.2.dylib | grep "iconv_close"
000163f0 T _libiconv_close

While libiconv.2.dylib on /usr/lib does:

[madtrick { lib } ]pwd
/usr/lib
 
[madtrick { lib } ]nm libiconv.2.dylib | grep "iconv_close"
0000b905 T _iconv_close
0000fcce T _libiconv_close

So to fix this problem you have several choices:

  • Deactivate libiconv on macports (and all its dependencies)
  • Prepend a lib path

I went for the second one:

LDFLAGS="-L/usr/lib" ./configure _your_options_here_

There you go : )

Category: mac, tweaks 4 comments »

4 Responses to “mac: Install MacVim”

  1. Ignacio De La Madrid

    Dude, your fix is great! I know there are a lot of people having this problem and I am sure your fix has been of HUGE help. Thanks a lot :)

  2. farruco

    You’re welcome : )

  3. w3rd

    could you explain what the LDFLAGS does? I’ve had to use a solution like this twice but no one has ever explained why

  4. Allen

    Thanks!

    @w3rd: the DLFAGS is an evironment variable used my the linker (which builds the executable from the various compiled c-program files (object files). This command line sets an environment variable, then executes the command

    VARIABLE=”value” command
    LDFLAGS=”-L/usr/lib” ./configure _your_options_here_

    The “-L” flag tells the linker to look in that path to find the references system libraries to include, much like the “PATH” variable contains the list of directories to search to find a command file to load and execute.

    In this case, we tell the linker to first look in the OSX system libraries (/usr/lib) before the macport libraries (/opt/local/lib). Sometimes macports builds versions with subtle differences that are not universally compatible.


Leave a Reply