[Smeagol-discuss] Compiling smeagol on Mac OS X

Ivan Rungger runggeri at tcd.ie
Sun Jan 18 17:56:41 GMT 2009


Hello Lianheng,

 thanks for the advice on how to compile the code on a mac. I tried to
compile smeagol with gfortran once on a windows machine, but then gave
up and switched to the intel compiler for windows (trial version) which
worked.

Regarding the warnings of the gfortran compiler on the pdosg.F file I do
not know what might be the problem, but since the pdosg routine is only
called when you want to calculate the PDOS, it should not affect normal
running.

 Another thing: since you have intel processors, did you try using the
intel fortran compiler (the free linux version)? Maybe it works also on
a mac?

Cheers,

 Ivan


Lianheng Tong wrote:
> Hi All,
>
> I just succeeded in compiling smeagol-1.0b with siesta-1.3p on a Mac
> workstation with intel due-core processors using gfortran .
>
> I wish to share some experiences with you guys, if you want to compile
> smeagol on a Mac too. 
>
> The mac I am using had XTools installed on it. But its gcc package did
> not include gfortran, so I downloaded a separate gfortran from the web.
>
> Setting up the makefiles is in general quite straight forward, not
> much different from the way you set it up on a linux machine. But
> there are some Mac specific settings and some gfortran specific
> settings one need to watch out:
>
> in arch.make file, I set the flags:
>
> SIESTA_ARCH=darwin
>
> FC=/usr/local/bin/gfortran      # this is where my gfortran is installed
>
> FFLAGS= -ffixed-line-length-none -O3 
> FFLAGS_DEBUG = -ffixed-line-length-none -g -O0
> LDFLAGS= -ffixed-line-length-none -O3
> TRANSPORTFLAGS= -ffixed-line-length-none -O3 
>
> The important flag here is the "-ffixed-line-length-none",  it is
> is essential for gfortran. gfortran seems to have trouble
> distinguishing the FORTRAN standards and it automatically assumes
> column cut-off at column number 72. This causes many syntax errors.
>  This flag forces gfortran to regard the entire line as part of the
> code.  I have not seen a piece of code in siesta or smeagol that
> comments in the same line as the code, so it should be okay.
>
> -O3 is level 3 optimisation
>
> LIBS= -framework vecLib
>
> This is mac specific. XTools comes with optimised BLAS and LAPACK
> libraries, included in the vecLib framework. Thus to link to the
> libraries you need to use the above flag.  gfortran recognises the
> -framework option. In case your compiler does not recognise this, you
> can use:
>
> -Wl,-framework -Wl,vecLib
>
> instead. Note there is NO SPACE behind ".". 
>
> The rest of arch.make file are pretty standard, I am only compiling it
> in serial, so left all MPI related flags empty.
>
> Now let us move on to the Makefile, I DID HAVE to modify it a little
> to make it work. 
>
> I am using the linpack provided in the smeagol package, so in theory I
> don't have to modify anything. However just as I did, you will get the
> error messages:
>
> (cd ../linpack; /usr/local/bin/gfortran -ffixed-line-length-none -O3 
> *.f; \
>  ar -rv linpack.smeagol.a *.o; \
>  mv linpack.smeagol.a /Users/ltong/work/src/smeagol.1.0b/Src)
> /usr/bin/ld: Undefined symbols:
> _zaxpy_
> _zscal_
> _zswap_
> _izamax_
> _MAIN__
> collect2: ld returned 1 exit status
> ar: creating archive linpack.smeagol.a
> a - *.o
> ar: *.o: No such file or directory
>
> and then later on as the linpack library is empty the compilation fails:
>
> /usr/bin/ld: warning empty archive: linpack.smeagol.a (can't load from it)
> /usr/bin/ld: Undefined symbols:
> _zgedi_
> _zgefa_
> collect2: ld returned 1 exit status
> make: *** [siesta] Error 1
>
> The reason for the failure is because while making the linpack
> subroutines, the compiler could not find the BLAS libraries. This may
> be a gfortran issue, so changing the line:
>
> (cd ../linpack; $(FC) $(TRANSPORTFLAGS) *.f; \
>
> to
> (cd ../linpack; $(FC) $(TRANSPORTFLAGS) *.f -framework vecLib; \
>
> Eliminates all the undefined symbols errors except the symbol "_MAIN__"
>
> The reason for the _MAIN__ error may be due to the fact that the
> compiler is trying to compile the subroutines as a self-contained
> program.  So adding a "-c" flag solves the problem:
>
> (cd ../linpack; $(FC) -c $(TRANSPORTFLAGS) *.f -framework vecLib; \
>
> Also if you man ar on a Mac, you will realise that -r option does not
> have a v sub-option. So I changed the next line to:
>
> ar -r linpack.smeagol.a *.o; \
>
> This is the Makefile done.
>
> Before you compile, make sure also that you replace the negf2k.F and
> emt2k.F files with the fixed versions. These can be found on the
> mailing list. 
>
> If you follow the above steps smeagol should compile. 
>
> However, I am still getting the warning messages:
>
> pdosg.F:221.22:
>
>               goto 170
>                      1
> pdosg.F:234.15:
>
>  170      enddo
>               2
> Warning: Deleted feature: GOTO at (1) jumps to END of construct at (2)
> /usr/local/bin/gfortran -c -ffixed-line-length-none -O3     pdosk.F
> pdosk.F:257.24:
>
>                 GOTO 170
>                        1
> pdosk.F:275.17:
>
>  170        ENDDO
>                 2
> Warning: Deleted feature: GOTO at (1) jumps to END of construct at (2)
>
> This looks like a gfortran issue, and I don't know the solution. The
> language standard on gfortran is default to be "gnu", and it is the
> most forgiving standard allowed for the compiler. 
>
> I did a test run, and smeagol seems to be running fine.  Although I am
> still worried about the warning messages, I have yet to encounter a
> problem.
>
> That is it.  If anyone has the idea on how to solve the above problem,
> please let me know!  Thanks a lot. 
>
>
> Best regards,
>
> Lianheng
>
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Smeagol-discuss mailing list
> Smeagol-discuss at lists.tchpc.tcd.ie
> http://lists.tchpc.tcd.ie/listinfo/smeagol-discuss


-- 
=================================================
Ivan Rungger,

School of Physics and CRANN,  
Trinity College Dublin,  
Dublin 2,  IRELAND  
Phone: +353-1-8968454  
Email: runggeri at tcd.ie
=================================================



More information about the Smeagol-discuss mailing list