Hi Joaquin,

Its been a really long time since I compiled Lapack manually and linked it 
against deal.II (at that time, before we used CMake). I've attached for you 
a file with my personal notes on how I used to compile Lapack then (circa 
2012). I think that you've pretty much covered all of the steps listed 
there, so "point 7" is the one that I think is most useful on this 
occasion. Lapack is built as a static library, and I think (although I 
stand to be corrected) that unless you specifically point CMake/deal.II to 
a static library then, when building a shared library version of deal.II, 
it will expect that the libraries it is to link against are also shared 
libraries. 

So what you could do (i.e. what might be easiest right now) is convert the 
static library of Lapack into a shared one. That you built it with the 
-FPIC flag would have ensured that this is possible. If you navigate to the 
lapack library location and run a sensibly modified version of the 
following two lines

> ar -x liblapack.a && gcc -shared *.o -o liblapack.so 
> -L$DIR_BASE/OpenBLAS/build/lib -lopenblas && rm *.o
> ar -x libtmglib.a && gcc -shared *.o -o libtmglib.so 
> -L$DIR_BASE/OpenBLAS/build/lib -lopenblas && rm *.o

then you should be left with both a static and shared version of these two 
libraries.

You can verify that the libraries were correctly assembled by running

>   ld $DIR_BASE/LAPACK/build/lib/liblapack.so
>   ld $DIR_BASE/LAPACK/build/lib/libtmglib.so

If there are streams of "undefined reference to", then something's gone 
wrong.

I hope that this finally gets you going.

Best,
Jean-Paul


> After *$ make -j8 install*, the next error I got:
>
>
>
>
>
>
>
>
>
>
>
>
> *[100%] Built target obj_fe.releaseLinking CXX shared library 
> ../lib/libdeal_II.so/usr/bin/ld: cannot find -llapackcollect2: error: ld 
> returned 1 exit statusmake[2]: *** [lib/libdeal_II.so.8.4.1] Error 
> 1make[1]: *** [source/CMakeFiles/deal_II.dir/all] Error 2make[1]: *** 
> Waiting for unfinished jobs..../usr/bin/ld: cannot find -llapackcollect2: 
> error: ld returned 1 exit statusmake[2]: *** [lib/libdeal_II.g.so.8.4.1] 
> Error 1make[1]: *** [source/CMakeFiles/deal_II.g.dir/all] Error 2make: *** 
> [all] Error 2*
>
> Apparently something else I need to do in the installation.
>
> Please help.
>

-- 
The deal.II project is located at http://www.dealii.org/
For mailing list/forum options, see 
https://groups.google.com/d/forum/dealii?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"deal.II User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to dealii+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
====================================================================================================================================
4. LAPACK

http://www.netlib.org/lapack/
====================================================================================================================================

1. Install OpenMPI and OpenBLAS

2. Make directory structure and unzip source
        mkdir -p $DIR_BASE/LAPACK/build/lib && cd $DIR_BASE/LAPACK
        tar -zxvf $DIR_SOURCE/LAPACK/lapack-$VSN_LAPACK.tgz -C $DIR_BASE/LAPACK
        cd $DIR_BASE/LAPACK/lapack-$VSN_LAPACK

3. Copy make.inc.example to make.inc
   cp make.inc.example make.inc

4. Edit make.inc

    Old lines to be replaced:
    FORTRAN  = gfortran 
    OPTS     = -O2
    DRVOPTS  = $(OPTS)
    NOOPT    = -O0
    LOADER   = gfortran
    LOADOPTS =

    BLASLIB      = ../../librefblas.a
    LAPACKLIB    = liblapack.a
    TMGLIB       = libtmglib.a
    LAPACKELIB   = liblapacke.a

Lines 22-27:
   FORTRAN  = $(DIR_BASE)/OpenMPI/build/bin/mpif90 -fimplicit-none -g
   OPTS     = -m64 -fPIC -pthread -fopenmp
   DRVOPTS  = $(OPTS)
   NOOPT    = -g -O0 -fPIC
   LOADER   = $(DIR_BASE)/OpenMPI/build/bin/mpif90 -g
   LOADOPTS = -pthread -fopenmp

CC = $(DIR_BASE)/OpenMPI/build/bin/mpicc
CFLAGS = -m64 -fPIC -pthread -fopenmp
   
Line 54:
   BLASLIB      = $(DIR_BASE)/OpenBLAS/build/lib/libopenblas.a
   LAPACKLIB    = liblapack.a
   TMGLIB       = libtmglib.a
   LAPACKELIB   = liblapacke.a
    
5. Build LAPACK (can't multithread the build)
   make 2>&1 | tee make_LAPACK.log
   
6. Testing (need single thread build)
   make
   Testing should be done automatically
   See results in TESTING/*.out
   
7. Make and "install" shared objects
  cd $DIR_BASE/LAPACK/lapack-$VSN_LAPACK

  Copy the files ("too many symbolic links" error when linking to this library 
if the links are symbolic)
  ar -x liblapack.a && gcc -shared *.o -o liblapack.so 
-L$DIR_BASE/OpenBLAS/build/lib -lopenblas && rm *.o
  cp liblapack.a $DIR_BASE/LAPACK/build/lib && cp liblapack.so 
$DIR_BASE/LAPACK/build/lib
  ar -x libtmglib.a && gcc -shared *.o -o libtmglib.so 
-L$DIR_BASE/OpenBLAS/build/lib -lopenblas && rm *.o
  cp libtmglib.a $DIR_BASE/LAPACK/build/lib && cp libtmglib.so 
$DIR_BASE/LAPACK/build/lib

  ls $DIR_BASE/LAPACK/build/lib

8. Test that libraries were linked properly (there should not be streams of 
"undefined reference to")
  ld $DIR_BASE/LAPACK/build/lib/liblapack.so
  ld $DIR_BASE/LAPACK/build/lib/libtmglib.so 

9. Add library to path
        export LD_LIBRARY_PATH=$DIR_BASE/LAPACK/build/lib:$LD_LIBRARY_PATH

Reply via email to