Search code examples
rustrust-cargomio

Native library `kernel32` is being linked to by more than one package


I cloned and tried to build the MIO coroutines library, but its dependencies seem to clash:

native library `kernel32` is being linked to by more than one package, and can only be linked to by one package

  kernel32-sys v0.2.0
  kernel32-sys v0.1.4

It seems like the dependency time requires kernel32 0.1.4, but two other dependencies fs2 and memmap require 0.2.0.

Is there anything I can do to address it, or would the best solution in cases like this just be to file a bug report?

On a related note, if the repo doesn't have a Cargo.lock, does that count as a bug? I've seen it recommended that Cargo.lock always be added to version control to prevent issues like this.


Solution

  • This is a known issue that has been documented on the WinAPI bugtracker.

    It seems the issue was that the maintainer published a new version, bumping it from v0.1.x to v0.2.x. Since some packages depend on (and will continue to depend on, until they're updated) v0.1.x, Cargo complained that the two dependencies are not compatible, and refused to link them both in. Chaos ensues.

    This should now be rectified, according to the ticket mentioned above.