Re: Ocamlfind does not allow -thread

"Sébastien Dailly [email protected] [ocaml_beginners]" <[email protected]> Tue, 22 Dec 2015 15:40:16 +0100
Newsgroups gmane.comp.lang.ocaml.beginners
Message-ID <[email protected]>
Le 2015-12-22 13:28, Gabriel Scherer [email protected] 
[ocaml_beginners] a écrit :
> After looking at findlib's ./configure script, it appears that the
> type_of_thread setting depends on the output of $(ocamlc -config |
> grep systhread_supported). On my machine,
> 
> $ ocamlc -config | grep systhread_supported
> systhread_supported: true
> 
> In the output of the OCaml compiler ./configure script, I have the
> lines
> 
> POSIX threads library supported.
> [..]
> Bytecode threads library supported.
> [..]
> Additional libraries supported:
>         unix str num dynlink bigarray systhreads threads graph
> 
> Look for "POSIX thread" in OCaml's ./configure script to see how this
> variable is determined.
> 
> On Tue, Dec 22, 2015 at 1:11 PM, Sébastien Dailly
> [email protected] [ocaml_beginners]
> <[email protected]> wrote:
> 

I've made a sample C source :

---
#include <pthread.h>
int main()
{
    return 0;
}
---

which compile fine with « gcc test.c ». Adding -lpthread break the 
compilation :

$ gcc test.c -lpthread
/usr/lib/gcc/i686-pc-cygwin/4.9.3/../../../../i686-pc-cygwin/bin/ld: ne 
peut trouver -lpthread
collect2: erreur: ld a retourné 1 code d'état d'exécution

(I'm not a cygwin dev, I do not know why the library has been removed.)

the file configure.sh tries to include the library by default :

   case "$target" in
     *-*-solaris*)  pthread_link="-lpthread -lposix4"
                    pthread_caml_link="-cclib -lpthread -cclib 
-lposix4";;
     *-*-freebsd*)  pthread_link="-pthread"
                    pthread_caml_link="-cclib -pthread";;
     *-*-openbsd*)  pthread_link="-pthread"
                    pthread_caml_link="-cclib -pthread";;
     *-*-haiku*)    pthread_link=""
                    pthread_caml_link="";;
     *)             pthread_link="-lpthread"
                    pthread_caml_link="-cclib -lpthread";;

This may be the cause to the troubles… Do you think I'm searching in the 
good direction ?