-
Notifications
You must be signed in to change notification settings - Fork 415
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
-I option not passed during development for headers installed by a sibling package from a monorepo #4121
Comments
I didn't get an error with dune
( It is possible that it is non-deterministic, depends if the files have been copied in the local install directory. |
It still occurs with 2.8.2. The most likely reason you didn't observe it is that you may have a system-wide
It is possible, and I tried many combinations of |
Hi,
Does that sound accurate to you? The issue as I see it is that we're trying to refer to the installed layout as the package is being built. I see 2 possible approaches here:
|
Exploring the second solution, I hacked together a fix, which is to extend the arguments supported
Then (library
(public_name luv_unix)
(libraries luv luv.c result unix)
- (foreign_stubs (language c) (names luv_unix))
+ (foreign_stubs (language c) (names luv_unix) (include_dirs (public_headers luv.c)))
(flags (:standard -w -49 -open Result))) and switching |
Hmm, actually if we go that route we'll probably need to extend |
@emillon did you manage to get any further with this? It's a pretty big blocker to monorepo workflows where any C-using library (like libuv or ctypes) are present, so it would be very handy for this to work for RWO. |
not for now. I was waiting for feedback on this feature idea, and wanted to explore alternative solutions that do not require a new dune feature. but this looks pretty important so we can try to make installing C libraries a bit more first class. |
A branch of dune to experiment in a monorepo sounds great, thanks! luv and ctypes are the first two C libraries at the base of the dependency cone. This will affect pretty much every C library in a monorepo that exports header files. (Another example off the top of my head would be yaml, which bundles libyaml) |
FWIW I'd be happy to test a branch of dune with https://github.com/moby/vpnkit -- I think switching to a monorepo will simplify the development experience (especially for new devs) |
I wrote a poc with 2 features that taken together help fix the issue.
Internally, this builds an install stanza that's equivalent to (This can be improved when directory targets get more powerful (#6133) - then it won't be necessary to list the contents of the directory.)
(This step is manual - maybe we can be a be more automatic and look at all libraries that the library compiles against, and use the corresponding include dirs when building stubs for the library) Here's a branch of dune with these features: https://github.com/emillon/dune/tree/workspace-headers and a branch of luv that uses them https://github.com/emillon/luv/tree/workspace-headers. Together, this makes a cold For ctypes, I think that this can simplify a bit how the headers are accessed (without |
That @emillon, promising progress! Would you be able to try building On vpnkit, with these trees I confirm that:
|
Thanks for the pointer, I wasn't sure what was wrong with ctypes. The issue was here is code that refers to To fix that, I added a And this works in vpnkit! I created a |
#7512 attempts partially fixes this issue by preserving the paths given in |
The issue was not fixed by #7512 and shouldn't be closed only on the basis of #7512 being merged.
So, #7512 appears to have done nothing to address the specific issue of accessing a vendored C library's headers while building in a monorepo. I appear to have worked around all the issues and supported both builds against an opam install and in a monorepo by manually adding Is there a nicer way of doing this with Dune? |
Expected Behavior
Luv vendors libuv, and installs libuv's header
uv.h
atlib/luv/uv.h
using aninstall
stanza (see also #3907 about this stanza).When a project that depends on package
luv
is compiled, Dune correctly passes-I path/to/switch/lib/luv
when compiling the project's C files, which allows them to pull inuv.h
with#include <uv.h>
.I recently added package
luv_unix
to the Luv repo (in branchunix
), which depends onluv
and needsuv.h
. After pinning everything, doingworks, because the package installations are separate, and
uv.h
is in the switch by the timeluv_unix
is installed.The expected behavior is that during development,
or some variation on it, should also work.
luv_unix
should be able to finduv.h
.Actual Behavior
This can be seen immediately in Travis logs. The command failing there is trying to build Luv's tester, which in branch
unix
depends onluv_unix
.Reproduction
Specifications
dune
(output ofdune --version
): 2.8.1ocaml
(output ofocamlc --version
): 4.11.1The text was updated successfully, but these errors were encountered: