-
Notifications
You must be signed in to change notification settings - Fork 78
Description
I have a project (github mdxtoc/qtpi) which uses zarith. Many thanks for zarith, by the way. I distribute my program to not very many users on macOS, Windows and Linux. But some of these not very many complain, because along with my program they have to load libgmp, and they don't see themselves as system administrators. Hoping to make their lives easier I thought I'd static link libgmp into my program.
But that's not easy. On macOS at least it's really quite difficult: you can't use the -static flag when loading, and the -lgmp flag isn't issued by me but as a side effect of loading the zarith package. So I can't see how to insert -l/libgmp.a, which was my first idea.
I came across this very useful website
https://ocamlpro.com/blog/2021_09_02_generating_static_and_portable_executables_with_ocaml
which tells me to find out all the flags used when loading, and copy them, changing the -lgmp one. That might well work, but I'd rather not if there's a simpler way, because of the maintenance problems it would introduce.
I thought of temporarily renaming the dynamic library so that -lgmp could only see the static version, but I'm scared to try that. I can't make a directory containing only the static library, because zarith also issues the -L flag which points to the libgmp directory.
So that's two bad ideas (three, if you count -static). Is there a better idea?