Another Mac installation problem

10 posts / 0 new
Offline
Joined: 01/07/2010 - 12:53
Another Mac installation problem

Hi folks

I am also having a problem installing and using OpenMx on a Max running snow leopard. This is true both with my desktop Mac and a new Macbook running R 2.10.1 (brand new download). It seems to download the package ok, but when I try to require Open Mx, I get:

> require(OpenMx)
Error in dyn.load(file, DLLpath = DLLpath, ...) :
unable to load shared library '/Library/Frameworks/R.framework/Resources/library/OpenMx/libs/i386/OpenMx.so':
dlopen(/Library/Frameworks/R.framework/Resources/library/OpenMx/libs/i386/OpenMx.so, 6): Library not loaded: /usr/local/lib/libgfortran.2.dylib
Referenced from: /Library/Frameworks/R.framework/Resources/library/OpenMx/libs/i386/OpenMx.so
package 'OpenMx' was built under R version 2.9.2 and help may not work correctly

This seems similar but not identical to the problems that some other people have been having. Is it to do with the version of R I have dowloaded (I went for R-2.10.1.dmg, which includes Fortran libraries).

Many thanks if anyone can help

Daniel

Offline
Joined: 02/14/2010 - 04:24
There are quite a few

There are quite a few different approaches to this problem posted on the OpenMx forums. After a few tries and a bit of a crash course in unix, this is what worked for me. Give it a try if, like me, you're not completely
comfortable with computer language. Basically, it's exactly the same as everyone else has written but I've added a line of code. As a note, I am running snow leopard (10.6.2) and have R version 2.10.1

In my terminal window, I entered the following:

> cd /usr/local/lib

my-computer:lib username$> sudo ln -s /Library/Frameworks/R.framework/Versions/2.10/Resources/lib/libgfortran.2.dylib /usr/local/lib/libgfortran.2.dylib all of the above also should be entered on one line > file /usr/local/lib/libgfortran.2.dylib another double-check output: /usr/local/lib: directory my-computer:lib username$ file /usr/local/lib/libgfortran.2.dylib
/usr/local/lib/libgfortran.2.dylib: Mach-O universal binary with 4 architectures
/usr/local/lib/libgfortran.2.dylib (for architecture i386): Mach-O
/usr/local/lib/libgfortran.2.dylib (for architecture ppc): Mach-O dynamically
/usr/local/lib/libgfortran.2.dylib (for architecture x86_64): Mach-O 64-bit
/usr/local/lib/libgfortran.2.dylib (for architecture ppc64): Mach-O 64-bit

Open R and require(OpenMx) then you're good to go.

Offline
Joined: 08/04/2009 - 16:01
Just to provide confirmation

Just to provide confirmation on Horn's directions, I followed them and now my OpenMx is loading correctly in R. I'm using R 2.10.1 on Snow Leopard.

Thanks for posting the details of how to appropriately get the dynamic libraries linked.

Ken

Offline
Joined: 07/31/2009 - 15:10
It's worth noting that when

Offline
Joined: 05/09/2010 - 20:17

Hi I had similar problems trying to instal Mx on R11.0
I followed the directions from horn, modified for version 11 in obvious way. Here's a blow-by-blow:

1) Installed R11.0 for mac
> version
_
platform i386-apple-darwin9.8.0
arch i386
os darwin9.8.0
system i386, darwin9.8.0
status
major 2
minor 11.0
year 2010
month 04
day 22
svn rev 51801
language R
version.string R version 2.11.0 (2010-04-22)

2) quit newly installed R

3) Set the link for libgfortran and checked results
> cd /usr/local/lib

> sudo ln -fs /Library/Frameworks/R.framework/Versions/2.11/Resources/lib/libgfortran.2.dylib /usr/local/lib/libgfortran.2.dylib

used -fs instead of -s and changed to ...Versions/2.11

> ls -l /usr/local/lib/libgfortran.2.dylib
lrwxr-xr-x 1 root wheel 79 May 11 13:26 /usr/local/lib/libgfortran.2.dylib -> /Library/Frameworks/R.framework/Versions/2.11/Resources/lib/libgfortran.2.dylib

>file /usr/local/lib/libgfortran.2.dylib
/usr/local/lib/libgfortran.2.dylib: Mach-O universal binary with 4 architectures
/usr/local/lib/libgfortran.2.dylib (for architecture i386): Mach-O dynamically linked shared library i386
/usr/local/lib/libgfortran.2.dylib (for architecture ppc): Mach-O dynamically linked shared library ppc
/usr/local/lib/libgfortran.2.dylib (for architecture x86_64): Mach-O 64-bit dynamically linked shared library x86_64
/usr/local/lib/libgfortran.2.dylib (for architecture ppc64): Mach-O 64-bit dynamically linked shared library ppc64

5) Started the newly installed R
Tried to start OpemMx. Got error reported above.
> require(OpenMx)
Error in dyn.load(file, DLLpath = DLLpath, ...) :
unable to load shared library '/Users/tnearey/Library/R/2.11/library/OpenMx/libs/i386/OpenMx.so':
dlopen(/Users/tnearey/Library/R/2.11/library/OpenMx/libs/i386/OpenMx.so, 6): Library not loaded: /Library/Frameworks/R.framework/Versions/2.10/Resources/lib/libRblas.dylib
Referenced from: /Users/tnearey/Library/R/2.11/library/OpenMx/libs/i386/OpenMx.so

Followup questions:
a) Is the following excerpt relevant?

b) If so could the Mx team add above code to their install instructions or script for Mac OS? ( I've never had these kinds of problems with other R packages.)
Start excerpt--------
(From http://cran.r-project.org/bin/macosx/RMacOSX-FAQ.html 5.6 Building universal packages)
If you want to share a binary with multiple users and don't want to require them to install Xcode, you can use the same approach as CRAN but only if you use the same tools as we do on CRAN. It means to change the path of the FORTRAN dynamic library (libgfortran) to point inside the R version that you are compiling for. For example, if you have installed a universal package FOO for R 2.11.x, you can change the paths as follows:

 # change into the library where you installed FOO
cd /Library/Frameworks/R.framework/Resources/library
# fix the Fortran paths in FOO to point to R 2.11 instead
for lib in ls FOO/libs/*/*.so; do
install_name_tool -change /usr/local/lib/libgfortran.2.dylib \
/Library/Frameworks/R.framework/Versions/2.11/Resources/lib/libgfortran.2.dylib \
\$lib
done


End excerpt ---------

Cheers,

-T Nearey

Offline
Joined: 07/31/2009 - 15:24
The installation is looking

The installation is looking for /Library/Frameworks/R.framework/Versions/2.10/Resources/lib/libRblas.dylib. This is not present on your system I'm assuming because R 2.10 is not installed. You could either install R 2.10 or place a symbolic link from /Library/Frameworks/R.framework/Versions/2.10/Resources/lib/libRblas.dylib to /Library/Frameworks/R.framework/Versions/2.11/Resources/lib/libRblas.dylib.

Yes, the answer in the FAQ is relevant. We have been meaning to change the build process to the new system. However, it is a non-trivial operation and if we get it wrong then the installer works for nobody. We'll try to bump its priority.

Offline
Joined: 05/09/2010 - 20:17

Sorry ...I now see I didn't read my output carefully enough in my first posting. I'll try one of your suggestions.
I got the same error when I tried to implement the FAQ procedure (just before I rechecked this thread)
.
I can see why the change to the FAQ method would be tricky.
Maybe adding a web link to this thread on the Mac install instructions would be warranted in the meantime.

-tnearey

Offline
Joined: 07/31/2009 - 15:24
No problem. Also, I might

No problem. Also, I might not done the best job of explaining myself. It might work if you have a side-by-side installation of R 2.10.x and 2.11.x on your machine. I can't remember if you're allowed to do this with the R mac installs. I know downgrading to R 2.10.x is not a long-term solution.

Let me work on implementing the FAQ tonight. One change on our server: currently the 2.11.x binaries are symbolic links to the 2.10.x binaries. We'll have to change that.

Offline
Joined: 07/31/2009 - 15:24
I think it's working now! The

I think it's working now! The packages available from the website should work on vanilla installations of R 2.9.x, 2.10.x, and 2.11.x on OS X, without any more changes to find libraries. I've tested the install on machines with 2.9 and 2.10. Yes, ironic and shame on me for not having a 2.11 machine available. Please write back if it's not working.

Offline
Joined: 05/09/2010 - 20:17
Thanks! Confirming it works

Thanks!
Confirming it works no problem on R2.11 on Mac OS 10.5.8.