caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* problem with LACAML and static linking
@ 2009-01-28  6:48 Erick Matsen
  2009-01-28  7:20 ` [Caml-list] " Stéphane Glondu
  0 siblings, 1 reply; 9+ messages in thread
From: Erick Matsen @ 2009-01-28  6:48 UTC (permalink / raw)
  To: caml-list

Hello everyone---


I apologize for posting what is certainly a naive question, but I have
not been able to find an answer on the web.

I am having trouble with static compilation and LACAML. I have used
ocamlopt with -ccopt -static a number of times sucessfully (with PCRE
and I think GSL), but when I added modules using LACAML I get a series
of errors like

/usr/lib//liblapack.a(sgesvd.o): In function `sgesvd_':
(.text+0x3ad): undefined reference to `_gfortran_concat_string'
/usr/lib//liblapack.a(sgesvd.o): In function `sgesvd_':
(.text+0x94f): undefined reference to `_gfortran_concat_string'
...

It appears that I need somehow to make sure that lapack can find
gfortgran, but libgfortran is sitting happily in /usr/lib.

I'm running ocaml 3.10.2, lacaml 3.0.19, and lapack 3.

Any help would be much appreciated.


Thanks,

Erick


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Caml-list] problem with LACAML and static linking
  2009-01-28  6:48 problem with LACAML and static linking Erick Matsen
@ 2009-01-28  7:20 ` Stéphane Glondu
  2009-01-28 17:17   ` Erick Matsen
  0 siblings, 1 reply; 9+ messages in thread
From: Stéphane Glondu @ 2009-01-28  7:20 UTC (permalink / raw)
  To: Erick Matsen; +Cc: caml-list

Erick Matsen a écrit :
> /usr/lib//liblapack.a(sgesvd.o): In function `sgesvd_':
> (.text+0x3ad): undefined reference to `_gfortran_concat_string'
> /usr/lib//liblapack.a(sgesvd.o): In function `sgesvd_':
> (.text+0x94f): undefined reference to `_gfortran_concat_string'
> ...

You might get such errors when one of liblapack's dependency is not
available as a static library. What is the output of `ldd
/usr/lib/liblapack.a'? The solution might be as simple as installing
development packages for these dependencies, or might involve
recompiling them for use with -static (i.e. into .a instead of .so).


Hope this helps,

-- 
Stéphane


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Caml-list] problem with LACAML and static linking
  2009-01-28  7:20 ` [Caml-list] " Stéphane Glondu
@ 2009-01-28 17:17   ` Erick Matsen
  2009-01-28 17:33     ` Mauricio Fernandez
  0 siblings, 1 reply; 9+ messages in thread
From: Erick Matsen @ 2009-01-28 17:17 UTC (permalink / raw)
  To: Stéphane Glondu; +Cc: caml-list

Hello Stephane (and the rest of the ocaml community)---


Thank you for your input here.

I do have libgfortran.a, but I might note that it's in
/usr/lib/gcc/i486-linux-gnu/4.3/ rather than /usr/lib. This is in contrast to
liblapack.a, etc, which just live in /usr/lib. This makes me wonder if this is
somehow the problem.

I did try (naievely!) copying libgfortran.a over to /usr/lib. I also added
/usr/lib/gcc/i486-linux-gnu/4.3/ to my list of directories. No luck yet. Also


$ ldd /usr/lib/liblapack.so
	linux-gate.so.1 =>  (0xffffe000)
	libblas.so.3gf => /usr/lib/libblas.so.3gf (0xb775d000)
	libgfortran.so.3 => /usr/lib/libgfortran.so.3 (0xb76ab000)
	libm.so.6 => /lib/i686/cmov/libm.so.6 (0xb7684000)
	libgcc_s.so.1 => /lib/libgcc_s.so.1 (0xb7677000)
	libc.so.6 => /lib/i686/cmov/libc.so.6 (0xb751c000)
	/lib/ld-linux.so.2 (0x80000000)


$ locate linux-gate.a
$ locate libblas.a
/usr/lib/libblas.a
$ locate libgfortran.a
/usr/lib/gcc/i486-linux-gnu/4.3/libgfortran.a
$ locate libm.a
/usr/lib/libm.a
/usr/lib/xen/libm.a
$ locate libgcc_s.a
$ locate libc.a
/usr/lib/libc.a
/usr/lib/xen/libc.a


So everything there seems to be OK. Also

# ldd /usr/lib/gcc/i486-linux-gnu/4.3/libgfortran.so
	linux-gate.so.1 =>  (0xffffe000)
	libm.so.6 => /lib/i686/cmov/libm.so.6 (0xb7ed9000)
	libc.so.6 => /lib/i686/cmov/libc.so.6 (0xb7d7e000)
	/lib/ld-linux.so.2 (0x80000000)


Here is my compile line

ocamlopt \

# source directories:
    -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/glpk/ -I
/usr/lib/ocaml/3.10.2/gsl/ -I /usr/lib/ocaml/3.10.2/lacaml/ -I
/usr/lib/gcc/i486-linux-gnu/4.3/ \

# cc directives
    -ccopt -static  -ccopt -lgfortran    -ccopt
-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/ -ccopt
-L/usr/lib/gcc/i486-linux-gnu/4.3/    pcre.cmxa bigarray.cmxa
unix.cmxa gsl.cmxa lacaml.cmxa   -o placer \

# my code
    /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


Thank you again for your help. If we can get this running, I'll
definitely acknowledge your help in our paper, which is in the long
run about understanding the distribution of phytoplankton in the ocean
and ramifications for carbon cycling (very relevant for climate
change...).


Erick


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Caml-list] problem with LACAML and static linking
  2009-01-28 17:17   ` Erick Matsen
@ 2009-01-28 17:33     ` Mauricio Fernandez
  2009-01-28 17:56       ` Erick Matsen
  0 siblings, 1 reply; 9+ messages in thread
From: Mauricio Fernandez @ 2009-01-28 17:33 UTC (permalink / raw)
  To: caml-list

On Wed, Jan 28, 2009 at 09:17:56AM -0800, Erick Matsen wrote:
> Here is my compile line
> 
> ocamlopt \
> 
> # source directories:
>     -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/glpk/ -I
> /usr/lib/ocaml/3.10.2/gsl/ -I /usr/lib/ocaml/3.10.2/lacaml/ -I
> /usr/lib/gcc/i486-linux-gnu/4.3/ \
> 
> # cc directives
>     -ccopt -static  -ccopt -lgfortran    -ccopt

I think you need -cclib here (just did s/cclib/ccopt/ with some code of mine
and got undefined refs...).

-- 
Mauricio Fernandez  -   http://eigenclass.org


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Caml-list] problem with LACAML and static linking
  2009-01-28 17:33     ` Mauricio Fernandez
@ 2009-01-28 17:56       ` Erick Matsen
  2009-01-28 18:49         ` Stéphane Glondu
  0 siblings, 1 reply; 9+ messages in thread
From: Erick Matsen @ 2009-01-28 17:56 UTC (permalink / raw)
  To: caml-list

Hello Mauricio---


Is this what you mean?


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/glpk/ -I
/usr/lib/ocaml/3.10.2/gsl/ -I /usr/lib/ocaml/3.10.2/lacaml/ -I
/usr/lib/gcc/i486-linux-gnu/4.3/ \
    -ccopt -static \

#HERE...
    -cclib /usr/lib/gcc/i486-linux-gnu/4.3/libgfortran.a    \

    -ccopt -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/
-ccopt -L/usr/lib/gcc/i486-linux-gnu/4.3/    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


That gives

/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
/usr/lib/ocaml/3.10.2/libasmrun.a(unix.o): In function `caml_dlopen':
(.text+0x223): warning: Using 'dlopen' in statically linked
applications requires at runtime the shared libraries from the glibc
version used for linking
/usr/lib/ocaml/3.10.2/libunix.a(getgr.o): In function `unix_getgrgid':
... similar messages ....

so BLAS and gfortran both define xerbla. Hm... but progress!


Thanks,

Erick


On Wed, Jan 28, 2009 at 9:33 AM, Mauricio Fernandez <mfp@acm.org> wrote:
> On Wed, Jan 28, 2009 at 09:17:56AM -0800, Erick Matsen wrote:
>> Here is my compile line
>>
>> ocamlopt \
>>
>> # source directories:
>>     -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/glpk/ -I
>> /usr/lib/ocaml/3.10.2/gsl/ -I /usr/lib/ocaml/3.10.2/lacaml/ -I
>> /usr/lib/gcc/i486-linux-gnu/4.3/ \
>>
>> # cc directives
>>     -ccopt -static  -ccopt -lgfortran    -ccopt
>
> I think you need -cclib here (just did s/cclib/ccopt/ with some code of mine
> and got undefined refs...).
>
> --
> Mauricio Fernandez  -   http://eigenclass.org
>
> _______________________________________________
> Caml-list mailing list. Subscription management:
> http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
> Archives: http://caml.inria.fr
> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
> Bug reports: http://caml.inria.fr/bin/caml-bugs
>


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Caml-list] problem with LACAML and static linking
  2009-01-28 17:56       ` Erick Matsen
@ 2009-01-28 18:49         ` Stéphane Glondu
  2009-01-28 18:50           ` Erick Matsen
  0 siblings, 1 reply; 9+ messages in thread
From: Stéphane Glondu @ 2009-01-28 18:49 UTC (permalink / raw)
  To: Erick Matsen; +Cc: caml-list

Erick Matsen a écrit :
> [...]
> /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
> /usr/lib/ocaml/3.10.2/libasmrun.a(unix.o): In function `caml_dlopen':
> (.text+0x223): warning: Using 'dlopen' in statically linked
> applications requires at runtime the shared libraries from the glibc
> version used for linking
> /usr/lib/ocaml/3.10.2/libunix.a(getgr.o): In function `unix_getgrgid':
> ... similar messages ....
> [...]

These are warnings, aren't they? Doesn't your program run if you ignore
them? The warnings concern ocaml runtime, so I guess you cannot do much
about it...


Cheers,

-- 
Stéphane


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Caml-list] problem with LACAML and static linking
  2009-01-28 18:49         ` Stéphane Glondu
@ 2009-01-28 18:50           ` Erick Matsen
  2009-01-28 19:05             ` Stéphane Glondu
  0 siblings, 1 reply; 9+ messages in thread
From: Erick Matsen @ 2009-01-28 18:50 UTC (permalink / raw)
  To: Stéphane Glondu; +Cc: caml-list

Hm, unfortunately not the first one.

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

It doesn't link...


Thanks,

Erick


On Wed, Jan 28, 2009 at 10:49 AM, Stéphane Glondu <steph@glondu.net> wrote:
> Erick Matsen a écrit :
>> [...]
>> /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
>> /usr/lib/ocaml/3.10.2/libasmrun.a(unix.o): In function `caml_dlopen':
>> (.text+0x223): warning: Using 'dlopen' in statically linked
>> applications requires at runtime the shared libraries from the glibc
>> version used for linking
>> /usr/lib/ocaml/3.10.2/libunix.a(getgr.o): In function `unix_getgrgid':
>> ... similar messages ....
>> [...]
>
> These are warnings, aren't they? Doesn't your program run if you ignore
> them? The warnings concern ocaml runtime, so I guess you cannot do much
> about it...
>
>
> Cheers,
>
> --
> Stéphane
>
>


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Caml-list] problem with LACAML and static linking
  2009-01-28 18:50           ` Erick Matsen
@ 2009-01-28 19:05             ` Stéphane Glondu
  2009-01-28 19:24               ` Markus Mottl
  0 siblings, 1 reply; 9+ messages in thread
From: Stéphane Glondu @ 2009-01-28 19:05 UTC (permalink / raw)
  To: Erick Matsen; +Cc: caml-list

Erick Matsen a écrit :
> Hm, unfortunately not the first one.
> 
>>> /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
> 
> It doesn't link...

Oh... I overlooked this one. You have to manage to get a set of .a files
so that each object (.o) is there only once. In this case, I would drop
libblas.a, since it is a dependency of liblapack (AFAIU).


Cheers,

-- 
Stéphane



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Caml-list] problem with LACAML and static linking
  2009-01-28 19:05             ` Stéphane Glondu
@ 2009-01-28 19:24               ` Markus Mottl
  0 siblings, 0 replies; 9+ messages in thread
From: Markus Mottl @ 2009-01-28 19:24 UTC (permalink / raw)
  To: Stéphane Glondu; +Cc: Erick Matsen, caml-list

On Wed, Jan 28, 2009 at 2:05 PM, Stéphane Glondu <steph@glondu.net> wrote:
> Oh... I overlooked this one. You have to manage to get a set of .a files
> so that each object (.o) is there only once. In this case, I would drop
> libblas.a, since it is a dependency of liblapack (AFAIU).

Another thing you could do is to copy one of the static libraries to
your build directory, remove the offending symbol using the "ar"
command line tool, and then link the resulting library and the other
one statically into your executable.  Dirty, but what you're gonna
do...

Regards,
Markus

-- 
Markus Mottl        http://www.ocaml.info        markus.mottl@gmail.com


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2009-01-28 19:24 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-01-28  6:48 problem with LACAML and static linking Erick Matsen
2009-01-28  7:20 ` [Caml-list] " Stéphane Glondu
2009-01-28 17:17   ` Erick Matsen
2009-01-28 17:33     ` Mauricio Fernandez
2009-01-28 17:56       ` Erick Matsen
2009-01-28 18:49         ` Stéphane Glondu
2009-01-28 18:50           ` Erick Matsen
2009-01-28 19:05             ` Stéphane Glondu
2009-01-28 19:24               ` Markus Mottl

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).