3

I am totally new user in Ubuntu. For research purpose, I need to install ShengBTE software. In the following I copied the texts which is important for compilation. According to the texts, I downloaded the software and went to src directory, it contains Makefile and others f90 extension files.There is a arch.make.example outside the src directory, I move that to src directory and then just wrote 'make' in the terminal, but its not worked.

"To compile the code it is enough to run make in the Src subdirectory of the distribution, but a suitable arch.make must be present in that directory. An example is provided as arch.make.example. As a minimum, $MPIFC must contain a valid command to compile Fortran 90 code with MPI directives, while the combination of $LDFLAGS and $LIBS must contain any linker flags required in order to link against an implementation of LAPACK and against Atsushi Togo's spglib. ShengBTE uses some Fortran 2003 extensions, most notably its new syntax for array initialization, and a recent Fortran compiler is required that supports them; modern versions of both gfortran and ifort are known to work. To compile with OpenMP threading enabled the relevant compiler flag must also be used. After compilation succeeds, a ShengBTE binary will be created in the root directory of the distribution. This executable takes no command-line options and accepts no input from the terminal."

Here is the arch.make.example

export FFLAGS=-traceback -debug -O2 -static_intel -qopenmp
export LDFLAGS=-L/home/user/REPOSITORY/spglib/lib -lsymspg
export MPIFC=mpif90
MKL=$(MKLROOT)/lib/em64t/libmkl_lapack95_lp64.a -Wl,--start-group   \
$(MKLROOT)/lib/em64t/libmkl_intel_lp64.a                \
 $(MKLROOT)/lib/em64t/libmkl_sequential.a               \
 $(MKLROOT)/lib/em64t/libmkl_core.a -Wl,--end-group -lpthread -lm
export LAPACK=$(MKL)
export LIBS=$(LAPACK)

Would anyone please guide step by step, how can install that software?

1 Answer 1

3

The arch.make.example file appears to be targeted towards building a statically linked executable using the Intel ifort toolchain. However I was able to build a dynamically linked version using gfortran on Ubuntu 24.04 using the following steps:

  1. install gfortran plus the OpenMPI and required MKL development packages

    sudo apt install gfortran libopenmpi-dev \
      libmkl-core libmkl-threading-dev libmkl-interface-dev
    
  2. install the Spglib development package

    sudo apt install libsymspg-dev 
    
  3. create a Src/arch.make file based on the provided arch.make.example with the following minimal differences

    $ diff -by arch.make.example Src/arch.make 
    export FFLAGS=-traceback -debug -O2 -static_intel -qopen      | export FFLAGS=-g -O2 -fPIC -fopenmp
    export LDFLAGS=-L/home/user/REPOSITORY/spglib/lib -lsyms      | export LDFLAGS=-L/usr/lib/x86_64-linux-gnu -lsymspg
    export MPIFC=mpif90                                             export MPIFC=mpif90
    MKL=$(MKLROOT)/lib/em64t/libmkl_lapack95_lp64.a -Wl,--st      | MKL=$(MKLROOT)/lib/x86_64-linux-gnu/libmkl_lapack95_lp64.a -W
    $(MKLROOT)/lib/em64t/libmkl_intel_lp64.a                      | $(MKLROOT)/lib/x86_64-linux-gnu/libmkl_intel_lp64.so
     $(MKLROOT)/lib/em64t/libmkl_sequential.a                     |  $(MKLROOT)/lib/x86_64-linux-gnu/libmkl_sequential.so
     $(MKLROOT)/lib/em64t/libmkl_core.a -Wl,--end-group -lpt      |  $(MKLROOT)/lib/x86_64-linux-gnu/libmkl_core.so -Wl,--end-gro
    export LAPACK=$(MKL)                                            export LAPACK=$(MKL)
    export LIBS=$(LAPACK)                                           export LIBS=$(LAPACK)
    

You should then be able to simply make inside the Src subdirectory as instructed.

If you really need a statically built executable then it will be more work, since the Ubuntu packages do not appear to provide archive (static) libraries libmkl_core.a or libsymspg.a.

6
  • Ubuntu 22.04 has the .a files:$ apt-file search libsymspg.a libsymspg-dev: /usr/lib/x86_64-linux-gnu/libsymspg.a $ apt-file search libmkl_core.a libmkl-computational-dev: /usr/lib/x86_64-linux-gnu/libmkl_core.a
    – ubfan1
    Commented May 22 at 2:51
  • @ubfan1 thanks - it looks like 24.04 libmkl-computational-dev also has the libmkl_core.a lib (don't know how I missed that) so it's only libsymspg-dev that's different. I also noticed I left (static) libmkl_lapack95_lp64.a in the build - I will take another look and see I can do a build with fewer makefile changes on 22.04 Commented May 22 at 12:04
  • @steeldriver I am using Ubuntu 24.04 on virtual box. It seems like you changed the directory in arch.make. For example: you have used lsymspg as follows export LDFLAGS=-L/usr/lib/x86_64-linux-gnu -lsymspg I just checked my directory and for me it should be as export LDFLAGS=-L/home/hasan/anaconda3/lib/python3.11/site-packages/spglib/lib -lsymspg My question is, Do I have to change the directories accordingly for MKL? How can I find those directories in easy commands and paste it to arch.make? Thank you! Commented May 22 at 14:44
  • @Md.JahidHasanSagor if you installed the MKL packages from the Ubuntu repository and your VM architecture is x86_64 then the paths I used should be correct for you. If you installed MKL some other way (e.g. via anaconda) then you will need to figure it out yourself - sorry Commented May 22 at 15:04
  • @steeldriver you are right. I just copied what you wrote in arch.make and ran make, I didn't get any error message. It seems software compiled successfully then. Thank you! One more thing you were talking about static linking, Can you give me some hints how I can do that? Commented May 22 at 15:17

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .