-
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
Let Cargo packages modify the state of the build environment for other (non dependent) packages. #95
Comments
The There's currently no equivalent of Does that help? |
Thanks @alexcrichton, that might solve my problems. When I copy the library files over into $OUT_DIR, will those show up for other dependencies in my Cargo.toml list? For example
Will this setup work? Or will I have to convince the author of I really hope that either that setup works, or Cargo adopt a new directive next to |
I'm not sure how that setup would work. If the package There's a number of issues around a command such as |
No, currently the |
I suppose the issue that I'm having is this: Build scripts are heavily dependent on the state of the users machine. Like programs that rely heavily on mutable state, making gaurantees that their machine is in the correct state to build a program is difficult. With a package manager, much of this difficulty goes away when the state that you care about is "this rust library needs to be installed". But when we care about "this C library needs to be installed", and a rust dependency requires that state before it can even compile, then you can either:
I'm trying for an approach where by including another dependency in their Cargo.toml file, they could have the native libraries built that are required by their other rust dependencies. |
I believe that having another dependency would always be possible, but this would imply that you need some means of saying that package foo didn't explicitly depend on package bar, but for ordering reasons you want foo to depend on bar. Basically, you have to ensure that the dependencies are built in the right order, and cargo does not currently allow a method to do that without modifying the source package. This seems like a fairly different request from the original issue description/title, would you be ok opening a separate issue with this feature request? Although I may have also overlooked something! |
Haha, maybe I just got better at describing my problem!
Yep that's exactly what I want. But in this example
Yep. Would it make sense for packages to have optional "package priority"? Or maybe the user could specify the order? I'm leaning towards the first option, but I could see how that would get out of hand.
Hmm... Maybe I should just change the title? I'm open to suggestions. |
Either way is ok, but be sure to keep the original title/description somewhere to maintain the history!
Interesting! These both seem like interesting ideas! |
Well, now that I know that it's somewhat possible, I've updated the title and description. |
From the description here, it sounds like the current way @TyOverby is planning to solve their problem is to make the It seems like a potentially more flexible approach would be to allow the build script to communicate back to cargo the set of Any thoughts on the options here? |
That is definitely a possibility, and seems pretty reasonable. Cargo is not currently super ambitious when building native code as it basically only has the bare-bones interface of |
@pnkfelix: That's exactly what I was trying to do. |
Times have come a long way since this was opened and with the now landed build script support (#792), I'm going to close this for now as I think this is basically implemented to the extent that we'd like to implement it for now. Specifically @pnkfelix's suggestion is now implemented where build scripts can provide feedback to the compiler about where native dependencies are located. |
Build scripts are heavily dependent on the state of the users machine. Like programs that rely heavily on mutable state, making gaurantees that their machine is in the correct state to build a program is difficult. With a package manager, much of this difficulty goes away when the state that you care about is "this rust library needs to be installed". But when we care about "this C library needs to be installed", and a rust dependency requires that state before it can even compile, then you can either:
I'm trying for an approach where by including another dependency in their Cargo.toml file, they could have the native libraries built that are required by their other rust dependencies.
Title was: Export multiple C dynamic and static librariesI have a project where the entire purpose is to compile the C and C++ dependencies required for various projects in the Piston project. So instead of telling the user to "download and build sdl2", it will download and attempt to automate that as much as possible with the goal of either successfully installing the whole thing without user interaction, or failing with a helpful error message and steps that the user can take to resolve those errors.Right now I have it automated such that when I runcargo build
it runs thebuild
step which runs mycompile.sh
which downloads and compiles all the projects and throws all library files in./lib/
.My question is, is it possible to simply throw these static and dynamic library files in a directory (/target/???
) and have them available to link with the rest of the libraries in the compilation?Right now the process involves installing these libraries at the system level (sudo make install
), and I'd like to be able to build and install and link them locally.The text was updated successfully, but these errors were encountered: