Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: Kate Deplaix <kit-ty-kate@outlook.com>
To: "caml-list@inria.fr" <caml-list@inria.fr>,
	Andreas Rossberg <rossberg@mpi-sws.org>
Subject: Re: [Caml-list] Static linking with Mingw and dune
Date: Sun, 1 Dec 2024 17:27:55 +0000	[thread overview]
Message-ID: <CWLP265MB415788DB633E5044F294FB8EBC342@CWLP265MB4157.GBRP265.PROD.OUTLOOK.COM> (raw)
In-Reply-To: <D5CAD9C8-4AD2-44FA-87FF-A04B03E04ACB@mpi-sws.org>

[-- Attachment #1: Type: text/plain, Size: 1681 bytes --]

I can't answer to all your questions at this moment but this commit might be of interest for you: https://github.com/ocaml/opam/commit/f0157ed232ff1100aa049c922b9bdc857ac21998 (see the CLINKING_windows definition which static links everything but the windows APIs)

This works with 4.14 but i haven't tried with 5.3 yet so your milage may vary.

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.

Cheers,
Kate
________________________________
From: caml-list-request@inria.fr <caml-list-request@inria.fr> on behalf of Andreas Rossberg <rossberg@mpi-sws.org>
Sent: 01 December 2024 17:02
To: caml-list@inria.fr <caml-list@inria.fr>
Subject: [Caml-list] Static linking with Mingw and dune

I’m banging my head against a very basic problem, namely creating a simple standalone executable on Windows with OCaml 5.2. So here are my, possibly stupid, questions:

- With OCaml 5 on Mingw64, how can I statically link libwinpthreads into an executable (using dune)?

- Some answers I found from a couple of years ago suggested using `-static`, but dune is (nowadays?) running through flexdll for linking, which doesn’t understand that. Is there a substitute?

- Some other answers/discussions mentioned the new `-l:` option being preferable, but I couldn’t find a working example, and all my feeble attempts to use it with dune were unsuccessful.

- What exactly is the difference between dune's `link_flags` and `ocamlopt_flags`, and why do some online answers use the latter for setting linking-related options?

Any help is appreciated.

Thanks,
/Andreas


[-- Attachment #2: Type: text/html, Size: 2714 bytes --]

  reply	other threads:[~2024-12-01 17:28 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 [this message]
2024-12-02  8:25   ` Antonin Décimo
2024-12-12  7:44     ` Andreas Rossberg
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=CWLP265MB415788DB633E5044F294FB8EBC342@CWLP265MB4157.GBRP265.PROD.OUTLOOK.COM \
    --to=kit-ty-kate@outlook.com \
    --cc=caml-list@inria.fr \
    --cc=rossberg@mpi-sws.org \
    /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