-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
per-package-target looks in project root for memory.x rather then crate specific directories #9537
Comments
My understanding is it is a missing feature that other have been asking for in different forms. Found #7004 first which is simmilar. I am also running into the same issue (more or less). I am trying to change the rustflags to link against opengl and a few other libs which has to happen at the end in my case because I am also working with cxx but I don't want the rustflags to get modified for all crates in my workspace. At this time the subdirectories' configs in the workspace are ignored and only the main config is used. The current workaround seems to be running Also just found this which seems it might be a solution (but it does require a build script): |
+1 encountered the same issue setting up a workspace that targets different microcontrollers |
I feel like this is less an issue of
I am going to close this in favor of the issues above. Do let us know if there is a reason to keep this issue separately! |
I don't see any confusion over cargo's configuration nor relevance in the mentioned issues. None of them really solve my problem. |
The linked example project is gone so I have no way to reproduce. Since how rustflags is handled is relatively sensitive to where cargo is invoked, do you remember where you ran
The other folk has mentioned this. Did that work for you?
Sorry. I close this as duplicate because |
Unsure if bug or asking for a feature.
Problem
When using the new
per-package-target
feature in nightly builds, any linker scripts that you might need in a specific crate will not be found when using a workspace. The linker script is expected in root.Given the following project structure and manifest files:
cargo build will eventually fail during linking:
Even though the script is right there in the crate's subdirectory.
After copying memory.x to the root directory, cargo build runs without problems (except for all those warnings I should really look at)
I would expect the script (memory.x) in the crate directory itself to be picked up.
The way that this is setup, I wouldn't be able to target multiple microcontrollers requiring a different memory.x script from the same workspace. I can't specify the name either; "link-arg=-Tlink.x" just looks for memory.x and that's it. In order to target different microcontrollers, you'd have to swap the file in the root directory during build or some crazy shenanigans like that.
Steps
Possible Solution(s)
Maybe the best would not be to just make it pick up memory.x from the specific crate, but allow users to explicitly tell cargo where to find memory.x in Cargo.toml - the first time I saw memory.x I was confused how/where it was used/what it was, an explicit setting might help users find the documentation for it on their own. Then again I have no idea as to the complexities of implementing any of this.
Notes
Output of
cargo version
:Output of
rustup show
:The text was updated successfully, but these errors were encountered: