R library breaks due to failure in loading dyld - homebrew

I have installed r with Homebrew and installed the INLA package for spatial analysis.
Unfortunately when using this module I get the following error:
dyld: Library not loaded: /usr/local/opt/xz/lib/liblzma.5.dylib
Referenced from: /usr/local/Cellar/r/3.4.1_1/lib/R/lib/libR.dylib
Reason: Incompatible library version: libR.dylib requires version 8.0.0 or later, but liblzma.5.dylib provides version 6.0.0
I have already installed the xz library with Homebrew which installs liblzma, otool -L /usr/local/lib/liblzma.5.dylib returns:
/usr/local/lib/liblzma.5.dylib:
/usr/local/opt/xz/lib/liblzma.5.dylib (compatibility version 8.0.0, current version 8.3.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1238.0.0)
This seem to indicate that I have the required version despite the exception raised by r.
Any help solving this issue will be deeply appreciated.

I haven't been able to solve the problem with the Homebrew r, but I decided instead to install the packaged version of R from the CRAN website.
The libR.dylib from the package version does not seem to depend on liblzma.5.dylib. INLA then works without error.
Any answer that manages to use Homebrew r should probably be upvoted.

In my case a similar error was fixed by reinstalling xz with the commands below, then reinstalling the r package.
brew unlink xz
brew reinstall xz

Related

GDAL: library not loasded libhdf5.100.dylib

I would like to run a GMT file wrote in tcsh environment. When I'm running it, I have the following error message :
dyld: Library not loaded: /opt/local/lib/libhdf5.100.dylib
Referenced from: /opt/local/lib/gmt4/bin/gmtset
Reason: image not found
I went to /opt/local/lib path, and indeed, libhdf5.103.dylib is installing, and not libhdf5.100.dylib. I did not find a way to reinstall libhdf5.100.dylib using port or brew.
The later doesn't work :
sudo port install libhdf5-100
sudo port install libhdf5.100
sudo port install libhdf5.100.dylib
I already try:
brew reinstall osgeo-gdal --build-from-source
But, this doesn't work. I have the following issue:
Warning: You are using macOS 10.11.
We (and Apple) do not provide support for this old version.
You will encounter build failures with some formulae.
Please create pull requests instead of asking for help on Homebrew's GitHub,
Discourse, Twitter or IRC. You are responsible for resolving any issues you
experience while you are running this old version.
qt: macOS Sierra or newer is required.
Error: An unsatisfied requirement failed this build.
Do you have any ideas?
Thank you.
Looks like gdal needs to be rebuilt with the current hdf5. You can try:
sudo port uninstall gdal && sudo port install -s gdal
This will build gdal from source and link against the installed HDF5 library.

Distributing gfortran-compiled binary to Mac OS X users who don't have Xcode?

I'm teaching a class in which I would like students to run a precompiled command-line program on their own laptops. Some students have Windows; others have Mac. I was able to create a self-contained binary that the Windows users can just drop into their working directory and run.
To my surprise, I'm finding it far more difficult to do the same thing for Mac users. In particular, it appears to be impossible to compile a standalone binary program with all required libraries statically linked. The particular libraries that need to be present are libgfortran and libquadmath, since the gfortran compiler is used to compile the legacy F77 code (and it's too big a program to convert to another language).
So the only potentially workable solution I've found so far is for students to first install Xcode, then Xcode's command line tools, and finally gfortran on their own computer before my executable will find the gfortran library and run. But this is way too much work (and disk space) for what I want them to do.
My question: is there a way I'm overlooking to compile my program in completely self-contained form? Obviously it's hard for me to experiment, because it involves other people's computers.
EDIT: I found the following post which describes essentially the same problem: https://groups.google.com/forum/#!topic/comp.lang.fortran/TPEQQEwa0HI
Unfortunately, the solution given doesn't work for me, even after I delete some options and make appropriate substitutions.
The solution you linked to includes the -static-libgfortran, but not -static-libgcc, so it may be worth adding the second of these.
For a barebones Hello World code, I get:
[~] oldrabbit $ otool -L a.out
a.out:
/usr/local/opt/gcc/lib/gcc/8/libgfortran.5.dylib (compatibility version 6.0.0, current version 6.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1226.10.1)
/usr/local/lib/gcc/8/libgcc_s.1.dylib (compatibility version 1.0.0, current version 1.0.0)
/usr/local/opt/gcc/lib/gcc/8/libquadmath.0.dylib (compatibility version 1.0.0, current version 1.0.0)
[~] oldrabbit $ gfortran -static-libgfortran -static-libgcc hello.f90
[~] oldrabbit $ otool -L a.out
a.out:
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1226.10.1)
/usr/local/opt/gcc/lib/gcc/8/libquadmath.0.dylib (compatibility version 1.0.0, current version 1.0.0)
so looks like the libquadmath library might still be a problem. If you can find the path to the .a version of that, you could try including it like in the example you linked to.
a solution would be to ship the executable and the libquadmath by using install_name_tool:
cp -f /usr/local/Cellar/gcc/10.2.0_4/lib/gcc/10/libquadmath.0.dylib .
install_name_tool -change $i #executable_path/libquadmath.0.dylib a.out
Of course the second command must be done every time you recompile your binary

valgrind installation using brew on macOS High Sierra 10.13.2

I get the following error when trying to install valgrind on the version of macOS using brew:
valgrind: This formula either does not compile or function as expected
on macOS versions newer than Sierra due to an upstream
incompatibility. Error: An unsatisfied requirement failed this build.
I have tried to follow suggestions from all related posts on the issue, and even tried building valgrind using the ./configure option after downloading the source tarball. But that too fails with a gcc incompatibility error, which I am unable to overcome, despite following workaround suggestions on the Web.
Any help would be appreciated.
TIA
Vinod
brew install --HEAD valgrind seems to work now.
See this issue for more details.
You may wish to build it directly and install instead of using home-brew. I have created a port of valgrind 3.13.0 to work on macOS High Sierra (10.13.x). You can get it here: https://github.com/padiakalpesh/valgrind_3.13_high_sierra
Once you have obtained the source, run the following commands from inside the source directory:
./configure
make
sudo make install

Error while building Bazel 0.5.3 on ppc64le

I'm trying to build bazel 0.5.3 on Ubuntu 16.04, Linux ppc64le. I want to know the required PROTOC and GRPC_JAVA_PLUGIN versions for bazel 0.5.3.
With protoc 3.2.0 and grpc-java 1.0.0, I'm getting below error-
./compile.sh
INFO: You can skip this first step by providing a path to the bazel binary as second argument:
INFO: ./compile.sh compile /path/to/bazel
🍃 Building Bazel from scratch./opt/DL/protobuf/bin/protoc -Isrc/main/protobuf/ -Isrc/main/java/com/google/devtools/build/lib/buildeventstream/proto/ --java_out=/tmp/bazel_ltKtch3G/src --plugin=protoc-gen-grpc=/pkgbuild/bazel/protoc-gen-grpc-java --grpc_out=/tmp/bazel_ltKtch3G/src src/main/java/com/google/devtools/build/lib/buildeventstream/proto/build_event_stream.proto
src/main/protobuf/invocation_policy.proto: File not found.
build_event_stream.proto: Import "src/main/protobuf/invocation_policy.proto" was not found or had errors.
build_event_stream.proto:261:3: "blaze.invocation_policy.InvocationPolicy" is not defined.
I think it is because of incompatible protoc/grpc-java version. Kindly help me on this.
Thanks in advance,
Nishidha
You can check the versions here:
https://github.com/bazelbuild/bazel/tree/0.5.3/third_party/protobuf
https://github.com/bazelbuild/bazel/tree/0.5.3/third_party/grpc
So it seems Bazel 0.5.3 depends on grpc 1.3.0 and protobuf 3.2.0.
Just to make sure, you did download the distribution archive, right? compile.sh doesn't work with cloned git repo.
FYI, you can also try Bazel 0.5.4 as it was released recently.

How do I install rpy2 when clang doesn't support OpenMP (Mac OSX)?

I am trying to use pip to install rpy2 on OSX 10.12.5. I get this error:
clang: error: unsupported option '-fopenmp'
clang: error: unsupported option '-fopenmp'
error: command '/usr/bin/clang' failed with exit status 1
From what I understand, this is because my version of clang does not support OpenMP. Using homebrew, I installed LLVM 8.1.0 (clang 802.0.42), but now I need to update clang to support OpenMP. Can anyone give me detailed instructions of how to go about this? I am not understanding the other sources I am reading online.
I just got rpy2-2.9.0 to install via pip on Mac OSX 10.13, after getting the same error you reported, by downgrading to R 3.3.3, downloaded from https://cran.r-project.org/bin/macosx/. I just re-installed R 3.3.3 then re-ran 'pip install rpy2' and it installed fine.

Resources