DEV Community


Pesy With Luv, the Esy/Pesy Build

idkjs profile image Alain ・2 min read

In the previous post we built the project using dune only. Check it out here.

To recap, I am trying to use the aantron/luv library to try to build something and I ran into all kinds of build system issues mostly because I still haven't grokked the reason-native build system yet. That's ok. This note is my way of getting better and having a reference I understand when I need to come back to it and giving back to the generous community. The reason-native build environment has a list of great tools you can use. Most prominent among them are Dune, Esy/Pesy and Spin. Here we are using Pesy.

Getting Started

First make sure you have esy and pesy installed and updated.

npm i -g esy
npm i -g pesy

Then create a directory, cd into it, then run pesy and follow the prompts.

mkdir pesy-with-luv && cd pesy-with-luv

Contains the following libraries and executables:

│   name:    TestPesyWithLuv.exe
│   main:    TestPesyWithLuv
│   require: pesy-with-luv.lib
│   library name: pesy-with-luv.lib
│   namespace:    PesyWithLuv
│   require:
    name:    PesyWithLuvApp.exe
    main:    PesyWithLuvApp
    require: pesy-with-luv.lib

Build The Project:

esy install
esy build

Running It:

After building the project, you can run the main binary that is produced.

esy x PesyWithLuvApp.exe

Adding the Luv library

Let's install luv.

Run esy add @opam/luv

Then go to package.json and add "require": ["luv"] to the library key.

    "library": {
      "name": "pesy-with-luv.lib",
      "namespace": "PesyWithLuv",
     add this-> "require": [

Run esy pesy to rebuild.

Note that your dune file in library/dune has changed to reflect the added luv library.

This is great if you not comfortable with dune files yet.

Now you can call PesyWithLuv.Demo.luv(); in executable/;

Run esy x PesyWithLuvApp.exe then watch the output.

Running Binary:

After building the project, you can run the main binary that is produced.

esy x PesyWithLuvApp.exe
❯ esy x PesyWithLuvApp.exe


  Build Succeeded! To test a binary:

      esy x PesyWithLuvApp.exe



Not bad at all. Need a more robust build and a built in pipeline for sharing your project, Pesy is a good choice. Source can be found here

Next we will try with Spin.


Editor guide