All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Cooper <andrew.cooper3@citrix.com>
To: AL13N <alien@rmail.be>
Cc: "xen-devel@lists.xen.org" <xen-devel@lists.xen.org>
Subject: Re: ocaml bindings
Date: Wed, 3 Apr 2013 18:12:21 +0100	[thread overview]
Message-ID: <515C62F5.1040907@citrix.com> (raw)
In-Reply-To: <3258352.oW0QVvLMy7@localhost>

[-- Attachment #1: Type: text/plain, Size: 1087 bytes --]

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.

~Andrew

>
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xen.org
> http://lists.xen.org/xen-devel


[-- Attachment #2: xen-4.2-ocaml-build-patch --]
[-- Type: text/plain, Size: 2440 bytes --]

diff -r 9b10adc11ae6 tools/ocaml/Makefile.rules
--- a/tools/ocaml/Makefile.rules
+++ b/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
diff -r 9b10adc11ae6 tools/ocaml/libs/eventchn/Makefile
--- a/tools/ocaml/libs/eventchn/Makefile
+++ b/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)
 
diff -r 9b10adc11ae6 tools/ocaml/libs/xc/Makefile
--- a/tools/ocaml/libs/xc/Makefile
+++ b/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
diff -r 9b10adc11ae6 tools/ocaml/xenstored/Makefile
--- a/tools/ocaml/xenstored/Makefile
+++ b/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
 

[-- Attachment #3: Type: text/plain, Size: 126 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

  reply	other threads:[~2013-04-03 17:12 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-03 17:03 ocaml bindings AL13N
2013-04-03 17:12 ` Andrew Cooper [this message]
2013-04-03 18:18   ` AL13N
2013-04-03 19:24     ` AL13N
2013-04-03 19:36       ` Andrew Cooper
2013-04-03 20:24         ` AL13N
2013-04-03 20:33           ` Andrew Cooper
2013-04-03 21:10             ` AL13N
2013-04-04 14:45             ` Jon Ludlam
2013-04-04 18:40               ` AL13N
2013-04-05 18:19                 ` Vincent Bernardoff
2013-04-05 19:05                   ` Anil Madhavapeddy
2013-04-05 19:13                     ` Andrew Cooper
2013-04-08 15:57                 ` ocaml bindings [and 1 more messages] Ian Jackson
2013-04-08 21:14                   ` AL13N

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=515C62F5.1040907@citrix.com \
    --to=andrew.cooper3@citrix.com \
    --cc=alien@rmail.be \
    --cc=xen-devel@lists.xen.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.