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

Trying to build on FreeBSD



Hi all, this project looks very exciting. I was trying to build it for
FreeBSD, and can only get so far. Maybe someone more familiar with with
this project and with OCamlbuild can make some suggestions?

Here are the changes I've made to the git repo, in an attempt to get
things working on FreeBSD:

------------------- patch -------------------
diff --git a/lib/myocamlbuild.ml b/lib/myocamlbuild.ml
index f5d02e8..7d92d92 100644
--- a/lib/myocamlbuild.ml
+++ b/lib/myocamlbuild.ml
@@ -84,18 +84,20 @@ end
 (* OS detection *)
 module OS = struct
 
-  type u = Linux | Darwin
+  type u = Linux | Darwin | FreeBSD
   type t = Unix of u | Xen | Node
 
   let host =
     match String.lowercase (Util.run_and_read "uname -s") with
     | "linux"  -> Unix Linux
     | "darwin" -> Unix Darwin
+    | "freebsd" -> Unix FreeBSD
     | os -> Printf.eprintf "`%s` is not a supported host OS\n" os; exit
     (-1)
 
   let unix_ext = match host with
     | Unix Linux  -> "linux"
     | Unix Darwin -> "macosx"
+    | Unix FreeBSD -> "freebsd"
     | _ -> Printf.eprintf "unix_ext called on a non-UNIX host OS\n";
     exit (-1)
 
 end
diff --git a/regress/fs/readdir.sh b/regress/fs/readdir.sh
index b3aeec5..d36be30 100755
--- a/regress/fs/readdir.sh
+++ b/regress/fs/readdir.sh
@@ -28,6 +28,17 @@ case `uname -s` in
     sudo umount tmpmount
   ;;
 
+  FreeBSD )
+    dd if=/dev/zero of=${OUTPUT} bs=1 seek=128M count=0
+    /sbin/newfs_msdos -L MirageFAT -F 16 -v ${OUTPUT}
+    rm -rf tmpmount && mkdir tmpmount
+    MD=$(sudo mdconfig ${OUTPUT}) 
+    mount /dev/$MD tmpmount
+    sudo cp -r ${INPUT} tmpmount
+    sudo umount tmpmount && rmdir tmpmount
+    sudo mdconfig -d -u $MD
+  ;;
+
   * )
     echo Unknown OS detected
     exit 1
diff --git a/scripts/mir-fat-create b/scripts/mir-fat-create
index b6acaf2..b604ef7 100755
--- a/scripts/mir-fat-create
+++ b/scripts/mir-fat-create
@@ -38,6 +38,17 @@ case `uname -s` in
     sudo umount tmpmount && rmdir tmpmount
   ;;
 
+  FreeBSD )
+    dd if=/dev/zero of=${OUTPUT} bs=1 seek=128M count=0
+    /sbin/newfs_msdos -L MirageFAT -F 16 -v ${OUTPUT}
+    rm -rf tmpmount && mkdir tmpmount
+    MD=$(sudo mdconfig ${OUTPUT}) 
+    mount /dev/$MD tmpmount
+    sudo cp -r ${INPUT}/* tmpmount
+    sudo umount tmpmount && rmdir tmpmount
+    sudo mdconfig -d -u $MD
+  ;;
+
   * )
     echo Unknown OS detected
     exit 1
diff --git a/scripts/myocamlbuild.ml b/scripts/myocamlbuild.ml
index 90b7156..63e72cb 100644
--- a/scripts/myocamlbuild.ml
+++ b/scripts/myocamlbuild.ml
@@ -56,19 +56,20 @@ end
 (** Host OS detection *)
 module OS = struct
 
-  type unix = Linux | Darwin
+  type unix = Linux | Darwin | FreeBSD
   type arch = X86_32 | X86_64
 
   let host =
     match String.lowercase (Util.run_and_read "uname -s") with
     | "linux"  -> Linux
     | "darwin" -> Darwin
+    | "freebsd" -> FreeBSD
     | os -> eprintf "`%s` is not a supported host OS\n" os; exit (-1)
 
   let arch =
     match String.lowercase (Util.run_and_read "uname -m") with
     | "x86_32" | "i686"  -> X86_32
-    | "i386" -> (match host with Linux -> X86_32 | Darwin -> X86_64)
+    | "i386" -> (match host with Linux | FreeBSD -> X86_32 | Darwin ->
X86_64)
     | "x86_64" -> X86_64
     | arch -> eprintf "`%s` is not a supported arch\n" arch; exit (-1)
 
@@ -89,8 +90,8 @@ module Mir = struct
     let unixmain mode = lib / mode / "lib" / "main.o" in
     let mode = sprintf "unix-%s" (env "%(mode)") in
     let dl_libs = match host with
-      |Linux  -> [A"-lm"; A"-lasmrun"; A"-lcamlstr"; A"-ldl"]
-      |Darwin -> [A"-lm"; A"-lasmrun"; A"-lcamlstr"] in
+      |Linux -> [A"-lm"; A"-lasmrun"; A"-lcamlstr"; A"-ldl"]
+      |Darwin |FreeBSD -> [A"-lm"; A"-lasmrun"; A"-lcamlstr"] in
     let tags = tags++"cc"++"c" in
     Cmd (S (A cc :: [ T(tags++"link"); A ocamlc_libdir; A"-o"; Px out; 
              A (unixmain mode); P arg; A (unixrun mode); ] @ dl_libs))
--------------- end patch -------------------


And I get up to this point in the build process:

/usr/local/bin/ocamlopt.opt -a std/pervasives.cmx std/array.cmx
std/char.cmx std/list.cmx std/string.cmx std/sys.cmx std/buffer.cmx
std/int32.cmx std/marshal.cmx std/obj.cmx std/printf.cmx std/base64.cmx
std/stack.cmx std/sort.cmx std/set.cmx std/queue.cmx std/printexc.cmx
std/nativeint.cmx std/map.cmx std/camlinternalLazy.cmx std/lazy.cmx
std/stream.cmx std/lexing.cmx std/int64.cmx std/hashtbl.cmx std/gc.cmx
std/digest.cmx std/complex.cmx std/callback.cmx std/weak.cmx
std/scanf.cmx std/random.cmx std/format.cmx std/parsing.cmx
std/camlinternalOO.cmx std/camlinternalMod.cmx std/std_exit.cmx
std/log.cmx std/oo.cmx std/lwt_sequence.cmx std/lwt.cmx std/lwt_util.cmx
std/lwt_mutex.cmx std/lwt_stream.cmx std/lwt_mvar.cmx std/lwt_list.cmx
std/lwt_pool.cmx std/lwt_condition.cmx std/lwt_pqueue.cmx
std/lwt_switch.cmx std/bitstring_types.cmx std/bitstring_config.cmx
std/bitstring.cmx std/bitstring_stream.cmx std/regexp.cmx std/oS.cmx
std/net.cmx std/block.cmx std/dns.cmx std/http.cmx std/utf8.cmx
std/ulexing.cmx std/utf16.cmx std/dyntype.cmx std/cow.cmx
std/openflow.cmx std/oUnit.cmx std/fs.cmx -o std/stdlib.cmxa
cc -c -Wall -g -O3 -I /usr/local/lib/ocaml -fPIC -o
os/runtime_unix/main.o os/runtime_unix/main.c
../../../tools/ocp-pack/_build/split.native std/base64.annot
../../../tools/ocp-pack/_build/split.native std/string.annot
../../../tools/ocp-pack/_build/split.native std/stack.annot
../../../tools/ocp-pack/_build/split.native std/sort.annot
../../../tools/ocp-pack/_build/split.native std/set.annot
../../../tools/ocp-pack/_build/split.native std/queue.annot
../../../tools/ocp-pack/_build/split.native std/printexc.annot
../../../tools/ocp-pack/_build/split.native std/pervasives.annot
../../../tools/ocp-pack/_build/split.native std/nativeint.annot
../../../tools/ocp-pack/_build/split.native std/marshal.annot
../../../tools/ocp-pack/_build/split.native std/map.annot
../../../tools/ocp-pack/_build/split.native std/lazy.annot
../../../tools/ocp-pack/_build/split.native std/stream.annot
../../../tools/ocp-pack/_build/split.native std/list.annot
../../../tools/ocp-pack/_build/split.native std/lexing.annot
../../../tools/ocp-pack/_build/split.native std/int64.annot
../../../tools/ocp-pack/_build/split.native std/int32.annot
../../../tools/ocp-pack/_build/split.native std/hashtbl.annot
../../../tools/ocp-pack/_build/split.native std/gc.annot
../../../tools/ocp-pack/_build/split.native std/digest.annot
../../../tools/ocp-pack/_build/split.native std/complex.annot
../../../tools/ocp-pack/_build/split.native std/char.annot
../../../tools/ocp-pack/_build/split.native std/camlinternalLazy.annot
../../../tools/ocp-pack/_build/split.native std/callback.annot
../../../tools/ocp-pack/_build/split.native std/buffer.annot
../../../tools/ocp-pack/_build/split.native std/array.annot
../../../tools/ocp-pack/_build/split.native std/weak.annot
../../../tools/ocp-pack/_build/split.native std/sys.annot
../../../tools/ocp-pack/_build/split.native std/scanf.annot
../../../tools/ocp-pack/_build/split.native std/random.annot
../../../tools/ocp-pack/_build/split.native std/obj.annot
../../../tools/ocp-pack/_build/split.native std/format.annot
../../../tools/ocp-pack/_build/split.native std/printf.annot
../../../tools/ocp-pack/_build/split.native std/parsing.annot
../../../tools/ocp-pack/_build/split.native std/camlinternalOO.annot
../../../tools/ocp-pack/_build/split.native std/camlinternalMod.annot
../../../tools/ocp-pack/_build/split.native std/std_exit.annot
../../../tools/ocp-pack/_build/split.native std/log.annot
../../../tools/ocp-pack/_build/split.native std/oo.annot
../../../tools/ocp-pack/_build/split.native std/lwt.annot
../../../tools/ocp-pack/_build/split.native std/lwt_util.annot
../../../tools/ocp-pack/_build/split.native std/lwt_stream.annot
../../../tools/ocp-pack/_build/split.native std/lwt_sequence.annot
../../../tools/ocp-pack/_build/split.native std/lwt_mvar.annot
../../../tools/ocp-pack/_build/split.native std/lwt_mutex.annot
../../../tools/ocp-pack/_build/split.native std/lwt_list.annot
../../../tools/ocp-pack/_build/split.native std/lwt_pool.annot
../../../tools/ocp-pack/_build/split.native std/lwt_condition.annot
../../../tools/ocp-pack/_build/split.native std/lwt_pqueue.annot
../../../tools/ocp-pack/_build/split.native std/lwt_switch.annot
../../../tools/ocp-pack/_build/split.native std/bitstring.annot
../../../tools/ocp-pack/_build/split.native std/bitstring_types.annot
../../../tools/ocp-pack/_build/split.native std/bitstring_config.annot
../../../tools/ocp-pack/_build/split.native std/bitstring_stream.annot
../../../tools/ocp-pack/_build/split.native std/regexp.annot
../../../tools/ocp-pack/_build/split.native std/oS.annot
../../../tools/ocp-pack/_build/split.native std/net.annot
../../../tools/ocp-pack/_build/split.native std/block.annot
../../../tools/ocp-pack/_build/split.native std/dns.annot
../../../tools/ocp-pack/_build/split.native std/http.annot
../../../tools/ocp-pack/_build/split.native std/utf8.annot
../../../tools/ocp-pack/_build/split.native std/utf16.annot
../../../tools/ocp-pack/_build/split.native std/ulexing.annot
../../../tools/ocp-pack/_build/split.native std/dyntype.annot
../../../tools/ocp-pack/_build/split.native std/cow.annot
../../../tools/ocp-pack/_build/split.native std/openflow.annot
../../../tools/ocp-pack/_build/split.native std/oUnit.annot
../../../tools/ocp-pack/_build/split.native std/fs.annot
Solver failed:
  Ocamlbuild knows of no rules that apply to a target named
  std/unix.itarget. This can happen if you ask Ocamlbuild to build a
  target with the wrong extension (e.g. .opt instead of .native) or if
  the source files live in directories that have not been specified as
  include directories.
Backtrace:
  - Failed to build the target unix.otarget
      - Failed to build all of these:
          - Building std/unix.otarget:
              - Building std/unix.itarget
          - Building unix.otarget:
              - Building os/runtime_unix/libunixrun.a:
                  - Failed to build all of these:
                      - Building os/runtime_unix/libunixrun.cmx:
                          - Failed to build all of these:
                              - Building os/runtime_unix/libunixrun.ml:
                                  - Failed to build all of these:
                                      - Building
                                      os/runtime_unix/libunixrun.mly
                                      - Building
                                      os/runtime_unix/libunixrun.mll
                                      - Building
                                      os/runtime_unix/libunixrun.smlpack
                              - Building
                              os/runtime_unix/libunixrun.mlpack
                      - Building os/runtime_unix/libunixrun.mllib
                      - Failed to build all of these:
                          - Building std/tap_stubs_os.o:
                              - Failed to build all of these:
                                  - Building std/tap_stubs_os.c:
                                      - Building std/tap_stubs_freebsd.c
                                  - Building std/tap_stubs_os.ml:
                                      - Failed to build all of these:
                                          - Building
                                          std/tap_stubs_os.mly
                                          - Building
                                          std/tap_stubs_os.mll
                                          - Building
                                          std/tap_stubs_os.smlpack
                                  - Building std/tap_stubs_os.mlpack
                                  - Building std/tap_stubs_os.S
                                  - Building std/tap_stubs_os.c:
                                      - Building std/tap_stubs_freebsd.c
                          - Building tap_stubs_os.o:
                              - Failed to build all of these:
                                  - Building tap_stubs_os.c:
                                      - Building tap_stubs_freebsd.c
                                  - Building tap_stubs_os.ml:
                                      - Failed to build all of these:
                                          - Building tap_stubs_os.mly
                                          - Building tap_stubs_os.mll
                                          - Building
                                          tap_stubs_os.smlpack
                                  - Building tap_stubs_os.mlpack
                                  - Building tap_stubs_os.S
                                  - Building tap_stubs_os.c:
                                      - Building tap_stubs_freebsd.c
                          - Building os/runtime_unix/tap_stubs_os.o:
                              - Failed to build all of these:
                                  - Building
                                  os/runtime_unix/tap_stubs_os.c:
                                      - Building
                                      os/runtime_unix/tap_stubs_freebsd.c
                                  - Building
                                  os/runtime_unix/tap_stubs_os.ml:
                                      - Failed to build all of these:
                                          - Building
                                          os/runtime_unix/tap_stubs_os.mly
                                          - Building
                                          os/runtime_unix/tap_stubs_os.mll
                                          - Building
                                          os/runtime_unix/tap_stubs_os.smlpack
                                  - Building
                                  os/runtime_unix/tap_stubs_os.mlpack
                                  - Building
                                  os/runtime_unix/tap_stubs_os.S
                                  - Building
                                  os/runtime_unix/tap_stubs_os.c:
                                      - Building
                                      os/runtime_unix/tap_stubs_freebsd.c
                      - Building os/runtime_unix/libunixrun.cclib
gmake[1]: *** [unix-direct] Error 6
gmake[1]: Leaving directory `.../mirage/git.build/lib'
gmake: *** [all] Error 2


-- 
Jim Pryor
jim@xxxxxxxxxxxx




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.