* ocamlgsl natively with MingW
@ 2007-02-02 14:36 Tobias Elze
0 siblings, 0 replies; only message in thread
From: Tobias Elze @ 2007-02-02 14:36 UTC (permalink / raw)
To: caml-list
Almost one year after my last message on this list where I asked for help compiling ocamlgsl with MingW, I succeeded. I want to thank Olivier Andrieu and Ulrich Steinmetz for their support and to provide the necessary steps here (since some of them are not obvious at all):
First of all, it seems not to be possible to link ocamlgsl dynamically. So when compiling it, remove the line DYNAMIC_LINKING=... from the Makefile.
After this, I was able to compile the library and could even generate native binaries of my programs which used it. However, whenever functions from Gsl_rnd where called, I received lots of compile warnings, and in many cases the compiled binaries were not working (crashing or doing nothing).
The solution was to link the gsl library _statically_ to my binaries. This could be done by adding the following arguments to ocamlopt: -ccopt -static. However, this links _every_ C library you use to your binary, and you may end up in lots of "undefined reference" errors, since all libraries that are required by your C libraries have to be linked as well, and you may have to spend hours or days with resolving dependencies and receive a giant executable.
To prevent this, I suggest not to use this global "static" flag but to link _only_ the gsl library statically and all other libraries dynamically. For this, one has to link gsl at the right position in the ocamlopt arguments. Here is a way that is working:
ocamlopt (...other options...) -cclib -Wl,-lmlgsl,-dn,-lgsl,-dy,-lgslcblas (...)
Finally, one has to link the pthread library by
-cclib -lpthread
With these tricks I succeeded, and even Gsl_rng is working.
Best regards,
Tobias.
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2007-02-02 14:36 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-02-02 14:36 ocamlgsl natively with MingW Tobias Elze
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).