Publishing a crate that depends on cross-build of libcore


#1

I want to publish this crate: https://github.com/hackndev/zinc/blob/master/volatile_cell/Cargo.toml to crates.io, but I can’t figure a proper way to do that.

The crate depends on libcore being cross-compiled, for that there are a bunch of targets specified pointing at https://github.com/hackndev/rust-libcore repo that hosts a wrapper to fetch and compile libcore as a cargo package.

I can’t publish rust-libcore:

api errors: cannot upload a crate with a reserved name

and I can’t publish volatile_cell without it:

all dependencies must come from the same source.
dependency `core` comes from https://github.com/hackndev/rust-libcore instead

Is there any way to sort this out?


#2

The canonical source of libcore is the compiler; using some other source for it is an unsupported hack, and will never be accepted on crates.io.

Granted, the current procedure for installing a cross-compile target is a bit inconvenient, but that’s something which will hopefully be improved in the future.


#3

Actually, I figured that I just need to rename the package: https://crates.io/crates/rust-libcore to get it through.


#4

Actually figured that renaming the crate to rust-libcore fixes it for crates.io, but it’s broken if sourced from git directly:

no matching package named `core` found (required by `zinc`)
location searched: https://github.com/hackndev/rust-libcore
version required: *

#5

I think you should just remove the dependency on a custom libcore. Then you will get a crate core not found error for custom targets, but you can fix it by adding a cross-compiled libcore to your libs. See my nighly-libcore crate for instructions.


#6

As huon pointed out on irc, I should have updated the crate name in all the relevant Cargo.toml files, so now it works again. While expecting the compiler to provide libcore is a nice idea overall, I prefer it when users need to run a single command, that works now again in my case, even for the price of slight cross-target mess in the Cargo.toml files.