“brew install r” error: dyld: Symbol not found: _rl_sort_completion_matches #15063

Closed
lifepillar opened this Issue Sep 23, 2012 · 30 comments

Projects

None yet
@lifepillar

On trying to install R 2.15.1, I am experimenting the same bug as in #7950:

brew install -d r
...
dyld: Symbol not found: _rl_sort_completion_matches
Referenced from: /private/tmp/brew-r-2.15.1-J0oL/R-2.15.1/lib/libR.dylib
Expected in: flat namespace
in /private/tmp/brew-r-2.15.1-J0oL/R-2.15.1/lib/libR.dylib
...
otool -L lib/libR.dylib
lib/libR.dylib:
libR.dylib (compatibility version 2.15.0, current version 2.15.1)
libRblas.dylib (compatibility version 0.0.0, current version 0.0.0)
/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 635.21.0)
/usr/lib/libedit.3.dylib (compatibility version 2.0.0, current version 3.0.0)
/usr/local/lib/liblzma.5.dylib (compatibility version 6.0.0, current version 6.4.0)
/usr/lib/libicucore.A.dylib (compatibility version 1.0.0, current version 46.1.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 159.1.0)
/usr/lib/libiconv.2.dylib (compatibility version 7.0.0, current version 7.0.0)

It is linking against libedit instead of readline. Any idea why? I have run brew update, and Homebrew “is raring to brew”.

@langloisjp

Ran into the same problem on lion. I worked around it by manually editing the r.rb file according to https://github.com/mxcl/homebrew/pull/8628/files#diff-0 (needed just the ENV stuff).

@jacknagel

Does this happen if you build with --env=std?

@redacted

Just chiming in: I had the same issue with R linking against libedit.

Building with --env=std fixed the issue for me.

@jacknagel

@mxcl potential superenv issue here.

@mxcl
Member
mxcl commented Sep 28, 2012

Built for me! Need some brew --config outputs please.

$ brew install r
==> Downloading http://cran.r-project.org/src/base/R-2/R-2.15.1.tar.gz
Already downloaded: /Library/Caches/Homebrew/r-2.15.1.tar.gz
==> Using Homebrew-provided fortran compiler.
This may be changed by setting the
==> ./configure --prefix=/usr/local/Cellar/r/2.15.1 --with-aqua --enable-R-frame
==> make
==> make install
==> Downloading http://rcompletion.googlecode.com/svn-history/r28/trunk/bash_com
######################################################################## 100.0%
==> Caveats
R.framework was installed to:
  /usr/local/Cellar/r/2.15.1/R.framework

To use this Framework with IDEs such as RStudio, it must be linked
to the standard OS X location:
  ln -s "/usr/local/Cellar/r/2.15.1/R.framework" /Library/Frameworks

To enable rJava support, run the following command:
  R CMD javareconf JAVA_CPPFLAGS=-I/System/Library/Frameworks/JavaVM.framework/Headers
==> Caveats
Bash completion has been installed to:
  /usr/local/etc/bash_completion.d
==> Summary
/usr/local/Cellar/r/2.15.1: 1451 files, 52M, built in 20.7 minutes
@lifepillar

Thanks, I can confirm that setting ENV as per #8628 works, as well as building with --env=std. Without any of these, I still get the error. This is my brew --config:

