开发者

OCaml batteries included can't be built on Mac OS X 10.6.6

I tried to build OCaml batteries included 1.3.0 on my Mac OS X 10.6.6 (MacBook Air3,2) but couldn't. OCaml itself and denpending libraries versions are as follows:

  • OCaml : 3.11.2
  • findlib : 1.2.6
  • OUnit : 1.1.0
  • camomile : 0.8.1
  • make : 3.81

I'm not using GODI for installation. Are there anyone who runs OCaml batteries included on you Mac and if there are, can you let me know your libraries versions? Further more, could you find any solution for fixing this error?

% make all
cp -f src/batCamomile-0.8.1.ml src/batCamomile.ml
test ! -e src/batter开发者_开发技巧ies_config.ml || rm src/batteries_config.ml
ocamlbuild syntax.otarget byte.otarget src/batteries_help.cmo META shared.otarget
Finished, 0 targets (0 cached) in 00:00:00.
+ ocamlfind ocamlopt -shared -linkall -package camomile,num,str -o src/batteries_uni.cmxs src/batteries_uni.cmxa
ld: warning: -read_only_relocs cannot be used with x86_64
ld: codegen problem, can't use rel32 to external symbol _caml_negf_mask in .L101 from src/batteries_uni.a(batFloat.o)
collect2: ld returned 1 exit status
File "caml_startup", line 1, characters 0-1:
Error: Error during linking
Command exited with code 2.
Compilation unsuccessful after building 479 targets (478 cached) in 00:00:01.
make: *** [all] Error 10

Thanks, Yoshi a.k.a. ymotongpoo


On Mac OS, you must disable native shared library building. Use the BATTERIES_NATIVE_SHLIB=no argument to Make to accomplish this:

$ make all install BATTERIES_NATIVE_SHLIB=no

The GODI package sets this parameter by default on Mac, but you must set it manually when building from source yourself. You need to set this parameter on every invocation of make (or set it as an environment variable).

Finally, I highly recommending using GODI. It makes managing an OCaml installation far easier than doing it by hand.


I reported to bug tracker and the cause of make test qtest failure is -n option of echo command. https://github.com/ocaml-batteries-team/batteries-included/issues#issue/122

At first in OS X, option BATTERIES_NATIVE_SHLIB=false has to be set. And still, you need to modify Makefile to run test successfully. Latest version in the repository has been fixed but if you want to build 1.3.0 tarball, modify Makefile as follows:

#put all the testing modules in a library
qtest/test_mods.mllib: $(TESTABLE)
-  echo -n "Quickcheck Tests \c" > $@
+  echo "Quickcheck Tests \c" > $@
   echo $(patsubst src/%.ml,%_t, $(TESTABLE)) >> $@

or, you can use /bin/echo

#put all the testing modules in a library
qtest/test_mods.mllib: $(TESTABLE)
-  echo -n "Quickcheck Tests \c" > $@
+  /bin/echo -n "Quickcheck Tests \c" > $@
   echo $(patsubst src/%.ml,%_t, $(TESTABLE)) >> $@

Both way work.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