google / rust_icu

rust_icu: rust bindings for ICU (International Components for Unicode) library
Apache License 2.0
117 stars 28 forks source link

`make static-bindgen` failed #275

Closed Colerar closed 1 year ago

Colerar commented 1 year ago
~/Developer/rust_icu
❯ make static-bindgen
mkdir -p /tmp/rust_icu-col-target
echo top_dir: /Users/col/Developer/rust_icu
top_dir: /Users/col/Developer/rust_icu
echo pwd: /Users/col/Developer/rust_icu
pwd: /Users/col/Developer/rust_icu
docker run --tty --interactive \
            --user=502:20 \
            --volume=/Users/col/Developer/rust_icu:/src/rust_icu \
            --volume=/Users/col/.cargo:/usr/local/cargo \
            --env="RUST_ICU_MAJOR_VERSION_NUMBER=63" \
            --entrypoint="/bin/bash" \
            filipfilmar/rust_icu_testenv-63:1.73.0 \
              "-c" "env OUTPUT_DIR=./rust_icu/rust_icu_sys/bindgen \
              ./rust_icu/rust_icu_sys/bindgen/run_bindgen.sh"
The generator requires bindgen to be in PATH; see README.md
make: *** [static-bindgen-63.stamp] Error 1
filmil commented 1 year ago

The immediate workaround for you is to have bindgen in your $PATH as the error message indicates. You can do that right now without any input from this end.

A more fundamental issue is that we rely on the presence of bindgen on the system. This should probably be fixed to remove dev annoyance.

Colerar commented 1 year ago

The immediate workaround for you is to have bindgen in your $PATH as the error message indicates.

Yes, I already have bindgen in my $PATH, and the error still occurs:

❯ where bindgen
/Users/col/.cargo/bin/bindgen
❯ bindgen --version
bindgen 0.59.2
filmil commented 1 year ago

Is this a Mac-specific thing perhaps?

I don't have a Mac so don't know why the script would not honor your $PATH. I would think that it should.

filmil commented 1 year ago

Mentioned also in https://github.com/google/rust_icu/pull/274

Colerar commented 1 year ago

A more fundamental issue is that we rely on the presence of bindgen on the system. This should probably be fixed to remove dev annoyance.

may be related: https://github.com/rust-lang/cargo/issues/9096

currently it's a unstable feature for cargo.

filmil commented 1 year ago

OK, so this should work in a container (and does on my end!).

Perhaps it could be fixed by referring to the binary's absolute path since the buildenv containers are known and fixed.

filmil commented 1 year ago

This is fixed, and is now guarded by a presubmit check at https://github.com/google/rust_icu/pull/279

filmil commented 1 year ago

To wit, the issue was that make static-bindgen mounted cargo's bin directory from the host into the container, and there is a library version mismatch between most hosts and the rust:1.70 container, where the container's required glibc is way newer than that of the host.

This is now fixed, by not mounting the host's cargo bin into the containers when make static-bindgen runs.