<?xml version="1.0" encoding="ISO-8859-1"?>

<!DOCTYPE message PUBLIC
  "-//MLarc//DTD MLarc output files//EN"
  "../../mlarc.dtd"[
  <!ATTLIST message
    listname CDATA #REQUIRED
    title CDATA #REQUIRED
  >
]>

  <?xml-stylesheet href="../../mlarc.xsl" type="text/xsl"?>


<message 
  url="2009/01/ce54a4055c5be06e7c5b166f34ec6ee7"
  from="Erick Matsen &lt;matsen@b...&gt;"
  author="Erick Matsen"
  date="2009-01-29T18:51:23"
  subject="RESOLVED: problem with LACAML and static linking"
  prev="2009/01/6402ef3bbdde7c77e7b4bfd2cefde152"
  next="2009/01/136398e536628d96299ed71f2237b6c8"
  prev-thread="2009/01/6402ef3bbdde7c77e7b4bfd2cefde152"
  next-thread="2009/01/136398e536628d96299ed71f2237b6c8"
  root="../../"
  period="month"
  listname="caml-list"
  title="Archives of the Caml mailing list">

<thread subject="RESOLVED: problem with LACAML and static linking">
<msg 
  url="2009/01/ce54a4055c5be06e7c5b166f34ec6ee7"
  from="Erick Matsen &lt;matsen@b...&gt;"
  author="Erick Matsen"
  date="2009-01-29T18:51:23"
  subject="RESOLVED: problem with LACAML and static linking">
</msg>
</thread>

<contents>
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


Solution:

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
xerbla.o
[complex:~/placer/ocaml]$ ar d liblapack.a xerbla.o
[complex:~/placer/ocaml]$ ar t liblapack.a | grep xerbla.o
[complex:~/placer/ocaml]$


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/common/common_base.cmx
/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/protModels.cmx
/home/matsen/ocaml/bio/alignment.cmx
/home/matsen/ocaml/bio/alignmentLike.cmx placerFuns.cmx placer.cmx

</contents>

</message>

