RazrFalcon/memmap2-rs

libc dependency is too loose

Closed this issue · 11 comments

Cargo.toml has this dependency:

libc = "0.2.143"

But the crate uses MAP_HUGE_SHIFT which wasn't added to libc for Android until 0.2.151

Sure, will update. We're currently not testing Android on CI. No idea how hard is to add it.

I think for a simple check build (which should catch this problem), just installing a relevant target via dtolnay/rust-toolchain should suffice.

@adamreichold Doesn't seems to work. We need to somehow force cargo to use the version specified in the Cargo.toml and not the latest one.

It's unstable. It's might be fine for CI, but I don't think using nightly android target is a good idea.

Two ideas:

  • Use nightly Cargo only to run cargo update -Zminimal-versions, then build against that Cargo.lock using the stable toolchain.
  • Use only the stable toolchain and manually run cargo update --package libc --precise 0.2.151 before building.

I assume changing minimal libc version is a breaking change, right?

I don't think so. We just incremented the patch version which every downstream project should be able to follow without any code changes because even if the currently use an older libc, 0.2.151 will be compatible with that.

As an aside, we do not need the with: target: ${{ matrix.target }} part for the nightly toolchain AFAIU because we never build anything using it, it just updates Cargo.lock. (I suspect we maybe do not even need rustc but really just Cargo for this, but I am not sure if Cargo even runs without rustc present.)

Makes sense. All done.