Screenshot from Wild and Horned Hermit

mirror:world 「鏡:世界」

これは私の個人的な日記です

キャンセルされることはあるかもしれないが、黙ることは決してない

If you are reading this diary through a smartphone, do remember that you cannot have choice on those devices, because no matter how much Free Software you use on them, Google (or Apple) still prevail over what you do.

See stopsmaho.076.moe for more information.

Title:
OCaml static linking
Authors:
Izuru Yakumo
Date:
Topics:
Programming
Id:
bb85caff-be39-47b0-9add-42fae180c796

Since quite a while ago (a month or so I guess), I had read a blog post by OCamlPro about generating static PIE with OCaml.

The first project on where I have tried doing was Logarion, and afterwards bumpmap-tool, each using a different build system.

In the first case, I had to add the field `'(flags (:standard -cclib -static))'` to the `cli/dune` file and rebuilt with `dune build`.

As for the second case, I added `-cclib -static` to the `ocamlopt` flags in the command line and rebuilt.

I ran the ldd command in both (test was done on Alpine Linux, a musl-based distro) only to have this output: - /lib/ld-musl-x86_64.so.1: (insert executable name here): Not a valid dynamic program

Which means that it does actually work, but I'm not sure whether it could work for bigger projects.

I think that's all I've got to say here.

1: <https://www.ocamlpro.com/2021/09/02/generating-static-and-portable-executables-with-ocaml/> 2: <https://logarion.chaotic.ninja> 3: <https://git.chaotic.ninja/yakumo.izuru/bumpmap-tool>



© 2020-present Izuru Yakumo

Generated with 小鈴 (Kosuzu, formerly Logarion)

Follow: Atom feedめいすきー

☰ ☱ ☲ ☳ ☴ ☵ ☶ ☷

Powered by stress