Re: [Caml-list] [ANN] Ocamlnet-3.5

Gerd Stolpmann <[email protected]> Wed, 29 Feb 2012 14:41:09 +0100
Newsgroups gmane.comp.lang.ocaml.lib.net.devel
Message-ID <1330522869.2826.160.camel@thinkpad>
I get this on a Debian-6 system:

$ ocamlfind ocamlopt -package netstring -linkpkg test.ml -verbose
Effective set of compiler predicates:
pkg_pcre,pkg_unix,pkg_bigarray,pkg_netsys,pkg_netstring,autolink,native
+ ocamlopt.opt -verbose -I /opt/godi-3.12/lib/ocaml/pkg-lib/pcre
-I /opt/godi-3.12/lib/ocaml/pkg-lib/netsys
-I /opt/godi-3.12/lib/ocaml/pkg-lib/netstring /opt/godi-3.12/lib/ocaml/pkg-lib/pcre/pcre.cmxa /opt/godi-3.12/lib/ocaml/std-lib/unix.cmxa /opt/godi-3.12/lib/ocaml/std-lib/bigarray.cmxa /opt/godi-3.12/lib/ocaml/pkg-lib/netsys/netsys_oothr.cmxa /opt/godi-3.12/lib/ocaml/pkg-lib/netsys/netsys.cmxa /opt/godi-3.12/lib/ocaml/pkg-lib/netstring/netstring.cmxa test.ml
+ as -o 'test.o' '/tmp/camlasm721280.s'
+ as -o '/tmp/camlstartup8c9e55.o' '/tmp/camlstartupd01fb7.s'
+ gcc -o 'a.out'   '-L/opt/godi-3.12/lib/ocaml/pkg-lib/pcre'
'-L/opt/godi-3.12/lib/ocaml/pkg-lib/netsys'
'-L/opt/godi-3.12/lib/ocaml/pkg-lib/netstring'
'-L/opt/godi-3.12/lib/ocaml/std-lib' -L/opt/godi-3.12/lib
-Wl,-rpath,/opt/godi-3.12/lib -Wl,-R/opt/godi-3.12/lib
-L/opt/godi-3.12/lib -L/usr/lib '/tmp/camlstartup8c9e55.o'
'/opt/godi-3.12/lib/ocaml/std-lib/std_exit.o' 'test.o'
'/opt/godi-3.12/lib/ocaml/pkg-lib/netstring/netstring.a'
'/opt/godi-3.12/lib/ocaml/pkg-lib/netsys/netsys.a'
'/opt/godi-3.12/lib/ocaml/pkg-lib/netsys/netsys_oothr.a'
'/opt/godi-3.12/lib/ocaml/std-lib/bigarray.a'
'/opt/godi-3.12/lib/ocaml/std-lib/unix.a'
'/opt/godi-3.12/lib/ocaml/pkg-lib/pcre/pcre.a'
'/opt/godi-3.12/lib/ocaml/std-lib/stdlib.a' '-lnetsys' '-lrt'
'-lbigarray' '-lunix' '-lpcre_stubs' '-L/usr/lib' '-lpcre'
'/opt/godi-3.12/lib/ocaml/std-lib/libasmrun.a' -lm  -ldl

Apparently, there is no -lpthread, but this error is implicitly cured:

$ ldd a.out 
	linux-vdso.so.1 =>  (0x00007fff4b5c0000)
	librt.so.1 => /lib/librt.so.1 (0x00007fa366eb5000)
	libpcre.so.3 => /lib/libpcre.so.3 (0x00007fa366c85000)
	libm.so.6 => /lib/libm.so.6 (0x00007fa366a02000)
	libdl.so.2 => /lib/libdl.so.2 (0x00007fa3667fe000)
	libc.so.6 => /lib/libc.so.6 (0x00007fa36649c000)
	libpthread.so.0 => /lib/libpthread.so.0 (0x00007fa36627f000)
	/lib64/ld-linux-x86-64.so.2 (0x00007fa3670d7000)
$ ldd /lib/librt.so.1 
	linux-vdso.so.1 =>  (0x00007ffffbd35000)
	libc.so.6 => /lib/libc.so.6 (0x00007f0d1910d000)
	libpthread.so.0 => /lib/libpthread.so.0 (0x00007f0d18ef1000)
	/lib64/ld-linux-x86-64.so.2 (0x00007f0d19691000)

So, I think -lpthread should be added anyway. What I do not understand
in your output is that the semaphore functions (which have nothing to do
with threads) used to be in librt, not in libpthread, and they are also
not found. Was there some change on the OS side in the meantime?

Gerd


