Port-xen archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: xentools41 LDFLAGS Re: broken packages for 2012Q3



Hi,

On Sat, Nov 24, 2012 at 10:40:54PM -0800, Aaron J. Grier wrote:
> On Fri, Nov 23, 2012 at 11:45:20PM -0800, Aaron J. Grier wrote:
> > On Fri, Nov 23, 2012 at 10:02:45PM -0800, Aaron J. Grier wrote:
> > > see attached patch, which allows oxenstored to build with the
> > > correct rpath.  -L seems to take care of the link rpath.  untested,
> > > as I'm still getting another xen server assembled to test this on.
> > 
> > oxenstored compiles and runs, but falls over quickly due to some
> > linuxisms in define.ml that I'm now attempting to flush out.  :)
> 
> --- ocaml/Makefile.rules.orig 2012-11-20 08:16:03.000000000 +0000
> +++ ocaml/Makefile.rules      2012-11-20 08:16:48.000000000 +0000
> @@ -65,7 +65,7 @@
>   $(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,$$@, $$+, $(LIBS_$(1)))
> +     $(call mk-caml-lib-stubs,$$@, $$+, -ldopt -Wl,-rpath=$(PREFIX)/lib 
> $(LIBS_$(1)))
>  endef
>  
>  define OCAML_NOC_LIBRARY_template

Unfortunately, this is wrong - gmake uses , as argument separator for 
functions, so the above sequence results in all the part after -Wl being
left out, including $(LIBS_$(1)). That is, the resulting shared library
is missing the rpath as well as the references to the libraries.

The net-wisdom is to have

comma := ,

somewhere above in the file, and use

+     $(call mk-caml-lib-stubs,$$@, $$+, -ldopt -Wl$(comma)-rpath=$(PREFIX)/lib 
$(LIB S_$(1)))

Unfortunately, this doesn't solve the issue. If we do this, both the 
-L and the -Wl,-rpath path are added to the .so's rpath.

That's because ocamlmklib adds the -L arguments to the rpath used later with
-R, if they're absolute (defined for Unixoids as "starting with '/'"):

From ocamlmklib:

    else if starts_with s "-L" then
      (c_Lopts := s :: !c_Lopts;
      let l = chop_prefix s "-L" in
         if not (Filename.is_relative l) then rpath := l :: !rpath)

From stdlib/filename.ml:

module Unix = struct
        [...]
   let is_reltive n = String.length n < 1 || n.[0] <> '/';;

So when the OBJDIR is absolute, it's added.

I've escaleted this to the OCaML people as 

    <http://caml.inria.fr/mantis/view.php?id=5943>

I wonder if we have something to edit the resulting .so to fix the rpath?
otherwise a custom-edited ocamlmklib would work.

Regards,
        -is


Home | Main Index | Thread Index | Old Index