How to compile

List of topics

    • Compiling on Windows
    • Compiling on Linux in General
    • Ubuntu Specific

Please send email to teepanisc@nu.ac.th for help.

Compiling on Windows

1) A project file for CodeBlock called "SQ.CBP" is available in the source code directory.

Code::Blook is an open-source software development environment which allows users to write and compile C/C++ source code. It is distributed with MinGW compiler for Windows. ( Please use older version of Code::Block such as 13.12. Newer version is shipped with the latest MinGW compiler which could be incompatible with LAPACK library (lapack_win32.dll and blas_win32.dll. Please use the 32bit version of the compiler.)

2) To compile Siam Quantum, install CodeBlock, load the project file, and click build.

Two LAPACK dynamic library files: lapack_win32.dll and blas_win32.dll are required during compilation and execution. These files are already located in the source code directory.

Compiling on Linux in General

1) A typical script file called "Makefile" is available in the source code directory.

Within that file, the parameter "LIB" might need to be adjusted to point to the proper path for LAPACK libraries.

2) In Linux terminal, change to the source directory and simply type:

#make

will compile Siam Quantum program.

3) If the source *.c compiles smoothly, but fails at the end while linking all object files together, complaining about mismatched lapack/blass subroutine; try changing the linking command in the Makefile from:

${CC} ${LDOPT} -o sq $^ -lm -lgfortran ${LIB}

into

gfortran -o sq $^ -lm -static ${LIB}

Ubuntu Specific

The following steps were tested on Ubuntu 12.04 Desktop i386, although it should work with other versions of Ubuntu.

1) # sudo apt-get install liblapack-dev

2) # sudo apt-get install gfortran

3) Edit 3 lines in the Makefile so that they become

LIB = -llapack -lblas

CCOPT = -O3 -Wall -msse2

LDOPT = -O3 -Wall

Then, in the source code directory, simply type #make as usual. This will generate a dynamically linked executable. But if you prefer the statically linked version, comment out the line:

# ${CC} ${LDOPT} -o sq $^ -lm -lgfortran ${LIB}

And change the next line so that it becomes:

gfortran -o sq $^ -lm -static -z muldefs ${LIB}

Be sure that a single tab character precedes the "gfortran" word, not blank spaces. The "-z muldefs" option is there to handle LAPACK+Ubuntu's tiny incompatibility issue.