Skip to contentSkip to conversation

ocaml bindings

DISCUSSION AL13N 6 participants 15 messages Apr 3, 2013 – Apr 8, 2013

lore
Share & tools
lore

AL13N

author
#0 lore raw

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

#1 lore raw
Quoted 11 lines · 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).

Quoted 8 lines

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.

~Andrew

Quoted 5 lines

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

tools/ocaml/Makefile.rules +2 -8
diff -r 9b10adc11ae6 tools/ocaml/Makefile.rules
@@ -58,14 +58,8 @@
 
 # define a library target <name>.cmxa and <name>.cma
 define OCAML_LIBRARY_template
- $(1).cmxa: lib$(1)_stubs.a $(foreach obj,$($(1)_OBJS),$(obj).cmx)
-	$(call mk-caml-lib-native,$$@, -cclib -l$(1)_stubs $(foreach lib,$(LIBS_$(1)),-cclib $(lib)), $(foreach obj,$($(1)_OBJS),$(obj).cmx))
- $(1).cma: $(foreach obj,$($(1)_OBJS),$(obj).cmo)
-	$(call mk-caml-lib-bytecode,$$@, -dllib dll$(1)_stubs.so -cclib -l$(1)_stubs $(foreach lib,$(LIBS_$(1)),-cclib $(lib)), $$+)
- $(1)_stubs.a: $(foreach obj,$$($(1)_C_OBJS),$(obj).o)
-	$(call mk-caml-stubs,$$@, $$+)
- lib$(1)_stubs.a: $(foreach obj,$($(1)_C_OBJS),$(obj).o)
-	$(call mk-caml-lib-stubs,$$@, $$+)
+$(1).cma: $(foreach obj,$($(1)_OBJS),$(obj).cmx $(obj).cmo) $(foreach obj,$($(1)_C_OBJS),$(obj).o)
+	$(OCAMLMKLIB) -o $1 -oc $(1)_stubs $(foreach obj,$($(1)_OBJS),$(obj).cmx $(obj).cmo) $(foreach obj,$($(1)_C_OBJS),$(obj).o) $(foreach lib, $(LIBS_$(1)_SYSTEM), -cclib $(lib)) $(foreach arg,$(LIBS_$(1)),-ldopt $(arg))
 endef
 
 define OCAML_NOC_LIBRARY_template
tools/ocaml/libs/eventchn/Makefile +1 -0
diff -r 9b10adc11ae6 tools/ocaml/libs/eventchn/Makefile
@@ -9,6 +9,7 @@
 LIBS = xeneventchn.cma xeneventchn.cmxa
 
 LIBS_xeneventchn = $(LDLIBS_libxenctrl)
+LIBS_xeneventchn_SYSTEM = -lxenctrl
 
 all: $(INTF) $(LIBS) $(PROGRAMS)
 
tools/ocaml/libs/xc/Makefile +1 -0
diff -r 9b10adc11ae6 tools/ocaml/libs/xc/Makefile
@@ -10,6 +10,7 @@
 LIBS = xenctrl.cma xenctrl.cmxa
 
 LIBS_xenctrl = $(LDLIBS_libxenctrl) $(LDLIBS_libxenguest)
+LIBS_xenctrl_SYSTEM = -lxenctrl -lxenguest
 
 xenctrl_OBJS = $(OBJS)
 xenctrl_C_OBJS = xenctrl_stubs
tools/ocaml/xenstored/Makefile +3 -1
diff -r 9b10adc11ae6 tools/ocaml/xenstored/Makefile
@@ -43,7 +43,9 @@
 	-ccopt -L -ccopt $(OCAML_TOPLEVEL)/libs/eventchn $(OCAML_TOPLEVEL)/libs/eventchn/xeneventchn.cmxa \
 	-ccopt -L -ccopt $(OCAML_TOPLEVEL)/libs/xc $(OCAML_TOPLEVEL)/libs/xc/xenctrl.cmxa \
 	-ccopt -L -ccopt $(OCAML_TOPLEVEL)/libs/xb $(OCAML_TOPLEVEL)/libs/xb/xenbus.cmxa \
-	-ccopt -L -ccopt $(XEN_ROOT)/tools/libxc
+	-ccopt -L -ccopt $(XEN_ROOT)/tools/libxc \
+	$(foreach obj, $(LDLIBS_libxenctrl), -ccopt $(obj)) \
+	$(foreach obj, $(LDLIBS_libxenguest), -ccopt $(obj)) 
 
 PROGRAMS = oxenstored
 

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

author
#2 lore raw

Op woensdag 3 april 2013 18:12:21 schreef Andrew Cooper:

Quoted 21 lines · On 03/04/13 18:03, AL13N wrote:
Quoted 20 lines

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

Quoted 7 lines
Quoted 1 line

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

author
#3 lore raw

Op woensdag 3 april 2013 20:18:53 schreef AL13N:

Quoted 26 lines

Op woensdag 3 april 2013 18:12:21 schreef Andrew Cooper:

Quoted 25 lines · On 03/04/13 18:03, AL13N wrote:
Quoted 23 lines

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

Quoted 7 lines
Quoted 5 lines

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)

one more thing:

[root@localhost ~]# cat /usr/lib64/ocaml/xenlight/META version = "4.1"
description = "Xen Toolstack Library" archive(byte) = "xl.cma"
archive(native) = "xl.cmxa"

it should be xenlight.cma

(the others are fine)

#4 lore raw
Quoted 44 lines · On 03/04/13 20:24, AL13N wrote:

Op woensdag 3 april 2013 20:18:53 schreef AL13N:

Quoted 24 lines

Op woensdag 3 april 2013 18:12:21 schreef Andrew Cooper:

Quoted 23 lines · On 03/04/13 18:03, AL13N wrote:
Quoted 22 lines

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

Quoted 7 lines
Quoted 6 lines
Quoted 1 line

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

Quoted 2 lines

(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

Quoted 9 lines

one more thing:

[root@localhost ~]# cat /usr/lib64/ocaml/xenlight/META version = "4.1"
description = "Xen Toolstack Library" archive(byte) = "xl.cma"
archive(native) = "xl.cmxa"

Quoted 3 lines

it should be xenlight.cma

(the others are fine)

Looks like it is still broken upstream. I will submit another patch.

Quoted 6 lines

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

author
#5 lore raw

Op woensdag 3 april 2013 20:36:51 schreef Andrew Cooper:

Quoted 51 lines · On 03/04/13 20:24, AL13N wrote:
Quoted 50 lines

Op woensdag 3 april 2013 20:18:53 schreef AL13N:

Quoted 27 lines

Op woensdag 3 april 2013 18:12:21 schreef Andrew Cooper:

Quoted 26 lines · On 03/04/13 18:03, AL13N wrote:
Quoted 24 lines

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

Quoted 8 lines
Quoted 6 lines

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

Quoted 6 lines
Quoted 2 lines

(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 ?

Quoted 8 lines
Quoted 8 lines

one more thing:

[root@localhost ~]# cat /usr/lib64/ocaml/xenlight/META version = "4.1"
description = "Xen Toolstack Library" archive(byte) = "xl.cma"
archive(native) = "xl.cmxa"

Quoted 5 lines
Quoted 3 lines

it should be xenlight.cma

(the others are fine)

Looks like it is still broken upstream. I will submit another patch.

thank you!

#6 lore raw
Quoted 67 lines · On 03/04/13 21:24, AL13N wrote:

Op woensdag 3 april 2013 20:36:51 schreef Andrew Cooper:

Quoted 48 lines · On 03/04/13 20:24, AL13N wrote:
Quoted 47 lines

Op woensdag 3 april 2013 20:18:53 schreef AL13N:

Quoted 25 lines

Op woensdag 3 april 2013 18:12:21 schreef Andrew Cooper:

Quoted 24 lines · On 03/04/13 18:03, AL13N wrote:
Quoted 23 lines

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

Quoted 8 lines
Quoted 7 lines
Quoted 1 line

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

Quoted 5 lines
Quoted 2 lines

(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
Quoted 1 line

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

Quoted 15 lines
Quoted 10 lines
Quoted 10 lines

one more thing:

[root@localhost ~]# cat /usr/lib64/ocaml/xenlight/META version = "4.1"
description = "Xen Toolstack Library" archive(byte) = "xl.cma"
archive(native) = "xl.cmxa"

Quoted 4 lines
Quoted 3 lines

it should be xenlight.cma

(the others are fine)

Looks like it is still broken upstream. I will submit another patch.

thank you!

author
#7 lore raw

Op woensdag 3 april 2013 21:33:00 schreef Andrew Cooper:

Quoted 79 lines · On 03/04/13 21:24, AL13N wrote:
Quoted 78 lines

Op woensdag 3 april 2013 20:36:51 schreef Andrew Cooper:

Quoted 53 lines · On 03/04/13 20:24, AL13N wrote:
Quoted 52 lines

Op woensdag 3 april 2013 20:18:53 schreef AL13N:

Quoted 32 lines

Op woensdag 3 april 2013 18:12:21 schreef Andrew Cooper:

Quoted 31 lines · On 03/04/13 18:03, AL13N wrote:
Quoted 18 lines

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.

Quoted 6 lines

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.

Quoted 4 lines
Quoted 2 lines

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

Quoted 6 lines
Quoted 2 lines

(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
Quoted 4 lines
Quoted 1 line

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?

[...]

i've found out that there is a file (i presume like ld.so.conf):
[root@localhost ~]# cat /usr/lib64/ocaml/ld.conf /usr/lib64/ocaml/stublibs
/usr/lib64/ocaml

and most of all the dllXXXXX_stubs.so files from other packages are in that first directory

perhaps it should be put there, not sure if this is something that you guys should do, or i would just fix in my packages

Maarten

#8 lore raw
In reply to Andrew Cooper
Quoted 68 lines · Andrew Cooper
Quoted 67 lines · On 03/04/13 21:24, AL13N wrote:

Op woensdag 3 april 2013 20:36:51 schreef Andrew Cooper:

Quoted 48 lines · On 03/04/13 20:24, AL13N wrote:
Quoted 47 lines

Op woensdag 3 april 2013 20:18:53 schreef AL13N:

Quoted 25 lines

Op woensdag 3 april 2013 18:12:21 schreef Andrew Cooper:

Quoted 24 lines · On 03/04/13 18:03, AL13N wrote:
Quoted 23 lines

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

Quoted 8 lines
Quoted 7 lines
Quoted 1 line

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

Quoted 5 lines
Quoted 2 lines

(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
Quoted 5 lines
Quoted 1 line

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

author
#9 lore raw

Op donderdag 4 april 2013 15:45:21 schreef Jon Ludlam:

Quoted 106 lines · Andrew Cooper
Quoted 82 lines · On 03/04/13 21:24, AL13N wrote:
Quoted 81 lines

Op woensdag 3 april 2013 20:36:51 schreef Andrew Cooper:

Quoted 56 lines · On 03/04/13 20:24, AL13N wrote:
Quoted 55 lines

Op woensdag 3 april 2013 20:18:53 schreef AL13N:

Quoted 34 lines

Op woensdag 3 april 2013 18:12:21 schreef Andrew Cooper:

Quoted 33 lines · On 03/04/13 18:03, AL13N wrote:
Quoted 20 lines

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.

Quoted 6 lines

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.

Quoted 4 lines
Quoted 2 lines

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

Quoted 6 lines
Quoted 2 lines

(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
Quoted 6 lines
Quoted 1 line

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
Quoted 2 lines

Meanwhile, I'll investigate to see whether I can repro your problem (my ocaml libs are installed slightly differently than usual at the moment).

actually, when i moved the dll*_stubs.so to the /usr/lib64/ocaml/dllstubs/ directory it seems i was successfull...

#10 lore raw

Hi there.

Please try applying this patch (and only this patch) on top of Xen (4.2 or unstable). It should fix all the OCaml issues.

Please give me feedback if possible.

Thanks!

Vincent

tools/Rules.mk +4 -4
index 8d55e03..91a5d02 100644
@@ -20,15 +20,15 @@ XEN_LIBVCHAN       = $(XEN_ROOT)/tools/libvchan
 CFLAGS_xeninclude = -I$(XEN_INCLUDE)
 
 CFLAGS_libxenctrl = -I$(XEN_LIBXC) $(CFLAGS_xeninclude)
-LDLIBS_libxenctrl = $(XEN_LIBXC)/libxenctrl.so
+LDLIBS_libxenctrl = -L$(XEN_LIBXC) -lxenctrl
 SHLIB_libxenctrl  = -Wl,-rpath-link=$(XEN_LIBXC)
 
 CFLAGS_libxenguest = -I$(XEN_LIBXC) $(CFLAGS_xeninclude)
-LDLIBS_libxenguest = $(XEN_LIBXC)/libxenguest.so
+LDLIBS_libxenguest = -L$(XEN_LIBXC) -lxenguest
 SHLIB_libxenguest  = -Wl,-rpath-link=L$(XEN_LIBXC)
 
 CFLAGS_libxenstore = -I$(XEN_XENSTORE) $(CFLAGS_xeninclude)
-LDLIBS_libxenstore = $(XEN_XENSTORE)/libxenstore.so
+LDLIBS_libxenstore = -L$(XEN_XENSTORE) -lxenstore
 SHLIB_libxenstore  = -Wl,-rpath-link=$(XEN_XENSTORE)
 
 CFLAGS_libxenstat  = -I$(XEN_LIBXENSTAT)
@@ -56,7 +56,7 @@ SHLIB_libblktapctl  =
 endif
 
 CFLAGS_libxenlight = -I$(XEN_XENLIGHT) $(CFLAGS_libxenctrl) $(CFLAGS_xeninclude)
-LDLIBS_libxenlight = $(XEN_XENLIGHT)/libxenlight.so $(SHLIB_libxenctrl) $(SHLIB_libxenstore) $(SHLIB_libblktapctl)
+LDLIBS_libxenlight = -L$(XEN_XENLIGHT) -lxenlight $(SHLIB_libxenctrl) $(SHLIB_libxenstore) $(SHLIB_libblktapctl)
 SHLIB_libxenlight  = -Wl,-rpath-link=$(XEN_XENLIGHT)
 
 CFLAGS += -D__XEN_TOOLS__
tools/ocaml/Makefile.rules +3 -3
index ff19067..28b81a9 100644
@@ -45,7 +45,7 @@ ALL_OCAML_OBJ_SOURCES=$(addsuffix .ml, $(ALL_OCAML_OBJS))
 	$(call quiet-command, $(OCAMLDEP) $(ALL_OCAML_OBJ_SOURCES) *.mli $o,MLDEP,)
 
 clean: $(CLEAN_HOOKS)
-	$(Q)rm -f .*.d *.o *.so *.a *.cmo *.cmi *.cma *.cmx *.cmxa *.annot *.spot *.spit $(LIBS) $(PROGRAMS) $(GENERATED_FILES) .ocamldep.make
+	$(Q)rm -f .*.d *.o *.so *.a *.cmo *.cmi *.cma *.cmx *.cmxa *.annot *.spot *.spit $(LIBS) $(PROGRAMS) $(GENERATED_FILES) .ocamldep.make META
 
 quiet-command = $(if $(V),$1,@printf " %-8s %s\n" "$2" "$3" && $1)
 
@@ -54,7 +54,7 @@ mk-caml-lib-bytecode = $(call quiet-command, $(OCAMLC) $(OCAMLCFLAGS) -a -o $1 $
 
 mk-caml-stubs = $(call quiet-command, $(OCAMLMKLIB) -o `basename $1 .a` $2,MKLIB,$1)
 mk-caml-lib-stubs = \
-	$(call quiet-command, $(AR) rcs $1 $2 && $(OCAMLMKLIB) -o `basename $1 .a | sed -e 's/^lib//'` $2,MKLIB,$1)
+	$(call quiet-command, $(OCAMLMKLIB) -o `basename $1 .a | sed -e 's/^lib//'` $2 $3,MKLIB,$1)
 
 # define a library target <name>.cmxa and <name>.cma
 define OCAML_LIBRARY_template
@@ -65,7 +65,7 @@ define OCAML_LIBRARY_template
  $(1)_stubs.a: $(foreach obj,$$($(1)_C_OBJS),$(obj).o)
 	$(call mk-caml-stubs,$$@, $$+)
  lib$(1)_stubs.a: $(foreach obj,$($(1)_C_OBJS),$(obj).o)
-	$(call mk-caml-lib-stubs,$$@, $$+)
+	$(call mk-caml-lib-stubs,$$@, $$+, $(foreach lib,$(LIBS_$(1)),$(lib)))
 endef
 
 define OCAML_NOC_LIBRARY_template
tools/ocaml/common.make +1 -1
index d5478f6..c9356f3 100644
@@ -15,7 +15,7 @@ OCAMLOPTFLAG_G := $(shell $(OCAMLOPT) -h 2>&1 | sed -n 's/^  *\(-g\) .*/\1/p')
 OCAMLOPTFLAGS = $(OCAMLOPTFLAG_G) -ccopt "$(LDFLAGS)" -dtypes $(OCAMLINCLUDE) -cc $(CC) -w F -warn-error F
 OCAMLCFLAGS += -g $(OCAMLINCLUDE) -w F -warn-error F
 
-VERSION := 4.1
+VERSION := 4.3
 
 OCAMLDESTDIR ?= $(DESTDIR)$(shell $(OCAMLFIND) printconf destdir)
 
tools/ocaml/libs/xl/META.in +2 -2
index 9c4405a..fe2c60b 100644
@@ -1,4 +1,4 @@
 version = "@VERSION@"
 description = "Xen Toolstack Library"
-archive(byte) = "xl.cma"
-archive(native) = "xl.cmxa"
+archive(byte) = "xenlight.cma"
+archive(native) = "xenlight.cmxa"

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#11 lore raw
Quoted 7 lines · Vincent Bernardoff

Hi there.

Please try applying this patch (and only this patch) on top of Xen (4.2 or unstable). It should fix all the OCaml issues.

Please give me feedback if possible.

tools/ocaml/common.make +1 -1
@@ -15,7 +15,7 @@ OCAMLOPTFLAG_G := $(shell $(OCAMLOPT) -h 2>&1 | sed -n 's/^  *\(-g\) .*/\1/p')
 OCAMLOPTFLAGS = $(OCAMLOPTFLAG_G) -ccopt "$(LDFLAGS)" -dtypes $(OCAMLINCLUDE) -cc $(CC) -w F -warn-error F
 OCAMLCFLAGS += -g $(OCAMLINCLUDE) -w F -warn-error F
 
-VERSION := 4.1
+VERSION := 4.3
 

This shouldn't really be hardcoded here; isn't there XEN_VERSION or something from the main Makefile's that'll stop this getting out of sync all the time?

-anil

#12 lore raw
Quoted 20 lines · Anil Madhavapeddy
Quoted 7 lines · Vincent Bernardoff

Hi there.

Please try applying this patch (and only this patch) on top of Xen (4.2 or unstable). It should fix all the OCaml issues.

Please give me feedback if possible.

tools/ocaml/common.make +1 -1
@@ -15,7 +15,7 @@ OCAMLOPTFLAG_G := $(shell $(OCAMLOPT) -h 2>&1 | sed -n 's/^  *\(-g\) .*/\1/p')
 OCAMLOPTFLAGS = $(OCAMLOPTFLAG_G) -ccopt "$(LDFLAGS)" -dtypes $(OCAMLINCLUDE) -cc $(CC) -w F -warn-error F
 OCAMLCFLAGS += -g $(OCAMLINCLUDE) -w F -warn-error F
 
-VERSION := 4.1
+VERSION := 4.3
 

This shouldn't really be hardcoded here; isn't there XEN_VERSION or something from the main Makefile's that'll stop this getting out of sync all the time?

Quoted 1 line

-anil

There are several places like this in the build system. The docs directory is another location which comes to mind.

XEN_VERSION is defined in the Xen root makefile, and there is a .PHONY target called xenversion to get at it.

I did submit a patch ages ago but it got nowhere (and now I cant seem to find the email in the archives) I will see if I still have the patch lying around

~Andrew

Quoted 4 lines

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#13 lore raw

Re: ocaml bindings [and 1 more messages]

In reply to Vincent Bernardoff

Vincent Bernardoff writes ("Re: [Xen-devel] ocaml bindings"):

Quoted 3 lines

Please try applying this patch (and only this patch) on top of Xen (4.2 or unstable).
It should fix all the OCaml issues.

Thanks for the mail. I have restored the CC to the original reporter.

Alien, please let us know how you get on with this.

Regards,
Ian.

author
#14 lore raw

Re: ocaml bindings [and 1 more messages]

Op maandag 8 april 2013 16:57:25 schreef Ian Jackson:

Quoted 11 lines

Vincent Bernardoff writes ("Re: [Xen-devel] ocaml bindings"):

Quoted 3 lines

Please try applying this patch (and only this patch) on top of Xen (4.2 or unstable).
It should fix all the OCaml issues.

Thanks for the mail. I have restored the CC to the original reporter.

Alien, please let us know how you get on with this.

Regards,
Ian.

To be honest, i applied the 2 earlier patches and then moved the dll*_stub.so files into ../dllstubs/ (as this is where other ocaml-foo packages have put these into mageia.) that has been verified by the original reporter.

That means i'm going to keep it this way for now (in Mageia), so i haven't tested this patch. (because we are close to a release and since yesterday into release-freeze.)

However, for Mageia 4 i will use 4.3 (or later) and thus will use this patch as part of it.

Sorry for not testing it at this time.

Regards,

Maarten