2011-02-24 56 views
1

我试图在Mac OS X 10.6.6(MacBook Air3,2)上构建包含1.3.0的OCaml电池,但无法使用。 OCaml的本身和denpending库版本如下:包含的OCaml电池不能在Mac OS X 10.6.6上构建

  • OCaml的:3.11.2
  • findlib:1.2.6
  • OUnit:1.1.0
  • 甘菊:0.8.1
  • 化妆:3.81

我没有使用GODI进行安装。有没有人在你的Mac上运行OCaml电池,如果有,你能让我知道你的图书馆版本吗?此外,你能找到解决这个错误的解决方案吗?

% make all 
cp -f src/batCamomile-0.8.1.ml src/batCamomile.ml 
test ! -e src/batteries_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 

感谢, 耀西又名ymotongpoo

+1

我用OCaml 3.12.1 + dev5构建了电池1.3.0。我从来没有见过像你这样的错误。这个线程可能是相关的:http://comments.gmane.org/gmane.comp.lang.ocaml.godi/462 – 2011-02-24 12:40:56

+0

有人认为这是GCC中的一个错误。获取最新的XCode。我使用gcc 4.2.1构建它。见http://www.ogre3d.org/forums/viewtopic.php?f=4&t=24612#p371950 – 2011-02-24 12:44:38

+0

嗨米塔斯!当然,我已经检查了链接。我把'BATTERIES_NATIVE_SHLIB = false'变成了''make all''成功的可能,但'make test qtest'失败并且创建了'test_mods.ml'等等。而且我的GCC版本是最新的XCode的,gcc 4.2.1。 – ymotongpoo

回答

1

在Mac OS上,您必须禁用本地共享库的建设。使用BATTERIES_NATIVE_SHLIB=no参数请做到这一点:

$ make all install BATTERIES_NATIVE_SHLIB=no 

的GODI包设置此参数默认情况下在Mac上,而是从源头自行构建时,必须手动设置。 您需要在每次调用make(或将其设置为环境变量)时设置此参数。

最后,我强烈推荐使用GODI。它使得管理OCaml安装比手动管理容易得多。

+0

是的,它实际上用于'make all'和'make install'。但正如我上面评论的那样,“make test qtest”不适用于该选项。如果测试无所谓,那么我就忽略它们。您是否尝试过使用该选项“make test qtest”? – ymotongpoo

+0

@ymotongpoo不 - 我没有Mac(据我所知,其他核心开发人员也没有),所以Mac修复完全基于用户的报告。不过,听起来像'test'和'qtest'选项正在绕过native-shlib禁用逻辑。你可以在[GitHub bug跟踪器](https://github.com/ocaml-batteries-team/batteries-included/issues)中提交错误吗? –

+0

啊,好吧,我明白了。在我的Debian环境中,我可以构建包含1.3.0的OCaml电池。然后,我将这个bug注册到bug跟踪器中。谢谢! – ymotongpoo

1

我向bug追踪器报告,make test qtest失败的原因是-n选项的echo命令。 https://github.com/ocaml-batteries-team/batteries-included/issues#issue/122

首先在OS X中,必须设置选项BATTERIES_NATIVE_SHLIB=false。而且,您仍然需要修改Makefile才能成功运行测试。在仓库中 最新版本已得到修复,但如果你想建立1.3.0压缩包,修改Makefile文件如下:

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

,或者您可以使用/bin/echo

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

两种工作方式。