-
Notifications
You must be signed in to change notification settings - Fork 343
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
How to include the generated header? #98
Comments
I really appreciate your help debugging this -- the Cargo-based workflow is not bulletproof yet, since in my work codebase I am using this crate with Buck so I haven't had a chance to hit all the ways that stuff could be going wrong in a Cargo build. The way it's supposed to work is that we write out the header to the $OUT_DIR specified by Cargo, which for an input file It's been working nicely in our CI builds so far but any of the above things could be going wrong for you, possibly for everyone, or possibly only in Windows-specific ways. Some things that would help debug further:
|
I can confirm this on macOS and two Windows machines (one of them is a virtual one).
Sure, here is the original repo. When you said about using the variable.
I guessed it may be related to another issue, which is related to this one: Firstly I had the issue above. When I'd done as described in this comment, everything compiled, but I started to get:
Switching to fully virtual environment did the trick. This is a minor one and related only to a virtual machine environment, so I didn't open a ticket for this. Also on a normal Windows machine there's no this issue. |
I just checked it again and I can't reproduce it on macOS. But I still get it on Windows. Also It looks like the problem is in generating symlinks. |
I tried to patch it locally and because of unix symlinks in the code base it didn't compile. Then I changed the code base so that it worked without symlinks and not only the crate compiled, but also that's solved this issue - header is generated in the But you say it works for CI... Also there're no any errors except of the one described here related to symlinks in the code base, when I use the version from crates.io. And I actually don't understand why it works, because it looks like it shouldn't... I can make a PR and either specify It probably related to rust-lang/cargo#5664 |
Never mind. This is because on pre-Windows 10 you can't create a symlink without admin privileges. You can create it on Windows 10, but after you enable Developer Mode... Damn it! 😄 |
So it sounds like writing the generated file directly to |
I think so yes. That should work. |
This is indeed an issue with workspaces.
Target tree:
|
Sorry if it's a duplicate, but I didn't find anything helpful.
I use cargo build script. I included the generated header using this path:
target/cxxbridge/src/lib.rs.h
. But during a clean build this header isn't there when a file with this include compiles.In the example I see there's
#include "demo-rs/src/main.rs.h"
and it's magically works withcargo build
. So I guess I skipped something important, which does this generating of header. But what?The text was updated successfully, but these errors were encountered: