Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upLet Cargo packages modify the state of the build environment for other (non dependent) packages. #95
Comments
This comment has been minimized.
This comment has been minimized.
|
The There's currently no equivalent of Does that help? |
This comment has been minimized.
This comment has been minimized.
|
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 |
This comment has been minimized.
This comment has been minimized.
|
I'm not sure how that setup would work. If the package There's a number of issues around a command such as |
This comment has been minimized.
This comment has been minimized.
No, currently the |
This comment has been minimized.
This comment has been minimized.
|
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. |
This comment has been minimized.
This comment has been minimized.
|
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! |
This comment has been minimized.
This comment has been minimized.
|
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. |
This comment has been minimized.
This comment has been minimized.
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! |
TyOverby
changed the title
Export multiple C dynamic and static libraries
Let Cargo packages modify the state of the build environment for other (non dependent) packages.
Jun 30, 2014
This comment has been minimized.
This comment has been minimized.
|
Well, now that I know that it's somewhat possible, I've updated the title and description. |
This comment has been minimized.
This comment has been minimized.
|
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? |
This comment has been minimized.
This comment has been minimized.
|
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 |
This comment has been minimized.
This comment has been minimized.
|
@pnkfelix: That's exactly what I was trying to do. |
trink
referenced this issue
Sep 11, 2014
Closed
Allow for better integration of native builds using cmake #556
alexcrichton
added
the
A-linkage
label
Oct 13, 2014
This comment has been minimized.
This comment has been minimized.
|
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. |
TyOverby commentedJun 29, 2014
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 buildit runs thebuildstep which runs mycompile.shwhich 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.