Image2010, how to get Ximdisp working in Mac OS X


A while back (actually, right here image2010) I wrote about how to compile image2010 in Mac OS X. The name of my blog says it all, I favor Mac OS X for many reasons. But, some of the things you see here might help you.
So, getting down to business, I am going to address the compilation of Ximdisp (tip of the hat to Patrick, who requested this).
Previously, I just pointed out the instructions to get image2010 compiled. Those were pretty straight forward… Now, back then Ximdisp was not working but I did not need that so I did not care much for it.
Now I am going to address this oversight directly. So, if you are going this way, re-read the previous instructions and stop right before
./rebuild_image_gfortran
Ok, are you ready? Did you stopped before the above command?
If you did, it is ok.
If you didn't, most of the compiling should have gone fine until almost the end.
In my case, I got lots of errors. A few are “readable”, such as Ximagelibc.c:68:27: error: X11/Intrinsic.h: No such file or directory.
Others are less clear, mv: Ximdisp.exe: No such file or directory
To fix this, we have to dig into the Ximdisp folder. In there, we need to open three files:
Ximdisp.bld.gfortran
rebuild_Ximagelib_gfortran
rebuild_harwell_gfortran
And to fix them, we need to use another Mac OS X tool, mdfind. Taking a cue from the error I quoted above, I issued the following command:
mdfind -name Intrinsic.h
The relevant result, in my case, is /opt/X11/include/X11/Intrinsic.h (Not sure it is because I am using Mac OS X 10.8, but it is slightly different in my OS X 10.6).
So, to begin the fixing, let's open Ximdisp.bld.gfortran, and go to line 7, the one that reads :

gfortran -w -ffixed-line-length-132 -o Ximdisp.exe -L/usr/X11R6/lib64/ Ximdisp.f \
We need to change it to:
gfortran -w -ffixed-line-length-132 -o Ximdisp.exe -L/opt/X11/lib/ -I/opt/X11/include/ Ximdisp.f \

Notice that you should put in the path your mdfind result showed.
Ok, let's move on to rebuild_harwell_gfortran. Open it, move to line 7 and replace:

gfortran -w -c -ffixed-line-length-132 *.f
With:
gfortran -L/opt/X11/lib/ -I/opt/X11/include/ -w -c -ffixed-line-length-132 *.f

And, for the last one, rebuild_Ximagelib_gfortran. Open it and go to line 7 first:

gfortran -ffixed-line-length-132 -w -fno-second-underscore -c Ximagelibf.f
And change it to:
gfortran -L/opt/X11/lib/ -I/opt/X11/include/ -ffixed-line-length-132 -w -fno-second-underscore -c Ximagelibf.f

And also change line 8 from:

gcc -c Ximagelibc.c
to:
gcc -L/opt/X11/lib/ -I/opt/X11/include/ -c Ximagelibc.c

Done? Did you saved all of your changes? Good, now run:
./rebuild_image_gfortran
Now, everything should have work. All the errors I get are harmless. Go ahead, try:
bin/Ximdisp.exe
That should open the GUI.

Well, that's all for now. Have fun.

Comments

Popular Posts