Fortran
So I managed quite easily to compile the fortran libraries on : Mac OS X 10.8.5.
The important features of my system are:
- X-Code 5.1.1 with its command-line developer tool
- gcc: Apple LLVM version 5.1 (clang-503.0.40) (based on LLVM 3.4 svn)
- gfortran : 4.8.1
and I followed the installation instructions indicated on : https://github.com/jowr/librefprop.so
everything worked fine until I called make fortest (in order to test the installation), the logs I got are :
make fortest
%-----------------------------
gfortran -O3 -ffast-math -fPIC -g -o ./src/ex_mix.o -c ./src/ex_mix.for
gfortran -g -o ./bin/ex_mix_for ./src/ex_mix.o -lrefprop -lgfortran
Undefined symbols for architecture x86_64:
"start", referenced from:
-u command line option
ld: symbol(s) not found for architecture x86_64
collect2: error: ld returned 1 exit status
make: [bin/ex_mix_for] Error 1
%-----------------------------
To make it work, I had to change it to:
%-----------------------------
gfortran -O3 -ffast-math -fPIC -g -o ./src/ex_mix.o -c ./src/ex_mix.for
gfortran -g -o ./bin/ex_mix_for ./src/ex_mix.o -lrefprop -lgfortran -lcrt1.o
%-----------------------------
Note: This can be done directly in the Makefile in the line 336.
and then it compiled properly. I don't know exactly why, I found on the web it has to do with some static libraries which are not linked without this option, but I am not a specialist....
Afterward I could execute ./bin/ex_mix_for
without any problem.
I hope this can help some users of Mac OS...
Matlab
Then, I wanted to get the Integration with Matlab
For sake of completeness I have a 64 bit installation (MATLAB_R2011a).
I performed the steps as indicated on: https://github.com/jowr/librefprop.so
- The first step of the manual work (as indicated during the make matlab) went w/o problem.
- Then the second step:
Open Matlab, and run: "cd /Users/thierrymeier/Documents/MATLAB/PhD/refProp9.1/librefprop.so-master/matlab;"
"run('thunk.m');"
proceed by pressing ENTER.
_rm matlab/refpropm.m.org matlab/rp_proto64.m.org_
There I had a problem while running thunk.m
, as I currently have two gcc compiler installed ( Apple LLVM version 5.1 and gcc4.8.1) but none of them correspond exactly to gcc-4.2. Thus I created a symlink:
sudo ln -s /usr/bin/gcc /usr/bin/gcc4.2
and it worked (I know its a little bit brute force but as a first shot...).
- I ran the
sudo make matlab-install
and the matlab function and the libraries were successfully copied in /opt/refprop as expected.
- running
path(path, '/opt/refprop')
permits to have a system wide use of the refprop functions.
- As I run
test.m
the refpropm function is called and Matlab crashes.... The log I get:
%-----------------------------
Process: MATLAB [2368]
Path: /Applications/MATLAB_R2011a.app/Contents/MacOS/StartMATLAB
Identifier: com.mathworks.matlab
Version: MATLAB Release 2011a (2.1)
Code Type: X86-64 (Native)
Parent Process: launchd [127]
User ID: 501
Date/Time: 2015-04-22 12:05:40.073 +0200
OS Version: Mac OS X 10.8.5 (12F2518)
Report Version: 10
Interval Since Last Report: 149802 sec
Crashes Since Last Report: 4
Per-App Interval Since Last Report: 14710 sec
Per-App Crashes Since Last Report: 3
Anonymous UUID: 0FA54308-2534-36FE-FC59-4636403F2392
Crashed Thread: 3
Exception Type: EXC_BREAKPOINT (SIGTRAP)
Exception Codes: 0x0000000000000002, 0x0000000000000000
_Dyld Error Message:
Symbol not found: _gfortran_transfer_character_write
Referenced from: /opt/refprop/librefprop.dylib
Expected in: /Applications/MATLAB_R2011a.app/sys/os/maci64/libgfortran.3.dylib
%-----------------------------
suggests a problem with the dylib library. To overcome it, I read the thread on w3.mathworks.com (here) where Nathan suggest to rename the DYLIB fil in the MATLAB application directory and create a symlink with the one located in /usr/local/lib
:
ln -s /usr/local/lib/libgfortran.3.dylib /Applications/MATLAB_R2011a.app/sys/os/maci64/libgfortran.3.dylib
and then everything works. I hope this can help some users of Mac OS...
I am not sure whether it is the nicest solution to do it, but who cares?
Cheers,
Tonkiplis