Linking problem with the opam `mlpost` package
Opened this issue · 5 comments
I have just installed mlpost
using opam
(ocaml version: 4.04.2) and attempted to compile the following trivial program using ocamlbuild
:
open Mlpost
open Command
open Box
let fig = draw (rect (tex "F"))
let () =
Metapost.emit "fig" fig ;
Metapost.dump ~pdf:true "tmp"
I got the following linking error:
ocamlbuild -use-ocamlfind main.native
+ ocamlfind ocamlopt -linkpkg -package mlpost main.cmx -o main.native
Undefined symbols for architecture x86_64:
"_ml_FT_Get_Char_Index", referenced from:
_camlMlpost__Fonts__fun_2589 in mlpost.a(mlpost.o)
_camlMlpost__Fonts__fun_2583 in mlpost.a(mlpost.o)
_camlMlpost__Mlpost_ft__3 in mlpost.a(mlpost.o)
"_ml_FT_Get_Name_Index", referenced from:
_camlMlpost__Fonts__compute_trans_enc_1967 in mlpost.a(mlpost.o)
_camlMlpost__Mlpost_ft__3 in mlpost.a(mlpost.o)
"_ml_FT_num_charmaps", referenced from:
_camlMlpost__Mlpost_ft__ft_set_charmap_1220 in mlpost.a(mlpost.o)
_camlMlpost__Mlpost_ft__3 in mlpost.a(mlpost.o)
"_ml_FT_set_charmap", referenced from:
_camlMlpost__Mlpost_ft__ft_set_charmap_1220 in mlpost.a(mlpost.o)
_camlMlpost__Mlpost_ft__3 in mlpost.a(mlpost.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
File "caml_startup", line 1:
Error: Error during linking
Command exited with code 2.
Besides, if I run the mlpost
command line program on my source file, I get this other linking error:
File "main.ml", line 1:
Error: Error on dynamically loaded library: /Users/jlauren1/.opam/latest/lib/stublibs/dllmlpost_ft.so: dlopen(/Users/jlauren1/.opam/late
st/lib/stublibs/dllmlpost_ft.so, 138): Symbol not found: _caml_curry2
Referenced from: /Users/jlauren1/.opam/latest/lib/stublibs/dllmlpost_ft.so
Expected in: flat namespace
in /Users/jlauren1/.opam/latest/lib/stublibs/dllmlpost_ft.so
I am a Mac user if this helps.
I have the same issue with OCaml 4.04.0+fp on a Debian unstable, trying to install melt either with opam or by hand. The particular missing function in my case is ml_FT_num_charmaps
, and it definitely seems to be a C function which is part of the MLpost distribution...
There is something wrong with the MLpost opam package it seems. If I compile and install it by hand, using the very same commands that are written in the opam script, the dllmlpost_ft.so
library does contain the missing function ml_FT_num_charmaps
. If I install it through opam, there are a few symbols that are marked as unavailable, according to nm
(U
), while they were T
with hand installation.
Something very strange is going on... The only difference I can see between both cases is the path where the commands are performed.
I have had the same problem installing melt, with 4.04.0, on Ubuntu 16.04. I tried compiling and installing mlpost manually as described by @ppedrot. First of all, I downloaded the source from the link given in OPAM:
http://mlpost.lri.fr/download/mlpost-0.8.2.tar.gz
But I still encountered the linking error when trying to install melt.
Then I downloaded the source from @backtracking's github:
https://github.com/backtracking/mlpost/releases/tag/0.8.2
and after compiling and installing from this source, my install of melt succeeded.
One difference I can see between the two source trees is that the latter contains the .c files
backend/ml_mlpost_ft.c
backend/libmlpost_ft.clib
while the former does not.
Could this be the source of the problem?
@reubenrowe I'd bet it is, because these are precisely the files that define the missing symbols!