Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to Dune 3 ctypes stanza #11

Open
MisterDA opened this issue May 10, 2023 · 1 comment
Open

Update to Dune 3 ctypes stanza #11

MisterDA opened this issue May 10, 2023 · 1 comment

Comments

@MisterDA
Copy link
Contributor

Dune 3 has native support for ctypes. It now shows warnings when building ocaml-posix packages. I think it would be nicer to switch to the new stanza, but it's not clear to me how to proceed, seeing that we have C code being generated by hand.
https://dune.readthedocs.io/en/stable/foreign-code.html#stub-generation-with-dune-ctypes

File "posix-types/src/generator/dune", line 19, characters 3-17:
19 |    %{lib:ctypes:}
        ^^^^^^^^^^^^^^
Error: The form %{lib:<libname>:} is no longer supported since version 3.0 of
the Dune language.
Hint: Did you know that Dune 3.0 supports ctypes natively? See the manual for
more details.
@toots
Copy link
Member

toots commented May 10, 2023

Hi

I'd be down to switch to dune support. The tricky part, I believe, is to figure out how to make cross-compilation work. To do this, some of the programs used to get system-specific constants have to be run through wine. See: https://github.com/savonet/ocaml-posix/blob/main/posix-socket/src/generator/exec.sh

I'm not sure if dune supports that with ctypes. The cross-compilation layer for dune is very powerful but it assumes that all binaries that need to be executed have to built for the architecture running the build, not the target one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants