How to specify USE_LAPACK=1? Should I add it to ENV, e.g. USE_LAPACK=1 ./scripts/build_pytorch_android.sh armeabi-v7a  ?
I tried the above, used the two .aar files in lib, and still got the same LAPACK error:
 com.facebook.jni.CppException: inverse: LAPACK library not found in compilation
  
      debug_handle:-1
      
    Exception raised from apply_inverse at ../aten/src/ATen/native/BatchLinearAlgebra.cpp:958 (most recent call first):
    (no backtrace available)
        at org.pytorch.LiteNativePeer.forward(Native Method)
        at org.pytorch.Module.forward(Module.java:52)

If I added changes as in [NOT_FOR_COMMIT][android] Pytorch android build with USE_LAPACK and QML lib by IvanKobzarev · Pull Request #35200 · pytorch/pytorch · GitHub
then I got an error
  [1/1] Linking CXX shared library ../../../../build/intermediates/cmake/release/obj/armeabi-v7a/libpytorch_jni_lite.so                                                                 
  FAILED: ../../../../build/intermediates/cmake/release/obj/armeabi-v7a/libpytorch_jni_lite.so                                                  
  : && /Users/ymiao/Library/Android/sdk/ndk/21.1.6352462/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang++ --target=armv7-none-linux-androideabi21 --gcc-toolchain=/Users/ymiao/Library
/Android/sdk/ndk/21.1.6352462/toolchains/llvm/prebuilt/darwin-x86_64 --sysroot=/Users/ymiao/Library/Android/sdk/ndk/21.1.6352462/toolchains/llvm/prebuilt/darwin-x86_64/sysroot -fPIC -g
 -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -D_FORTIFY_SOURCE=2 -march=armv7-a -mthumb -Wformat -Werror=format-securi
ty   -Oz -DNDEBUG  -Wl,--exclude-libs,libgcc.a -Wl,--exclude-libs,libgcc_real.a -Wl,--exclude-libs,libatomic.a -Wl,--build-id -Wl,--fatal-warnings -Wl,--exclude-libs,libunwind.a -Wl,--
no-undefined -Qunused-arguments -shared -Wl,-soname,libpytorch_jni_lite.so -o ../../../../build/intermediates/cmake/release/obj/armeabi-v7a/libpytorch_jni_lite.so CMakeFiles/pytorch_jn
i_lite.dir/src/main/cpp/pytorch_jni_lite.cpp.o CMakeFiles/pytorch_jni_lite.dir/src/main/cpp/pytorch_jni_common.cpp.o  ../../../../build/intermediates/cmake/release/obj/armeabi-v7a/libf
bjni.so -Wl,--gc-sections -Wl,--whole-archive ../../../../src/main/jniLibs/armeabi-v7a/libtorch.a ../../../../src/main/jniLibs/armeabi-v7a/libtorch_cpu.a -Wl,--no-whole-archive ../../.
./../src/main/jniLibs/armeabi-v7a/libc10.a ../../../../src/main/jniLibs/armeabi-v7a/libnnpack.a ../../../../src/main/jniLibs/armeabi-v7a/libXNNPACK.a ../../../../src/main/jniLibs/armea
bi-v7a/libpytorch_qnnpack.a ../../../../src/main/jniLibs/armeabi-v7a/libpthreadpool.a ../../../../src/main/jniLibs/armeabi-v7a/libeigen_blas.a ../../../../src/main/jniLibs/armeabi-v7a/
libcpuinfo.a ../../../../src/main/jniLibs/armeabi-v7a/libclog.a -llibQML libVulkanWrapper.a -landroid -llog -ldl -latomic -lm && :
  /Users/ymiao/Library/Android/sdk/ndk/21.1.6352462/toolchains/llvm/prebuilt/darwin-x86_64/lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld: error: cannot f
ind -llibQML
  ../../../../src/main/jniLibs/armeabi-v7a/libtorch_cpu.a(BatchLinearAlgebra.cpp.o):BatchLinearAlgebra.cpp:function void at::native::lapackLu<c10::complex<double> >(int, int, c10::comp
lex<double>*, int, int*, int*): error: undefined reference to 'zgetrf_'
  ../../../../src/main/jniLibs/armeabi-v7a/libtorch_cpu.a(BatchLinearAlgebra.cpp.o):BatchLinearAlgebra.cpp:function void at::native::lapackLu<c10::complex<float> >(int, int, c10::compl
ex<float>*, int, int*, int*): error: undefined reference to 'cgetrf_'
.....

Would you please help on how to build from source with the LAPACK support? @kimishpatel  @IvanKobzarev