tags 783919 +patch thanks On Thu, Nov 26, 2015 at 01:33:19PM +0100, Sylvestre Ledru wrote: > I will be happy to apply a patch if you have any. >
Hi Sylvestre, Here is a patch for llvm-toolchain-3.6. It is now possible to build it with the bindings enabled, since ocaml-ctypes >= 0.4 has transitioned [1]. Basically, besides re-enabling it, I just had to fix the documentation installdir, and add a patch to fix a wrong use of the ctypes API. Note that this patch was taken from gentoo [2]. Also, I had to disable the checks (DEB_BUILD_OPTIONS=nocheck). I have a similar patch for llvm-toolchain-3.7 (without the ctypes patch, fixed upstream), I will open a separate bug. Thanks, Pierre [1] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=792657 [2] https://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/sys-devel/llvm/files/llvm-3.6.0-ocaml-ctypes-0.4.0.patch?view=markup
diff -ruN llvm-toolchain-3.6-3.6.2/debian/libllvm-X.Y-ocaml-dev.install.in llvm-toolchain-3.6-3.6.2-ocaml/debian/libllvm-X.Y-ocaml-dev.install.in --- llvm-toolchain-3.6-3.6.2/debian/libllvm-X.Y-ocaml-dev.install.in 2015-01-14 19:45:58.000000000 +0100 +++ llvm-toolchain-3.6-3.6.2-ocaml/debian/libllvm-X.Y-ocaml-dev.install.in 2016-01-08 14:39:38.003715195 +0100 @@ -1,2 +1,2 @@ -#@OCAML_STDLIB_DIR@/llvm-@LLVM_VERSION@ @OCAML_STDLIB_DIR@/ -#usr/lib/llvm-@LLVM_VERSION@/docs/llvm/ocamldoc/html usr/share/doc/libllvm-@LLVM_VERSION@-ocaml-dev/ +@OCAML_STDLIB_DIR@/llvm-@LLVM_VERSION@ @OCAML_STDLIB_DIR@/ +usr/lib/llvm-@LLVM_VERSION@/docs/llvm/html usr/share/doc/libllvm-@LLVM_VERSION@-ocaml-dev/ diff -ruN llvm-toolchain-3.6-3.6.2/debian/patches/llvm-3.6.0-ocaml-ctypes-0.4.0.patch llvm-toolchain-3.6-3.6.2-ocaml/debian/patches/llvm-3.6.0-ocaml-ctypes-0.4.0.patch --- llvm-toolchain-3.6-3.6.2/debian/patches/llvm-3.6.0-ocaml-ctypes-0.4.0.patch 1970-01-01 01:00:00.000000000 +0100 +++ llvm-toolchain-3.6-3.6.2-ocaml/debian/patches/llvm-3.6.0-ocaml-ctypes-0.4.0.patch 2016-01-08 11:14:03.825228679 +0100 @@ -0,0 +1,35 @@ +diff -Naur llvm-3.6.0.src.orig/bindings/ocaml/executionengine/llvm_executionengine.ml llvm-3.6.0.src/bindings/ocaml/executionengine/llvm_executionengine.ml +--- llvm-3.6.0.src.orig/bindings/ocaml/executionengine/llvm_executionengine.ml 2015-03-17 11:49:27.274824345 +0100 ++++ llvm-3.6.0.src/bindings/ocaml/executionengine/llvm_executionengine.ml 2015-03-17 11:49:40.333829421 +0100 +@@ -43,11 +43,11 @@ + = "llvm_ee_run_static_dtors" + external data_layout : llexecutionengine -> Llvm_target.DataLayout.t + = "llvm_ee_get_data_layout" +-external add_global_mapping_ : Llvm.llvalue -> int64 -> llexecutionengine -> unit ++external add_global_mapping_ : Llvm.llvalue -> nativeint -> llexecutionengine -> unit + = "llvm_ee_add_global_mapping" +-external get_global_value_address_ : string -> llexecutionengine -> int64 ++external get_global_value_address_ : string -> llexecutionengine -> nativeint + = "llvm_ee_get_global_value_address" +-external get_function_address_ : string -> llexecutionengine -> int64 ++external get_function_address_ : string -> llexecutionengine -> nativeint + = "llvm_ee_get_function_address" + + let add_global_mapping llval ptr ee = +@@ -55,14 +55,14 @@ + + let get_global_value_address name typ ee = + let vptr = get_global_value_address_ name ee in +- if Int64.to_int vptr <> 0 then ++ if Nativeint.to_int vptr <> 0 then + let open Ctypes in !@ (coerce (ptr void) (ptr typ) (ptr_of_raw_address vptr)) + else + raise (Error ("Value " ^ name ^ " not found")) + + let get_function_address name typ ee = + let fptr = get_function_address_ name ee in +- if Int64.to_int fptr <> 0 then ++ if Nativeint.to_int fptr <> 0 then + let open Ctypes in coerce (ptr void) typ (ptr_of_raw_address fptr) + else + raise (Error ("Function " ^ name ^ " not found")) diff -ruN llvm-toolchain-3.6-3.6.2/debian/patches/series llvm-toolchain-3.6-3.6.2-ocaml/debian/patches/series --- llvm-toolchain-3.6-3.6.2/debian/patches/series 2015-09-21 11:14:07.000000000 +0200 +++ llvm-toolchain-3.6-3.6.2-ocaml/debian/patches/series 2016-01-08 11:14:33.249984884 +0100 @@ -38,3 +38,4 @@ bug783205.patch bug-24472.diff bug-790686-build-id.diff +llvm-3.6.0-ocaml-ctypes-0.4.0.patch diff -ruN llvm-toolchain-3.6-3.6.2/debian/rules llvm-toolchain-3.6-3.6.2-ocaml/debian/rules --- llvm-toolchain-3.6-3.6.2/debian/rules 2015-10-20 18:40:08.000000000 +0200 +++ llvm-toolchain-3.6-3.6.2-ocaml/debian/rules 2015-11-27 17:27:44.294897572 +0100 @@ -207,17 +207,16 @@ --with-optimize-option=' $(opt_flags)' \ --enable-pic \ --enable-libffi \ + --with-ocaml-libdir=/usr/lib/ocaml/llvm-$(LLVM_VERSION) \ --libdir=\$${prefix}/lib/$(DEB_HOST_MULTIARCH) \ --with-binutils-include=/usr/include \ --with-cloog --with-isl \ --with-bug-report-url=http://bugs.debian.org/ \ --enable-shared \ - --disable-bindings \ $(CONFIGURE_EXTRA) \ CLANG_VENDOR=$(VENDOR) || { cat config.log tools/polly/config.log; exit 1; } # cd $(TARGET_BUILD) && cmake ../ -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_VERBOSE_MAKEFILE=ON # mkdir build-compiler-rt && cd build-compiler-rt && cmake ../compiler-rt -# --with-ocaml-libdir=/usr/lib/ocaml/llvm-$(LLVM_VERSION) \ override_dh_auto_build: