Skip to content

Commit 628134e

Browse files
committed
update: refine LIBCLANG_PATH and LD_LIBRARY_PATH settings in release workflow
1 parent a59db4e commit 628134e

1 file changed

Lines changed: 22 additions & 6 deletions

File tree

.github/workflows/release.yml

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,25 +50,41 @@ jobs:
5050
# third_party/rust/chromium_crates_io/vendor tree needed by the
5151
# Temporal Rust dependency, so source builds avoid those GN targets.
5252
EXTRA_GN_ARGS: ${{ matrix.extra_gn_args }}
53-
# Source builds use Chromium clang under target/<triple>/release.
54-
# Bindgen also needs the separate Chromium libclang package there.
55-
LIBCLANG_PATH: ${{ github.workspace }}/target/${{ matrix.rust_target }}/release/clang/lib
56-
LD_LIBRARY_PATH: ${{ github.workspace }}/target/${{ matrix.rust_target }}/release/clang/lib
53+
LIBCLANG_PATH: ${{ github.workspace }}/target/${{ matrix.rust_target }}/release/libclang
54+
LD_LIBRARY_PATH: ${{ github.workspace }}/target/${{ matrix.rust_target }}/release/libclang
5755
with:
5856
target: ${{ matrix.target }}
5957
# Source-building V8 needs Chromium's `gn` binary, which requires
6058
# GLIBC_2.18+. manylinux2014 only has glibc 2.17, so use 2_28 here.
6159
manylinux: "2_28"
6260
container: ${{ matrix.container }}
63-
docker-options: ${{ matrix.docker_options }} -e LIBCLANG_PATH=${{ github.workspace }}/target/${{ matrix.rust_target }}/release/clang/lib -e LD_LIBRARY_PATH=${{ github.workspace }}/target/${{ matrix.rust_target }}/release/clang/lib
61+
docker-options: >-
62+
${{ matrix.docker_options }}
63+
-e LIBCLANG_PATH=${{ github.workspace }}/target/${{ matrix.rust_target }}/release/libclang
64+
-e LD_LIBRARY_PATH=${{ github.workspace }}/target/${{ matrix.rust_target }}/release/libclang
6465
before-script-linux: |
6566
if [ "${{ matrix.v8_from_source }}" = "1" ]; then
6667
env -u RUSTC_WRAPPER cargo fetch --locked
6768
V8_SRC="$(find /root/.cargo/registry/src -maxdepth 2 -type d -name 'v8-147.4.0' -print -quit)"
69+
if [ -z "$V8_SRC" ]; then
70+
echo "::error::Could not find the v8-147.4.0 crate source after cargo fetch."
71+
exit 1
72+
fi
6873
CLANG_DIR="${{ github.workspace }}/target/${{ matrix.rust_target }}/release/clang"
6974
python3 "$V8_SRC/tools/clang/scripts/update.py" --output-dir "$CLANG_DIR"
7075
python3 "$V8_SRC/tools/clang/scripts/update.py" --output-dir "$CLANG_DIR" --package libclang
71-
test -n "$(find "$CLANG_DIR/lib" -name 'libclang.so*' -print -quit)"
76+
LIBCLANG_SO="$(find "$CLANG_DIR" -name 'libclang.so*' -print -quit)"
77+
if [ -z "$LIBCLANG_SO" ]; then
78+
echo "::error::Could not find libclang.so under $CLANG_DIR after downloading Chromium's libclang package."
79+
find "$CLANG_DIR" -maxdepth 4 \( -type f -o -type l \) -print | sort | head -200
80+
exit 1
81+
fi
82+
LIBCLANG_DIR="$(dirname "$LIBCLANG_SO")"
83+
LIBCLANG_PATH_DIR="${{ github.workspace }}/target/${{ matrix.rust_target }}/release/libclang"
84+
mkdir -p "$(dirname "$LIBCLANG_PATH_DIR")"
85+
rm -rf "$LIBCLANG_PATH_DIR"
86+
ln -s "$LIBCLANG_DIR" "$LIBCLANG_PATH_DIR"
87+
echo "Using LIBCLANG_PATH=$LIBCLANG_PATH_DIR -> $LIBCLANG_DIR"
7288
fi
7389
args: >-
7490
--release

0 commit comments

Comments
 (0)