HOMEBREW_VERSION: 0.9.3
HEAD: 9f78662acff4c3cb1bff3587c8ead7f5935925a9
HOMEBREW_PREFIX: /usr/local
HOMEBREW_CELLAR: /usr/local/Cellar
CPU: quad-core 64-bit sandybridge
OS X: 10.7.5-x86_64
Xcode: 4.5
CLT: 1.0.0.9000000000.1.1249367152
GCC-4.2: build 5666
LLVM-GCC: build 2336
Clang: 4.1 build 421
X11: 2.6.4 => /usr/X11
System Ruby: 1.8.7-358
Perl: /usr/bin/perl
Python: /usr/bin/python
Ruby: /Users/life/.rbenv/shims/ruby```
@Sharpie
Sharpie commented Sep 30, 2012

R builds fine for me under superenv as well. However, I think this may be the problem that is catching some people:

➜  ~  ls -l /usr/lib/libreadline.dylib 
lrwxr-xr-x  1 root  wheel  15 Oct 10  2011 /usr/lib/libreadline.dylib -> libedit.3.dylib

Apple ships a libreadline symlink in /usr/lib that points to libedit. The keg_only mechanics should be putting our libreadline at the front of the library search path to counter situations like this.

My best guess is that the users running into problems may have some additional variable set, such as DYLD_LIBRARY_PATH or LIBRARY_PATH that is overriding the keg_only mechanics. Since this bug appears to only show up under superenv, perhaps it is a variable that is cleared by stdenv but not superenv.

@adamv
adamv commented Sep 30, 2012

Some DYLD nonsense is caught by brew doctor, might need to tighten that check if this turns out to be the case.

@Sharpie
Sharpie commented Sep 30, 2012

I think I igured it out by dumping environment variables.

brew install r -i --env=std followed by export shows that CPPFLAGS and LDFLAGS are being set by keg_only. On the other hand, brew install r -i uses superenv and CPPFLAGS and LDFLAGS are not set.

So, it looks like superenv is breaking keg_only mechanics.

@jacknagel

For superenv the place to look is in the cc wrapper in Library/ENV/4.3, and figure out what order things are being placed in the flags passed on to the real tools.

@mxcl
Member
mxcl commented Oct 2, 2012

To know what superenv does export HOMEBREW_LOG=1 and tail ~/Library/Logs/Homebrew/cc.log. It outputs the full cc instantiation.

I intend to make this output with make output since it's inconvenient.

@mxcl
Member
mxcl commented Oct 2, 2012

Still worksforme. Can't fix without some gisted verbose output.

@mcooganj
mcooganj commented Oct 3, 2012

same error -- same fix.

$ brew install R --env=std

the error was:

==> make
31747 Trace/BPT trap: 5 | R_DEFAULT_PACKAGES=NULL ../../../bin/R --vanilla --slave > /dev/null
make[3]: *** [all] Error 133
make[2]: *** [R] Error 1
make[1]: *** [R] Error 1
make: *** [R] Error 1

@lifepillar

Sorry for coming back so late. You may find the output of brew install -v r and the content of cc.log at https://gist.github.com/3892046.

@mcooganj

Thanks

On 15/10/2012, at 10:40 PM, Lifepillar notifications@github.com wrote:

Sorry for coming back so late. You may find the output of brew install
-v rand the content of
cc.log at https://gist.github.com/3892046.


Reply to this email directly or view it on
GitHubhttps://github.com/mxcl/homebrew/issues/15063#issuecomment-9442062.

@lvnilesh

brew install r and it errored out.

https://gist.github.com/3984251
https://gist.github.com/3984253
https://gist.github.com/3984257

➜  ~  brew install r
==> Downloading http://cran.r-project.org/src/base/R-2/R-2.15.2.tar.gz
Already downloaded: /Library/Caches/Homebrew/r-2.15.2.tar.gz
==> Using Homebrew-provided fortran compiler.
This may be changed by setting the FC environment variable.
==> ./configure --prefix=/usr/local/Cellar/r/2.15.2 --with-aqua --enable-R-frame
==> make
20 errors generated.
make[3]: *** [aqua.o] Error 1
make[2]: *** [R] Error 2
make[1]: *** [R] Error 1
make: *** [R] Error 1

Error: r did not build
Logs: /Users/nilesh/Library/Logs/Homebrew/r/
Help: https://github.com/mxcl/homebrew/wiki/troubleshooting
  https://github.com/mxcl/homebrew/issues/14910
  https://github.com/mxcl/homebrew/issues/15063
  https://github.com/mxcl/homebrew/issues/15739`
@2bits
2bits commented Oct 31, 2012

@lifepillar You posted a log containing the dyld error flat namespace issue. Thanks.
@lvnilesh Your log showed a much different error. Please open a new issue for that and include your brew --config and brew doctor outputs.

@2bits
2bits commented Oct 31, 2012

fwiw I just had success on ML doing brew install -v r. So I can't reproduce this.

@hobson
hobson commented Nov 15, 2012

fails for me on Lion

$ brew install r --env=std
==> Downloading http://cran.r-project.org/src/base/R-2/R-2.15.2.tar.gz
Already downloaded: /Library/Caches/Homebrew/r-2.15.2.tar.gz
==> Using Homebrew-provided fortran compiler.
This may be changed by setting the FC environment variable.
==> ./configure --prefix=/usr/local/Cellar/r/2.15.2 --with-aqua --enable-R-frame
checking for C libraries of /usr/bin/clang... -L/usr/local/opt/readline/lib -L/usr/local/lib -L/opt/X11/lib -lSystem /usr/bin/../lib/clang/4.1/lib/darwin/libclang_rt.osx.a
checking for dummy main to link with Fortran 77 libraries... none
checking for Fortran 77 name-mangling scheme... configure: error: in /private/tmp/r-T8pY/R-2.15.2': configure: error: cannot compile a simple Fortran program Seeconfig.log' for more details

READ THIS: https://github.com/mxcl/homebrew/wiki/troubleshooting

These open issues may also help:
#15063
#16096
hobs@Hobsons-MacBook-Pro:~

$ ls -l /usr/lib/libreadline.dylib
lrwxr-xr-x 1 root wheel 15 Jul 21 19:19 /usr/lib/libreadline.dylib@ -> libedit.3.dylib

$ brew --config
HOMEBREW_VERSION: 0.9.3
HEAD: 162e84d
HOMEBREW_PREFIX: /usr/local
HOMEBREW_CELLAR: /usr/local/Cellar
CPU: 8-core 64-bit ivybridge
OS X: 10.8.2-x86_64
Xcode: 4.5.2
CLT: 4.5.0.0.1.1249367152
GCC-4.2: build 5666
LLVM-GCC: build 2336
Clang: 4.1 build 421
X11: 2.7.4 => /opt/X11
System Ruby: 1.8.7-358
Perl: /usr/bin/perl
Python: /usr/local/bin/python => /usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/bin/python2.7
Ruby: /usr/bin/ruby => /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby

$ export
declare -x CPPFLAGS="-I/usr/local/opt/readline/include -I/opt/X11/include"
declare -x LDFLAGS="-L/usr/local/opt/readline/lib -L/usr/local/lib -L/opt/X11/lib"

@2bits
2bits commented Nov 15, 2012

You seem to have gcc installed, which might have a gfortran that's confusing things. I believe this is meant to work well if you

brew install gfortran
brew install r

as versus using a gcc install. Is that the case?

@samueljohn

brew install r builds for me on 10.8 with Xcode-only setup (so I don't have the CLT installed).

Anybody having this problem running a Xcode-only system? Here is my brew --config

HOMEBREW_VERSION: 0.9.3
HEAD: 3103d8edb77658d3c6d45a7011559fee6311e376
HOMEBREW_PREFIX: /usr/local
HOMEBREW_CELLAR: /usr/local/Cellar
CPU: 8-core 64-bit sandybridge
OS X: 10.8.2-x86_64
Xcode: 4.5.2
CLT: N/A
LLVM-GCC: build 2336
Clang: 4.1 build 421
X11: 2.7.2 => /opt/X11
System Ruby: 1.8.7-358
Perl: /usr/bin/perl
Python: /usr/local/bin/python => /usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/bin/python2.7
Ruby: /usr/bin/ruby => /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby
@adamv
adamv commented Jan 3, 2013

Should I add env :std to R and close this?

@Sharpie
Sharpie commented Jan 3, 2013

Should I add env :std to R and close this?

Well, it might fix the problem. The issue is that we still haven't pinned down what exactly is causing this, so I don't know if forcing a standard environment build will fix the issue.

@samueljohn

At least I can isntall R with superenv. I don't need --env=std. I just tested this again. (I don't have installed the CLT for Xcode, so perhaps that is a clue?)

@adamv
adamv commented Jan 20, 2013

Will brew install -i be addressed in #17178?

@tyzao
tyzao commented Feb 20, 2013

update xcode command line tools and gfortran then install r -- finally worked for me

@lifepillar

I didn't have any problems updating R recently. I have the latest Xcode and command-line tools installed.
To be sure, I have just uninstalled R and installed it again with brew install r (no additional flags). All fine.

@Sharpie
Sharpie commented Feb 22, 2013

I'm pretty sure about what was happening here: R was getting linked against the system libedit via the /usr/lib/libreadline.dylib -> libedit.dylib symlink instead of our keg-only version of readline.

The part that I have no idea about is why it is happening. I've gone through 6 physical macs of various models and setups along with countless virtual machines and have never been able to trigger this. May want to consider closing as "cannot reproduce".

@adamv adamv closed this Feb 22, 2013
@semaperepelitsa

Updating gfortran helped me, thanks @tyzao. Can we add fortran version requirement to R formula?

$ brew install R
36425 Trace/BPT trap: 5       | R_DEFAULT_PACKAGES=NULL ../../../bin/R --vanilla --slave > /dev/null
$ brew upgrade gfortran
$ brew install R
@xu-cheng xu-cheng 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.