I am trying to adapt pg_query
to Windows (MinGW, opam.2.2.0~beta1). With some help, I have a version of pg_query
which compiles and installs. (The help come from Introducing pg_query for Postgres 16 - Parsing SQL/JSON, Windows support, PL/pgSQL parse mode & more)
However, I have the following results with utop
:
utop # #require "pg_query";;
Cannot load required shared library dllctypes-foreign_stubs.
Reason: C:\Users\frede\AppData\Local\opam\default\lib/stublibs\dllctypes-foreign_stubs.dll: Le module spécifié est introuvable.
(The specified module can’t be found).
The error seems weird since I do have a C:\Users\frede\AppData\Local\opam\default\lib/stublibs\dllctypes-foreign_stubs.dll
file.
From the library from Introducing pg_query for Postgres 16 - Parsing SQL/JSON, Windows support, PL/pgSQL parse mode & more, I do manage to run one of the example (but need to add /usr/x86_64-w64-mingw32/sys-root/mingw/bin
to my PATH because of libwinpthread-1.dll
).
The package install a pg_check
command which can’t be executed because of a missing ffi-7.dll
. I guess this DLL is the culprit. It is not installed on my system.
pg_check
is compiled with the following dune
file:
(executable
(name pg_check)
(public_name pg_check)
(libraries ctypes ctypes.foreign cmdliner pg_query))
Where Ctypes/Foreign interface can be found.
Note, a dummy Hello world compiled with:
(executable
(name main)
(libraries ctypes ctypes.foreign))
Will also miss the ffi-7.dll
file. Then, there is nothing which deals with my pg_query
tweaks.
EDIT: I have just filed a ticket Programs compiled with ctypes.foreign miss ffi-7.dll · Issue #18 · ocaml-opam/opam-repository-mingw · GitHub
With MSVC, I am even further to make it works: opam install ctypes
fails!