bobot / ocaml-flint

GNU Lesser General Public License v2.1
5 stars 3 forks source link

Fix build on archlinux #6

Closed Gbury closed 1 year ago

Gbury commented 1 year ago

As I found out today, the actual libname for arb on archlinux is different from other distributions: while on most distributions, it seems to be flint-arb (and thus the c flag used is -lflint-arb), on archlinux the arb package install the library with the name arb (and thus a corresponding -larb flag)[1]

This PR tries and fix that problem, by introducing a script to determine which c flag to use. Admittedly, the solution is this PR is not that satisfying/elegant (basically, it uses the dune configurator to try both flags and pick the one that works), but it's the only solution I found.

Most notably, using pkg-config (and its associated bindings in dune configurator) would not work from what I tried, because the archlinux package does not install the arb.pc file that is required for pkg-config to work. That being said, Debian also does not include those files, so using pkg-config seem out of the question, at least for now. For the future, it seems like the flint package upstream now distributes pkg-config files (see https://github.com/flintlib/flint/pull/1299 ), but arb does not yet (see https://github.com/fredrik-johansson/arb/issues/272 ). Even then, the addition of pkg-config files in flint happens in march of this year (2023), and it seems like distrib packages predate that change.

[1]: As it happens, it seems that in this case, Archlinux is "more correct" in the sense that it uses the upstream names, whereas debian (and the other distros) have renamed arb into flint-arb to disambiguate from an unrelated project also named arb.

Note: I also plan on submitting a PR on the opam-repository to add the correct depexts to the conf-* packages for Archlinux (which can all be satisfied now that I published a calcium package on the AUR : https://aur.archlinux.org/packages/calcium ). However, it's probably better if that happens after this PR has been merged, and a new release of arb and calcium are released on opam.

bobot commented 1 year ago

Thank you a lot for this work. The absence of pkg-config in all of these packages is really a pity. Your solution is the best with what we have currently.