PETSc configure with Intel-compiler static linking

Satish Balay balay at
Thu Jul 9 09:50:21 CDT 2009

On Thu, 9 Jul 2009, Takuya Sekikawa wrote:

> Hello petsc users,
> I need to know how to configure PETSc with Intel-compiler (icc/icpc) on
> static linking.


> shared linking is just fine, 
> but I need to build PETSc with static-linking. so I tried several description.
> [1]
> $ ./config/ --with-cc=icc --with-cxx=icpc --with-fc=0
> --with-shared=0 --with-blas-lapack-dir=${MKL_DIR}
> environment variable MKL_DIR is set to intel MKL library directory.
> this one is fine, (also compiling and running is ok)
> but is spite of "--with-shared=0" flag, executable still link with .so
> (, etc)

--with-shared=0 refers to petsc libraries. It doesn't mean static
linking or shared linking. 

Generally static linking is done by the linker option [with icc/ifort
its: -Bstatic]. But since all system libraries might not be available
as static libraries - this might not work.

Esp with MKL - since the librariry names are different between .so and
.a files. [so PETSc configure doesn't explicitly look for tha .a

> so I tried another one:
> [2]
> $ ./config/ --with-cc=icc --with-cxx=icpc --with-fc=0
> --with-shared=0 --with-blas-lapack-lib=${MKL_DIR}/libmkl_lapack.a

Generally - you  need -lmkl_lapack -lmkl -lpthread -lguide

However -lmkl is only available as .so. So you'll have to cat to see what the actual libraries it links with: For me I

[petsc:] petsc> cat
[petsc:] petsc> 

So you might be able to use:

--with-blas-lapack-lib="${MKL_DIR}/libmkl_lapack.a ${MKL_DIR}/libmkl_intel_lp64.a ${MKL_DIR}/libmkl_core.a -lpthread ${MKL_DIR}/libguide.a"


> this time failed:
> *********************************************************************************
>          UNABLE to CONFIGURE with GIVEN OPTIONS    (see configure.log for details):
> ---------------------------------------------------------------------------------------
> You set a value for --with-blas-lapack-lib=<lib>, but ['/opt/intel/mkl/10.0.010/lib/em64t/libmkl_lapack.a'] cannot be used
> *********************************************************************************
> Could someone give me good advice? (or examples are greatly appriciated)
> Thanks in advance
> Takuya

More information about the petsc-users mailing list