Am Mittwoch, den 29.02.2012, 09:57 +0100 schrieb Stéphane Glondu:
> Le 23/02/2012 00:04, Gerd Stolpmann a écrit :
> > it is time for another version of Ocamlnet. The new release 3.5 focuses on
> > the system interface, and includes a long list of smaller improvements.
> > [...]
> 
> It seems that this new release adds a new dependency to threads in some
> situations:
> 
> $ cat test.ml
> let () = ignore (Netconversion.ustring_of_uchar `Enc_utf8 0)
> $ ocamlfind ocamlopt -package netstring -linkpkg test.ml
> /usr/lib/ocaml/netsys/libnetsys.a(netsys_c_sem.o): In function
> `free_sem_block':
> (.text+0x58): undefined reference to `sem_close'
> /usr/lib/ocaml/netsys/libnetsys.a(netsys_c_sem.o): In function
> `netsys_sem_open':
> (.text+0xba): undefined reference to `sem_open'
> /usr/lib/ocaml/netsys/libnetsys.a(netsys_c_sem.o): In function
> `netsys_sem_close':
> (.text+0x10c): undefined reference to `sem_close'
> /usr/lib/ocaml/netsys/libnetsys.a(netsys_c_sem.o): In function
> `netsys_sem_unlink':
> (.text+0x13a): undefined reference to `sem_unlink'
> /usr/lib/ocaml/netsys/libnetsys.a(netsys_c_sem.o): In function
> `netsys_sem_init':
> (.text+0x178): undefined reference to `sem_init'
> /usr/lib/ocaml/netsys/libnetsys.a(netsys_c_sem.o): In function
> `netsys_sem_destroy':
> (.text+0x1d8): undefined reference to `sem_destroy'
> /usr/lib/ocaml/netsys/libnetsys.a(netsys_c_sem.o): In function
> `netsys_sem_getvalue':
> (.text+0x220): undefined reference to `sem_getvalue'
> /usr/lib/ocaml/netsys/libnetsys.a(netsys_c_sem.o): In function
> `netsys_sem_post':
> (.text+0x272): undefined reference to `sem_post'
> /usr/lib/ocaml/netsys/libnetsys.a(netsys_c_sem.o): In function
> `netsys_sem_wait':
> (.text+0x2cc): undefined reference to `sem_wait'
> /usr/lib/ocaml/netsys/libnetsys.a(netsys_c_sem.o): In function
> `netsys_sem_wait':
> (.text+0x2d8): undefined reference to `sem_trywait'
> /usr/lib/ocaml/netsys/libnetsys.a(netsys_c_spawn.o): In function
> `netsys_spawn_nat':
> (.text+0x81): undefined reference to `pthread_sigmask'
> /usr/lib/ocaml/netsys/libnetsys.a(netsys_c_spawn.o): In function
> `netsys_spawn_nat':
> (.text+0xa7b): undefined reference to `pthread_sigmask'
> /usr/lib/ocaml/netsys/libnetsys.a(netsys_c_spawn.o): In function
> `netsys_spawn_nat':
> (.text+0xb6d): undefined reference to `pthread_sigmask'
> /usr/lib/ocaml/netsys/libnetsys.a(netsys_c_subprocess.o): In function
> `sigchld_lock':
> (.text+0x34): undefined reference to `pthread_sigmask'
> /usr/lib/ocaml/netsys/libnetsys.a(netsys_c_subprocess.o): In function
> `sigchld_unlock':
> (.text+0x11a): undefined reference to `pthread_sigmask'
> /usr/lib/ocaml/netsys/libnetsys.a(netsys_c_subprocess.o): In function
> `netsys_watch_subprocess':
> (.text+0x65e): undefined reference to `pthread_create'
> collect2: ld returned 1 exit status
> File "caml_startup", line 1, characters 0-1:
> Error: Error during linking
> $ ocamlfind ocamlopt -thread -package netstring -linkpkg test.ml
> $ echo $?
> 0
> 
> Whith ocamlnet 3.4.1, the -thread switch was not needed. Is that
> expected? Even if it is, I would expect a more explanatory error message...
> 
> 
> Cheers,
> 

-- 
------------------------------------------------------------
Gerd Stolpmann, Darmstadt, Germany    [email protected]
Creator of GODI and camlcity.org.
Contact details:        http://www.camlcity.org/contact.html
Company homepage:       http://www.gerd-stolpmann.de
*** Searching for new projects! Need consulting for system
*** programming in Ocaml? Gerd Stolpmann can help you.
------------------------------------------------------------


------------------------------------------------------------------------------
Virtualization & Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing 
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
_______________________________________________
Ocamlnet-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ocamlnet-devel