[xcrysden] Success: Building XCD 1.5.24 with shared libs on OS X
David M. Wood
dmwood at mines.edu
Mon Jul 25 20:31:39 CEST 2011
After long travails, I have succeeded in building a functioning version of 1.5.24. It is somewhat disturbing how difficult this has been. (It appears to have succeeded today only because of new Mesa and OpenGL libraries from MacPorts.)
I attempt to give here a quick prescription for building xcd 1.5.24 using external libraries provided by the MacPorts system: http://www.macports.org/ . [Remember why this is potentially useful: you can use, e.g., libraries which are tweaked for your particular architecture; macports is also well maintained.] Because this process has been spread out over many weeks, I undoubtedly have forgotten to specify something; please let me know if so. I built this under Mac OS X 10.6.8 (Snow Leopard); I'll follow up if things are significantly different under Lion (10.7).
0. Make sure you have Xcode and relevant Developer (e.g, X11) packages installed
1. Install a barebones MacPort tree (again, from www.macports.org)
2. Install, in no particular order (port will take care of dependencies)
gfortran 4.5 [which will end up being named gfortran-mp-4.5 in /opt/local/bin], although earlier versions (e.g., 4.3) worked for me. This should automatically install gcc.
NB: port install gcc45 +variant:gfortran is an EXAMPLE of how to install a variant of a particular port package.
Each install will provoke a cascade of other downloads and install; be patient.
3. Use the Make.sys file below
4. Type "make all"
5. Test on .xsf or .xcrysden files
Carefully inspect the directories and libraries mentioned in Make.sys; if you don't have the ones mentioned, you may not have installed the corresponding MacPorts packages.
=========BEGINNING OF Make.sys==============
MAKE = make
CC = /opt/local/bin/gcc-mp-4.5
#Need the have-no-getline
CFLAGS = -O2 -m64 -L/opt/local/lib -DXC_HAVE_NO_GETLINE
MATH = -lm
FC = /opt/local/bin/gfortran-mp-4.5
FFLAGS = -O2 -m64 -L/opt/local/lib
#DMW: See notes for CFLAGS above
X_LIB = -L/opt/local/lib -lXmu -lX11 -lXext
X_INCDIR = -I/opt/local/include
# If you want to use your own libraries and include files,
# then set *_LIB and *_INCDIR variables below accordingly:
COMPILE_TCLTK = no
COMPILE_MESA = no
TK_LIB = -L/opt/local/lib -ltk8.5
TCL_LIB = -L/opt/local/lib -ltcl8.5
GLU_LIB = -L/opt/local/lib -lGLU
GL_LIB = -L/opt/local/lib -lGL
MESCHACH_LIB = -L/opt/local/lib -lmeschach
FFTW3_LIB = -L/opt/local/lib -lfftw3
LDLIB = -L/opt/local/lib
# Include directories
MESCHACH_INCDIR = -I/opt/local/include/meschach
FFTW3_INCDIR = -I/opt/local/include
=========END OF Make.sys==============
I readily made a XCrySDen-1.5.24-bin-shared.tar.gz file but assume this won't work unless boatloads of libraries (above) are present.
Hope this helps!
David M. Wood, Dept. of Physics, Colorado School of Mines, Golden, CO 80401
Phone: (303) 273-3853; Fax: (303) 273-3919
More information about the XCrySDen