Cargo package too large

I am writing a binding to an extremely large C++ library, and the current project structure includes the original library as a submodule, and builds it by CMake in build.rs.

The problem is that this creates a 500mb package file that I cannot publish to crates.io.
Any suggestions to get around this problem?

Thank god for that. The last thing I ever want to happen is a surprise half-gigabyte download due to some transitive dependency. Or worse: a point release that causes it all to be re-downloaded for no reason. To say nothing of the wasted disk space in cache...

The best approach is probably to require users to provide either the source code or the compiled library themselves, along with some mechanism for configuring how to locate it. You might want to look at the pkg-config and vcpkg crates as a starting point.

As an aside: I've never liked the "dump a bunch of extra stuff in the package" approach, and have always felt Cargo desperately needs some kind of standardised system for providing and/or downloading external dependencies.

1 Like

Thanks for your help!
I am binding a library that depends to the whole llvm project. I guess I have to look into your solution :joy:

In this case, you should require an existing system LLVM installation. LLVM is so big that nobody wants it duplicated on their system.

1 Like

Yea...... The original project uses submodule to compile their project, and their CMake configuration is like 700 lines of code, I might have to hack through those too :frowning:

I can't help feeling that crates.io is intended for Rust source code. It does not seem appropriate to push gigabytes of code from some other language into there.

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.