[Mesa-users] How to compile on Fedora 27 without SDK (and without PGSTAR)

Warrick Ball wball at bison.ph.bham.ac.uk
Tue Feb 13 05:04:15 EST 2018

Hi everyone,

At some point while checking whether the SDK was loaded on my Fedora 27 
system, I noticed that the system version is newer than the SDK version.

$ gfortran -v
Using built-in specs.
Target: x86_64-redhat-linux
Configured with: ../configure --enable-bootstrap --enable-languages=c,c++,objc,obj-c++,fortran,ada,go,lto --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-shared --enable-threads=posix --enable-checking=release --enable-multilib --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-gcc-major-version-only --with-linker-hash-style=gnu --enable-plugin --enable-initfini-array --with-isl --enable-libmpx --enable-offload-targets=nvptx-none --without-cuda-driver --enable-gnu-indirect-function --with-tune=generic --with-arch_32=i686 --build=x86_64-redhat-linux
Thread model: posix
gcc version 7.3.1 20180130 (Red Hat 7.3.1-2) (GCC)

While I love the SDK and would never dream of not using it for production 
work, it crossed my mind to try compiling MESA with this newer version of 
gfortran.  Everything here refers to the latest public revision, r10108.

These are instructions, gleaned from some trial and error, that should 
install MESA on Fedora 27 without the SDK (even though I'm not suggesting 
that you shouldn't use the SDK!).  I disabled PGSTAR (since I don't use it 
often) by making sure the last lines before section 5) are


(Actually, I just changed the lines in the gfortran section of the if 
block.)  I might be possible to install with PGSTAR support but I'm going 
to leave that for another time.

The first thing is whether you want to install with HDF5 support.  If not, 
in which case you won't have access to the custom weak reaction rates, 
make sure the lines before section 6) of utils/makefile_header are


and run

touch $MESA_DIR/rates/skip_test

because that test fails without HDF5 support.

If you do want HDF5 support, which is quite easy anyway, you need to 
install the HDF5 libraries from the repos with

su -c "dnf install hdf5-static hdf5-devel"

To determine how to modify the makefile, I learned that you can get the 
HDF5 compilation scripts to tell you what they're doing with

$ h5fc -show
gfortran -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m64 -mtune=generic -I/usr/lib64/gfortran/modules -I/usr/include -L/usr/lib64 -lhdf5hl_fortran -lhdf5_hl -lhdf5_fortran -lhdf5 -Wl,-z,relro -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -lsz -lz -ldl -lm -Wl,-rpath -Wl,/usr/lib64

I extracted the include/load parts of that into utils/makefile_header as

LOAD_HDF5 = -L/usr/lib64 -lhdf5_fortran -lhdf5 -lhdf5hl_fortran -lhdf5_hl -lz
INCLUDE_HDF5 = -I/usr/lib64/gfortran/modules -I/usr/include

(some of which might be overkill).

I then tried to ./install.  After following the instructions to install 
ndiff (which gave some error about man pages but worked) and makedepf90, 
compilation proceeded up until some typical complaints about uninitialized 
variables.  So I added -Wno-uninitialized to FCbasic and tried again.*

After all that, MESA compiled!  I'm now running the test suite, though 
it's agonizingly slow on my tired old laptop...


* In a separate exercise, I worked through all the uninitialized 
variables.  Here's a synopsis of what I added:

$ grep -n Fedora */p*/*.f90
chem/public/chem_lib.f90:619:         zsolar = 0d0  ! for Fedora 27
chem/public/chem_lib.f90:620:         ysolar = 0d0  ! for Fedora 27
eos/private/eosdt_eval.f90:100:         d_alfa_dlogT = 0d0     ! for Fedora 27
eos/private/eosdt_eval.f90:101:         d_alfa_dlogRho = 0d0   ! for Fedora 27

Warrick Ball
Postdoc, School of Physics and Astronomy
University of Birmingham, Edgbaston, Birmingham B15 2TT
wball at bison.ph.bham.ac.uk
+44 (0)121 414 4552

More information about the Mesa-users mailing list