You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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 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?
The text was updated successfully, but these errors were encountered:
Static linking of libraries is becoming a challenge, not just for Zarith, not just for OCaml programs in general, but even for programs written entirely in C or C++... Right now I have no better suggestion to offer than those on the OCamlPro blog.
On 5 Sep 2022, at 10:30, Xavier Leroy ***@***.***> wrote:
Static linking of libraries is becoming a challenge, not just for Zarith, not just for OCaml programs in general, but even for programs written entirely in C or C++... Right now I have no better suggestion to offer than those on the OCamlPro blog.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you authored the thread.
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?
The text was updated successfully, but these errors were encountered: