Skip to content

Let Cargo packages modify the state of the build environment for other (non dependent) packages. #95

@TyOverby

Description

@TyOverby

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:

  • Force the users of that library to configure their machine correctly
  • Force the library author to build and install the C library
  • Let the user configure their project to build and install the C library.

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 libraries
I 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 run cargo build it runs the build step which runs my compile.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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-linkageArea: linker issues, dylib, cdylib, shared libraries, so

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions