Skip to content

Commit

Permalink
ndk-sys: Fail bindings generation when sysroot is not found
Browse files Browse the repository at this point in the history
Mistyping the env var path resulted in obscure "header not found" errors
rather than `libclang` complaining that the path passed to `--sysroot`
wasn't valid in the first place.
  • Loading branch information
MarijnS95 committed Nov 23, 2022
1 parent 90e85ca commit f141099
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions ndk-sys/generate_bindings.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
#!/bin/sh

sysroot="${ANDROID_NDK_ROOT}"/toolchains/llvm/prebuilt/linux-x86_64/sysroot/
[ ! -d "$sysroot" ] && echo "Android sysroot $sysroot does not exist!" && exit 1

while read ARCH && read TARGET ; do
bindgen wrapper.h -o src/ffi_$ARCH.rs \
--blocklist-item 'JNI\w+' \
Expand Down Expand Up @@ -47,9 +50,7 @@ while read ARCH && read TARGET ; do
--newtype-enum 'cryptoinfo_mode_t' \
--newtype-enum 'log_id' \
-- \
--sysroot="${ANDROID_NDK_ROOT}"/toolchains/llvm/prebuilt/linux-x86_64/sysroot/ --target=$TARGET

# --newtype-enum '_bindgen_ty_63' \
--sysroot="$sysroot" --target=$TARGET
done << EOF
arm
arm-linux-androideabi
Expand Down

0 comments on commit f141099

Please sign in to comment.