issuu/ocaml-zmq

Build issue while Cross-Compiling

Closed this issue · 2 comments

Hi
I'm actually trying to cross-compile the ocaml-zmq, but I'm facing an issue as the system cannot find the correct zmq headers and c library
It appears that your ocamlbuild.ml has some hard paths (-I/usr/local/include"; and "-L/usr/local/lib")

Could you replace them by optional paths as suggested in following patch
Cheers
Erwan

--- myocamlbuild.ml	2017-11-07 07:37:46.818678563 +0100
+++ myocamlbuild.ml.new	2017-11-07 07:46:45.032930432 +0100
@@ -880,6 +880,17 @@
 
 # 881 "myocamlbuild.ml"
 open Ocamlbuild_plugin;;
+
+let mycflags =
+    try
+      "-I"^Sys.getenv "ZMQ_INCLUDE_PATH"
+    with _ -> "-I/usr/local/include"
+
+let myclibs =
+    try
+      "-L"^Sys.getenv "ZMQ_LIBRARY_PATH"
+    with _ -> "-L/usr/local/lib "
+
 let package_default =
   {
      MyOCamlbuildBase.lib_ocaml = [("ZMQ", ["src"], [])];
@@ -897,7 +908,7 @@
                  S
                    [
                       A "-ccopt";
-                      A "-I/usr/local/include";
+                      A mycflags;
                       A "-ccopt";
                       A "-I.";
                       A "-ccopt";
@@ -915,10 +926,10 @@
           (["oasis_library_zmq_cclib"; "link"],
             [
                (OASISExpr.EBool true,
-                 S [A "-cclib"; A "-L/usr/local/lib"; A "-cclib"; A "-lzmq"])
+                 S [A "-cclib"; A myclibs; A "-cclib"; A "-lzmq"])
             ]);
           (["oasis_library_zmq_cclib"; "ocamlmklib"; "c"],
-            [(OASISExpr.EBool true, S [A "-L/usr/local/lib"; A "-lzmq"])]);
+            [(OASISExpr.EBool true, S [A myclibs; A "-lzmq"])]);
           (["oasis_executable_test_byte"; "ocaml"; "link"; "byte"],
             [(OASISExpr.EBool true, S [A "-thread"])]);
           (["oasis_executable_test_native"; "ocaml"; "link"; "native"],

We switched build system to jbuild (soon dune). Could you please retest and see if that fixes cross-compilation?
opam pin add zmq --dev-repo

I'm closing this issue, as we have switched the build system.
Please reopen if the problem persists.
A new package should be available in opam shortly (#55)