我运行了opam install ocamlbuild
命令,似乎我遇到了ocamlopt
以下是opam
告诉我的内容:(我猜它只是不喜欢我的4.04版本)
### stdout ###
# [...]
# mkdir -p tmp
# ocamlopt.opt -pack src/const.cmx src/loc.cmx src/discard_printf.cmx src/signatures.cmi src/my_std.cmx src/my_unix.cmx src/tags.cmx src/display.cmx src/log.cmx src/shell.cmx src/bool.cmx src/glob_ast.cmx src/glob_lexer.cmx src/glob.cmx src/lexers.cmx src/param_tags.cmx src/command.cmx src/ocamlbuild_config.cmx src/ocamlbuild_where.cmx src/slurp.cmx src/options.cmx src/pathname.cmx src/configuration.cmx src/flags.cmx src/hygiene.cmx src/digest_cache.cmx src/resource.cmx src/rule.cmx src/solver.cmx src/report.cmx src/tools.cmx src/fda.cmx src/findlib.cmx src/ocaml_arch.cmx src/ocaml_utils.cmx src/ocaml_dependencies.cmx src/ocaml_compiler.cmx src/ocaml_tools.cmx src/ocaml_specific.cmx src/exit_codes.cmx src/plugin.cmx src/hooks.cmx src/main.cmx -o tmp/ocamlbuild_pack.cmx
# mv tmp/ocamlbuild_pack.cmx src/ocamlbuild_pack.cmx
# mv tmp/ocamlbuild_pack.o src/ocamlbuild_pack.o
# ocamlopt.opt -for-pack Ocamlbuild_pack -w L -w R -w Z -I src -I +unix -safe-string -bin-annot -c src/ocamlbuild_plugin.ml
# ocamlopt.opt -for-pack Ocamlbuild_pack -w L -w R -w Z -I src -I +unix -safe-string -bin-annot -c src/ocamlbuild_executor.ml
# ocamlopt.opt -for-pack Ocamlbuild_pack -w L -w R -w Z -I src -I +unix -safe-string -bin-annot -c src/ocamlbuild_unix_plugin.ml
# ocamlopt.opt -for-pack Ocamlbuild_pack -w L -w R -w Z -I src -I +unix -safe-string -bin-annot -c src/ocamlbuild.ml
# ocamlopt.opt -I +unix -I src -o ocamlbuild.native unix.cmxa src/ocamlbuild_pack.cmx src/ocamlbuild_plugin.cmx src/ocamlbuild_executor.cmx src/ocamlbuild_unix_plugin.cmx src/ocamlbuild.cmx
# Makefile:131: recipe for target 'ocamlbuild.native' failed
### stderr ###
# [...]
# /usr/bin/ld: /home/oleg/.opam/4.04.0/lib/ocaml/libasmrun.a(finalise.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
# /usr/bin/ld: /home/oleg/.opam/4.04.0/lib/ocaml/libasmrun.a(custom.o): relocation R_X86_64_32 against symbol `caml_custom_table' can not be used when making a shared object; recompile with -fPIC
# /usr/bin/ld: /home/oleg/.opam/4.04.0/lib/ocaml/libasmrun.a(unix.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
# /usr/bin/ld: /home/oleg/.opam/4.04.0/lib/ocaml/libasmrun.a(backtrace.o): relocation R_X86_64_32 against symbol `caml_backtrace_last_exn' can not be used when making a shared object; recompile with -fPIC
# /usr/bin/ld: /home/oleg/.opam/4.04.0/lib/ocaml/libasmrun.a(startup.o): relocation R_X86_64_32S against symbol `caml_data_segments' can not be used when making a shared object; recompile with -fPIC
# /usr/bin/ld: final link failed: Nonrepresentable section on output
# collect2: error: ld returned 1 exit status
# File "caml_startup", line 1:
# Error: Error during linking
# make: *** [ocamlbuild.native] Error 2
谢谢。
答案 0 :(得分:2)
您可以尝试重新安装当前开关,看起来是4.04.0
,从输出中判断。
运行opam switch reinstall 4.04.0
应该重新编译ocamlopt.opt
二进制文件。