Jethro,
I've built mpb with Panther and a fink's g77. I used gcc 3.3 (because I'd
built g77 with that), and g77 3.4.3.
I'm not sure if this will help, but I've included my complete build notes
below; note that I built mpb a second time after upgrading to Panther (OS
X 10.4)--you might skip directly to "March 2006 build notes" to see how
that resembles what you did, and if it looks like it might help, read the
other notes as needed.
Hope this help,
Greg.
------------------mpb build notes: OS X-----------------------
Download and unpack the MPG stuff.
Install (binary) from Fink (for each package, install everything to be
safe,
shlibs, devel, etc.):
g77
fftw
hdf5
readline
guile-1.6
lammpi (if you want mpi)
Install (build from source) from Fink the unstable
libctl
But for libctl installation: see (in the mpb users list)
http://ab-initio.mit.edu/cgi-bin/mailman/private/mpb-discuss/2004-July/000051.ht
ml
for a description of a bug in libctl-2.2/base/ctl.c.
To apply the patch, add the following lines to libctl.patch in
the directory /sw/fink/dists/unstable/finkinfo/libs/ :
--- libctl-2.2/base/ctl.c.orig Wed Nov 17 10:19:37 2004
+++ libctl-2.2/base/ctl.c Wed Nov 17 10:19:50 2004
@@ -314,7 +314,7 @@
cmatrix3x3 cm;
cm.c0.x = make_cnumber(m00, 0);
cm.c1.y = make_cnumber(m11, 0);
- cm.c2.y = make_cnumber(m22, 0);
+ cm.c2.z = make_cnumber(m22, 0);
cm.c1.x = m01; cm.c0.y = cnumber_conj(m01);
cm.c2.x = m02; cm.c0.z = cnumber_conj(m02);
cm.c2.y = m12; cm.c1.z = cnumber_conj(m12);
(Do that before building and installing libctl; emacs will want to go into
diff-mode if the file has the .patch ending; Use M-x toggle-read-only to
be able to alter the file, and watch out for emacs changing other things
on its own authority -- diff the new and old file to make sure the only
changes are the added lines.)
Note: unstable MPI fftw libraries are available.
Apply patch to mpb? See (from mpb users list)
http://ab-initio.mit.edu/cgi-bin/mailman/private/mpb-discuss/2004-July/000066.ht
ml
Patch:
File: mpb-1.4.2/src/maxwell/maxwell_eps.c
Line 543: old:
m1 = s1 / MAX2(1, mesh_size[0] - 1);
m2 = s2 / MAX2(1, mesh_size[1] - 1);
m3 = s3 / MAX2(1, mesh_size[2] - 1);
Should be replaced by:
m1 = s1 / MAX2(1, mesh_size[0]);
m2 = s2 / MAX2(1, mesh_size[1]);
m3 = s3 / MAX2(1, mesh_size[2]);
Also, apply patch to mpb for "first-brillouin-zone" procedure
in mpb-ctl/mpb.scm.in; see (from mpb users list)
ab-initio.mit.edu/cgi-bin/mailman/private/mpb-discuss/2004-April/000007.html
Simply change mpb-ctl/mpb.scm.in as described; basically make it try
13 vectors instead of just (1 0 0), (0 1 0), and (0 0 1): Comment out
the two lines (shown commented out below) that define the try-all
procedure;
then add the lines following that that define "trylist" and then a new
version of "try-all."
; (define (try-all k)
; (try (try (try k (vector3 1 0 0)) (vector3 0 1 0)) (vector3 0 0 1)))
(define trylist (list
#(1 0 0) #(0 1 0) #(0 0 1)
#(0 1 1) #(1 0 1) #(1 1 0)
#(0 1 -1) #(1 0 -1) #(1 -1 0)
#(1 1 1)
#(-1 1 1) #(1 -1 1) #(1 1 -1) ))
(define (try-all k)
(fold-left try k trylist)
)
Here's the output from the diffing the one I changed:
diff -Naur mpb.scm.in.old mpb.scm.in
--- mpb.scm.in.old Thu Feb 27 15:49:25 2003
+++ mpb.scm.in Tue Jan 11 17:02:11 2005
@@ -296,8 +296,17 @@
(define (try+ k v)
(if (< (n (vector3+ k v)) (n k)) (try+ (vector3+ k v) v) k))
(define (try k v) (try+ (try+ k v) (vector3- (vector3 0) v)))
+; (define (try-all k)
+; (try (try (try k (vector3 1 0 0)) (vector3 0 1 0)) (vector3 0 0 1)))
+ (define trylist (list
+ #(1 0 0) #(0 1 0) #(0 0 1)
+ #(0 1 1) #(1 0 1) #(1 1 0)
+ #(0 1 -1) #(1 0 -1) #(1 -1 0)
+ #(1 1 1)
+ #(-1 1 1) #(1 -1 1) #(1 1 -1) ))
(define (try-all k)
- (try (try (try k (vector3 1 0 0)) (vector3 0 1 0)) (vector3 0 0 1)))
+ (fold-left try k trylist)
+ )
(define (try-all&repeat k)
(let ((knew (try-all k)))
(if (< (n knew) (n k)) (try-all&repeat knew) k)))
---------------
Do (in bash; cd to the proper directory for guile aliases):
ln -s guile-1.6 guile
ln -s guile-1.6-config guile-config
export LDFLAGS="-Wl,-framework -Wl,vecLib -L/sw/lib -lcc_dynamic"
export FLIBS="-L/sw/lib/gcc/powerpc-apple-darwin7.5.0/3.4.1
-L/sw/lib/gcc/powerp
c-apple-darwin7.5.0/3.4.1/../../.. -lm -lfrtbegin -lg2c -lSystem"
export CPPFLAGS="-I/sw/include"
./configure --with-libctl=/sw/share/libctl
make
sudo make install
(...then, to add mpbi, do:)
make distclean
./configure --with-libctl=/sw/share/libctl --with-inv-symmetry
make
sudo make install
----------Explanation:
ln -s ...:
If guile 1.6 is installed with the 1.6 after its name (i.e., guile-1.6
instead of guile, and guile-1.6-config instead of guile-config, etc.),
first
create symbolic links (in /sw/bin), because configure looks for guile, not
guile-1.6. (There are other guile-1.6 files, but these two above seem to
be
the ones that matter here.)
The environment variables tell where to find certain files. LDFLAGS gets
appended to commands calling the linker (ld). Note that it's
-Wl = -W"lower-case-L", not W1=W"one"
---------
-Wl,-framework -Wl,vecLib
tells the linker where to find the vecLib library (or framework). vecLib
comes with OS X (10.3) and contains blas and lapack routines. It's
actually located (with header files) in
/System/Library/Frameworks/vecLib.framework. Apple's preferred way to
link
in the library is with the option: -framework vecLib
which works for Apple's g++, but not for g77 that I downloaded from Fink
(and maybe not for other gccs than Apple's). But the -Wl method seems to
work for both. Interestingly, gcc seems to find the headers okay.
A program blastest.cpp with the line
#include <vecLib/cblas.h>
that is compiled with
g++ -framework vecLib blastest.cpp
or
g++ -Wl,-framework -Wl,vecLib
should be able to call blas routines without problem.
(or include vecLib/clapack for lapack routines)
-L/sw/lib
This line tells the linker to look for libraries in Fink's library
directory.
For instance, configure will try to call the linker with (e.g.) -lhdf5 and
-ldfftw, telling it to look for files libhdf5.a and libdfftw.a. Fink
installs those files are in /sw/lib.
-lcc_dynamic
See http://lists.apple.com/archives/fortran-dev/2004/Jul/msg00021.html
This has something to do with Fink's (the standard) g77 assuming the
existence
of (assembly entrypoints?) saveFP and restFP, but Apple's gcc not
including
them in its standard libgcc.
-----------
-L/sw/lib/gcc/powerpc-apple-darwin7.5.0/3.4.1
-L/sw/lib/gcc/powerpc-apple-darwin
7.5.0/3.4.1/../../.. -lm -lfrtbegin -lg2c -lSystem
For some reason I don't understand, when $FLIBS is not set,
configure calls g77, adding
-lcrt1.o and -lcrt2.o (c runtime libraries) before the above options in
specified in $FLIBS. But crt1.o and crt2.o are both linked even without
that explicit specification---perhaps g77 includes it automatically? The
result is double-linking and doubled-up symbols (as shown in config.log)
and an error trying to link fortran libraries. I just set $FLIBS
explicitly
to all the stuff configure would do by itself, deleting -lcrt1.o and
-lcrt2.o,
and that seemed to work.
export CPPFLAGS="-I/sw/include"
This just tells the preprocessor where to find Fink's include files
(like hdf5.h and others).
-------------------------
Finally, run configure, showing it where to find the shared libctl files:
(/sw/share/libctl is a directory).
Make the executable.
Install the executable in /usr/local/bin and add to man pages
(need to do that as a superuser, hence sudo).
---- March 2006 build notes ---
Have since upgraded to Panther, and preferred to install non-fink hdf5
package.
Thus,
sudo gcc_select 3.3 (to return to gcc 3.3, how it was built above)
(might have to rebuild some fink stuff like g77 with gcc4.0 otherwise?)
export LDFLAGS="-Wl,-framework -Wl,vecLib -L/sw/lib
-L/usr/local/hdf5-1.6.4/lib -lcc_dynamic"
export FLIBS="-L/sw/lib/gcc/powerpc-apple-darwin8.0.0/3.4.3
-L/sw/lib/gcc/powerpc-apple-darwin8.0.0/3.4.3/../../..
-lm -lfrtbegin -lg2c -lSystem"
export CPPFLAGS="-I/sw/include -I/usr/local/hdf5-1.6.4/include"
./configure --with-libctl=/sw/share/libctl
make
sudo make install
On Mon, 22 May 2006, Jethro Bell wrote:
Hello,
I'm trying to install mpb on a Mac running OS X 10.4. I've got all
the libraries and things working and seemingly working, however, when
I try to ./configure, I get:
checking for Fortran 77 libraries... -lcrt1.o -lcrt2.o
-L/sw/lib/gcc/powerpc-apple-darwin8.6.0/3.4.3
-L/sw/lib/gcc/powerpc-apple-darwin8.6.0/3.4.3/../../.. -lm -lfrtbegin
-lg2c -lSystemStubs -lSystem -lmx
/usr/lib/gcc/powerpc-apple-darwin8/4.0.0/libgcc.a
checking for dummy main to link with Fortran 77 libraries... unknown
configure: error: linking to Fortran libraries from C fails
I've searched through the mailing list, and it seems to suggest that
you use the same fortran version as the C version. However, I'm using
all the tools I can get from fink and I was hoping that someone could
point me to a way to make this work without recompiling g77. (I've
got blas, lapack, and fftw manually compiled, everything else comes
from fink.)
The versions fink gives me are
g77 3.4.3
gcc 4.0
gcc 3.3
I've tried both compilers. fink also implies I could acquire gcc2.9.5
and gcc 3.1 via xcode somehow, but isn't clear, and I already have the
developer tools installed, and they come with gcc4.0.
By the way, while the search interface to the mailing list found me
people with the same problem, it was very hard to find a "view follow
up messages" link anywhere, and I wound up going back in the archives
by date.
Is there anyway to convince gcc to compile happily with g77 despite
differing version numbers?
Thank you,
--Jethro
_______________________________________________
mpb-discuss mailing list
[email protected]
http://ab-initio.mit.edu/cgi-bin/mailman/listinfo/mpb-discuss
_______________________________________________
mpb-discuss mailing list
[email protected]
http://ab-initio.mit.edu/cgi-bin/mailman/listinfo/mpb-discuss