I want to install the latest gcc49
in a Ubuntu Linux, and I am familiar with Homebrew
in Mac, so I would like to use the Linux version of it, i.e., Linuxbrew
. So I installed Linuxbrew
and typed
$ brew install gcc49
The dependencies gmp4
, mpfr2
and etc. will be installed first. I have added a if OS.mac?
condition in gmp4
so it can be installed successfully, but when installing mpfr2
(also added the condition), the make check
failed with the error:
...
/tmp/mpfr2-i5YD/mpfr-2.4.2/tests/.libs/lt-tpow_all: error while loading shared libraries: libgmp.so.3: cannot open shared object file: No such file or directory
FAIL: tpow_all
=======================
148 of 148 tests failed
=======================
As you can see, the tests can not find libgmp.so.3
which is just installed. But gmp4
is keg only since it will conflict with gmp in main repository.
But the configure options are set with the correct location of gmp4
:
./configure --disable-dependency-tracking --prefix=/home/dongli/.linuxbrew/Cellar/mpfr2/2.4.2 --with-gmp=/home/dongli/.linuxbrew/opt/gmp4
How to solve this problem? Thanks!
I found the problem, that is the environment has been reset after each system
call in Ruby formula. So we need to set the correct LD_LIBRARY_PATH
as
if OS.linux?
ENV["LD_LIBRARY_PATH"] = "#{Formula["..."].opt_prefix}/lib:...:$LD_LIBRARY_PATH"
end
so that LD_LIBRARY_PATH
persists during the build processes.