From: Andreas Rossberg <rossberg@mpi-sws.org>
To: "Antonin Décimo" <antonin.decimo@gmail.com>
Cc: Kate Deplaix <kit-ty-kate@outlook.com>,
"caml-list@inria.fr" <caml-list@inria.fr>
Subject: Re: [Caml-list] Static linking with Mingw and dune
Date: Thu, 12 Dec 2024 08:44:44 +0100 [thread overview]
Message-ID: <FD2626D6-366B-4C5C-A771-1212436346CF@mpi-sws.org> (raw)
In-Reply-To: <CAC=54B+DN2RKYMfM=R9YrpTkZZ=6i4K40WAp=HcLpZNT3+9V6Q@mail.gmail.com>
Good to know, thank you for the suggestions!
However, I’m afraid that hacking the compiler and tool chain for this purpose is not an option — that would require everybody else who wants to build the project to do the same, which is infeasible.
It’s a bit disappointing that there seems to be no easy solution for this problem. I would expect it to be a common pain point for folks using OCaml 5 to develop and publish application binaries for Windows. Or am I just alien?
Cheers,
/Andreas
> On 2. Dec 2024, at 09:25, Antonin Décimo <antonin.decimo@gmail.com> wrote:
>
>> Regarding OCaml 5.3/mingw64 you shouldn't need to have to do anything with libwinpthreads because it's only used for the msvc port, not the mingw one.
>
> That is not quite exact, winpthreads is used with mingw-w64, but found
> in the system installation, and linked to. It is vendored for the MSVC
> port and we *statically* link into the runtime only the parts we're
> interested in.
>
> To statically link with winpthreads, I suggest you do all of it manually:
> - clone winpthreads sources at https://github.com/mingw-w64/mingw-w64,
> go to mingw-w64-libraries/winpthreads, and build a static version of
> the library with your preferred toolchain;
>
> - hack the OCaml compiler / Makefile to *not* use `-lpthreads`:
> https://github.com/ocaml/ocaml/blob/5a5eb481c7a9d0f039e3169aa8ed19c9b926e982/configure.ac#L2372-L2373
> Maybe it's just sufficient to set PTHREAD_LIBS when invoking
> configure; however seeing this line makes me think that winpthreads is
> already statically linked with the runtime.
>
> PTHREAD_LIBS="-l:libpthread.a $link_gcc_eh"]
>
> Haven't dug further.
>
> -- Antonin
next prev parent reply other threads:[~2024-12-12 7:46 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-01 17:02 Andreas Rossberg
2024-12-01 17:27 ` Kate Deplaix
2024-12-02 8:25 ` Antonin Décimo
2024-12-12 7:44 ` Andreas Rossberg [this message]
2024-12-12 17:31 ` Xavier Leroy
[not found] <EEEA5F26-2982-429E-A4B8-05E3776ED532@mpi-sws.org>
2024-12-13 14:42 ` Andreas Rossberg
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=FD2626D6-366B-4C5C-A771-1212436346CF@mpi-sws.org \
--to=rossberg@mpi-sws.org \
--cc=antonin.decimo@gmail.com \
--cc=caml-list@inria.fr \
--cc=kit-ty-kate@outlook.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox