Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
RESOLVED: problem with LACAML and static linking
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2009-01-29 (18:51)
From: Erick Matsen <matsen@b...>
Subject: RESOLVED: problem with LACAML and static linking
Thank you to Mauricio Fernandez, St\'{e}phane Glondu, and Makus Mottl
for helping me with this problem.

Review of problem:

When doing static compilation using LAPACK, encountering the following error:

/usr/lib/libblas.a(xerbla.o): In function `xerbla_':
(.text+0x0): multiple definition of `xerbla_'
/usr/lib/liblapack.a(xerbla.o):(.text+0x0): first defined here


Copying a version of liblapack.a to my home directory and removing the
offending symbol using ar, then using -noautolink to use the local
version. I found the necessary libraries using -verbose.

[complex:~/placer/ocaml]$ cp `locate liblapack.a` .
[complex:~/placer/ocaml]$ ar t liblapack.a | grep xerbla.o
[complex:~/placer/ocaml]$ ar d liblapack.a xerbla.o
[complex:~/placer/ocaml]$ ar t liblapack.a | grep xerbla.o

The compilation command:

ocamlopt \
    -I /home/matsen/ocaml/bio/ -I /home/matsen/ocaml/common/  -I
/usr/lib/ocaml/3.10.2/pcre/ -I /usr/lib/ocaml/3.10.2/gsl/ -I
/usr/lib/ocaml/3.10.2/lacaml/ \
    -noautolink \
    -ccopt -static \
    -cclib /usr/lib/ocaml/3.10.2/lacaml/liblacaml_stubs.a \
    -cclib /home/matsen/placer/ocaml/liblapack.a \
    -cclib /home/matsen/placer/ocaml/libblas.a \
    -cclib /usr/lib/ocaml/3.10.2/gsl/libmlgsl.a \
    -cclib /usr/lib/libgsl.a \
    -cclib /usr/lib/libgslcblas.a \
    -cclib /usr/lib/ocaml/3.10.2/libunix.a \
    -cclib /usr/lib/ocaml/3.10.2/libbigarray.a \
    -cclib /usr/lib/ocaml/3.10.2/pcre/libpcre_stubs.a \
    -cclib /usr/lib/libpcre.a \
    -cclib /usr/lib/gcc/i486-linux-gnu/4.3/libgfortran.a \
    -cclib /usr/lib/ocaml/3.10.2/libasmrun.a \
    -cclib /usr/lib/libm.a \
    -cclib /usr/lib/libdl.a \
    -cclib -L/home/matsen/ocaml/bio/ -ccopt
-L/home/matsen/ocaml/common/ -ccopt -L/usr/lib/ocaml/3.10.2/pcre/
-ccopt -L/usr/lib/ocaml/3.10.2/glpk/ -ccopt
-L/usr/lib/ocaml/3.10.2/gsl/ -ccopt -L/usr/lib/ocaml/3.10.2/lacaml/
pcre.cmxa bigarray.cmxa unix.cmxa gsl.cmxa lacaml.cmxa   -o placer \
/home/matsen/ocaml/bio/biobase.cmx base.cmx minimization.cmx
integration.cmx /home/matsen/ocaml/bio/liketree.cmx liketreeFuns.cmx
/home/matsen/ocaml/common/number.cmx /home/matsen/ocaml/common/mat.cmx
/home/matsen/ocaml/bio/diagd.cmx /home/matsen/ocaml/bio/qtree.cmx
/home/matsen/ocaml/bio/alignmentLike.cmx placerFuns.cmx placer.cmx