From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jon Ludlam Subject: Re: ocaml bindings Date: Thu, 4 Apr 2013 15:45:21 +0100 Message-ID: <515D9201.5060304@eu.citrix.com> References: <3258352.oW0QVvLMy7@localhost> <2486448.ytZYicRInf@localhost> <515C84D3.8050905@citrix.com> <3147867.Hp3ZN4mYPg@localhost> <515C91FC.1090804@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; Format="flowed" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <515C91FC.1090804@citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Andrew Cooper Cc: Dave Scott , AL13N , "xen-devel@lists.xen.org" List-Id: xen-devel@lists.xenproject.org On 03/04/13 21:33, Andrew Cooper wrote: > On 03/04/13 21:24, AL13N wrote: >> Op woensdag 3 april 2013 20:36:51 schreef Andrew Cooper: >>> On 03/04/13 20:24, AL13N wrote: >>>> Op woensdag 3 april 2013 20:18:53 schreef AL13N: >>>>> Op woensdag 3 april 2013 18:12:21 schreef Andrew Cooper: >>>>>> On 03/04/13 18:03, AL13N wrote: >>>>>>> i'm the Mageia Xen package maintainer, and a user reported that i had >>>>>>> missing symbols in my ocaml bindings: >>>>>>> >>>>>>> https://bugs.mageia.org/show_bug.cgi?id=5199 >>>>>>> >>>>>>> i'm using Xen 4.2.1 and ocaml 3.12.1 >>>>>>> >>>>>>> the problem is that if you just to a simple hello world and you're >>>>>>> using >>>>>>> certain bindings (eg: xeneventch): you get missing symbols. (others >>>>>>> appear >>>>>>> to be fine). >>>>>>> >>>>>>> I know next to nothing about ocaml, and it could be my build process, >>>>>>> but >>>>>>> i >>>>>>> kinda need some help about this. >>>>>>> >>>>>>> this is my spec file: >>>>>>> http://svnweb.mageia.org/packages/cauldron/xen/current >>>>>>> >>>>>>> Thanks in advance >>>>>>> >>>>>>> PS: we're at version freeze and release freeze is pretty soon :-S >>>>>> This is because the ocaml tools embed the build target links in the >>>>>> generated libs. If you try to link against them later outside the build >>>>>> environment, it will break. >>>>>> >>>>>> Attached is the patch used to fix this problem for XenServer for Xen >>>>>> 4.2. >>>>> thanks alot for the very quick help, i'm testing right now... >>>> it seems the tests definately improve things... >>>> >>>> [root@localhost ~]# cat testfile.ml >>>> print_string "hello" >>>> [root@localhost ~]# ocamlfind ocamlc -o test -thread -package xeneventchn >>>> - >>>> linkpkg -g testfile.ml >>>> [root@localhost ~]# ./test >>>> Fatal error: cannot load shared library dllxeneventchn_stubs >>>> Reason: dllxeneventchn_stubs.so: cannot open shared object file: No such >>>> file or directory >>>> >>>> >>>> (i have no idea if i need to ./test execute this, or if this is normal >>>> behavior) >>> You presumably need tools/ocaml/libs/eventchn/dllxeneventchn_stubs.so on >>> your load path. Under my system, would be installed to >>> /usr/local/lib/ocaml/3.11.2/xeneventchn/dllxeneventchn_stubs.so >> [root@localhost ~]# ls /usr/lib64/ocaml/xeneventchn/ -lsha >> total 64K >> 0 drwxr-xr-x 1 root root 246 Apr 3 19:16 ./ >> 0 drwxr-xr-x 1 root root 7.2K Apr 3 19:02 ../ >> 4.0K -rw-r--r-- 1 root root 150 Apr 3 18:35 META >> 12K -rwxr-xr-x 1 root root 11K Apr 3 18:40 dllxeneventchn_stubs.so* >> 24K -rw-r--r-- 1 root root 21K Apr 3 18:35 libxeneventchn_stubs.a >> 8.0K -rw-r--r-- 1 root root 4.5K Apr 3 18:35 xeneventchn.a >> 4.0K -rw-r--r-- 1 root root 2.8K Apr 3 18:35 xeneventchn.cma >> 4.0K -rw-r--r-- 1 root root 1.2K Apr 3 18:35 xeneventchn.cmi >> 4.0K -rw-r--r-- 1 root root 223 Apr 3 18:35 xeneventchn.cmx >> 4.0K -rw-r--r-- 1 root root 258 Apr 3 18:35 xeneventchn.cmxa >> >> what is this "load path" is this something like LD_LIBRARY_PATH ? > Unfortunately I am no expert in the workings of Ocaml. I will have to > defer to others. Jon/Dave - any ideas? > > ~Andrew Hmm. We don't actually use the bytecode compiler/toplevel, so there's a good chance that the patch doesn't fix them correctly. Could you please check to see whether it sorts out native code compilation for you? Try: jludlam@humongous:~$ cat test.ml let _ = let open Xenctrl in let v = with_intf version in Printf.printf "%d.%d%s\n" v.major v.minor v.extra jludlam@humongous:~$ ocamlfind ocamlopt -o test -thread -package xenctrl -linkpkg test.ml jludlam@humongous:~$ sudo ./test 4.2.1 Meanwhile, I'll investigate to see whether I can repro your problem (my ocaml libs are installed slightly differently than usual at the moment). Jon