ocamlgraph icon indicating copy to clipboard operation
ocamlgraph copied to clipboard

Does not compile with -static

Open Chris00 opened this issue 7 years ago • 3 comments

When compiling ocamlgraph with switch 4.07.1+musl+static+flambda, I get

#=== ERROR while compiling ocamlgraph.1.8.8 ===================================#
# context     2.0.0 | linux/x86_64 | ocaml-variants.4.07.1+musl+static+flambda | https://opam.ocaml.org/#892303df
# path        ~/.opam/4.07.1+musl+static+flambda/.opam-switch/build/ocamlgraph.1.8.8
# command     /usr/bin/make
# exit-code   2
# env-file    ~/.opam/log/ocamlgraph-27696-8b47d2.env
# output-file ~/.opam/log/ocamlgraph-27696-8b47d2.out
### output ###
# [...]
# ocamlopt.opt -c -I src -I lib -for-pack Graph src/merge.ml
# ocamlopt.opt -c -I src -I lib -for-pack Graph src/mincut.ml
# ocamlopt.opt -c -I src -I lib -for-pack Graph src/clique.ml
# ocamlopt.opt -c -I src -I lib -for-pack Graph src/weakTopological.ml
# ocamlopt.opt -c -I src -I lib -for-pack Graph src/chaoticIteration.ml
# ocamlopt.opt -I src -I lib -pack -o graph.cmx src/sig.cmi src/sig_pack.cmi src/dot_ast.cmi lib/unionfind.cmx lib/heap.cmx lib/bitv.cmx lib/persistentQueue.cmx src/version.cmx src/util.cmx src/blocks.cmx src/persistent.cmx src/imperative.cmx src/delaunay.cmx src/builder.cmx src/classic.cmx src/rand.cmx src/oper.cmx src/components.cmx src/path.cmx src/nonnegative.cmx src/traverse.cmx src/colori[...]
# ocamlopt.opt -I src -I lib -a -o graph.cmxa graph.cmx
# ocamlopt.opt -I src -I lib -shared -o graph.cmxs graph.cmx
# sh: 1: shared-libs-not-available: not found
# File "caml_startup", line 1:
# Error: Error during linking
# make: *** [Makefile:104: graph.cmxs] Error 2

Switching to Dune will fix the problem automatically. :-)

Chris00 avatar Nov 04 '18 11:11 Chris00

We strive to keep OCamlGraph compatible with as many versions of OCaml as possible (currently 3.10.2), so a switch to Dune will happen only if we do not "lose" too many versions by doing so. Do you know if Dune imposes some requirements?

yakobowski avatar Nov 05 '18 16:11 yakobowski

Yes, Dune requires OCaml ≥ 4.02. If you want to maintain compatibility with very old versions of OCaml, you need to detect whether shared libraries are supported by the compiler.

Chris00 avatar Nov 06 '18 00:11 Chris00

Is there any known fix for this in the meantime? I'm trying to build ocamlPackages in nixpkgs statically, and this is one of the blockers.

balsoft avatar Nov 15 '19 13:11 balsoft