-
-
Notifications
You must be signed in to change notification settings - Fork 26
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
Cross-compiling luv #129
Comments
One thought: The vcpkg port of libuv names the library |
That seems reasonable. If someone would prefer cross-compilation using the vendored libuv code, I/they can add it separately later. |
Thinking aloud: We would end up with many many environment variables if every OCaml package does what my PR #130 does. And I could see running into environment maximum size (32K on Windows) or command line max length limitations (ex. The entire problem is that we don't have a good way in OCaml to ask for locations of C libraries. Today packages do one of the following:
I am fine with keeping environment variables for now, but we need a better long-term solution. I am willing to start a discuss.ocaml.org topic, unless you have strong opinions one way or the other. |
I can do a PR myself (if it is small-ish like the proposal below) once this design question is answered.
Context
The way I do cross-compilation is using Dune workspace targets, which is just a wrapper around ocamlfind toolchains. I believe others who use opam-monorepo do the same thing.
Problem
I'm running into problems with luv because luv uses a custom build in src/c/dune. One example blocker is
luv/src/c/dune
Line 75 in 0ed668e
For cross-compiling, you would want a build for
ocamlc -config
like above, but you would also want aocamlfind -toolchain <toolchain> ocamlc -config
build. Dune does this automatically by building a "native" context=default target (which uses no toolchain) and then building separately (ex. context="android") for any targets listed indune-workspace
.Proposal
A couple points:
ocamlc -config
flags.So my idea would be to:
context_name
; it is also available asJbuild_plugin.V1.context
. Ifdune-workspace
has two targets "native" and "android", then src/c/dune will be called withcontext_name="default"
in the _build/default directory and then called again withcontext_name="default.android"
in the _build/default.android directory.LUV_SYSTEM_LIBUV_${uppercase(sanitize(context_name))}
be an environment variable that setsuv_library_flag
. If it isn't defined just fallback to-luv
. For example:I used semicolons as a separator as one way to allow spaces in paths which is essential for Windows. Could also have escaped the space or passed in OCaml escaped strings.
What do you think? Suggestions?
Thanks.
The text was updated successfully, but these errors were encountered: