Repository: pytorch
Issue: Why has no torch::jit::load() in Pytorch Android's libtorch_cpu.so
Labels: oncall: jit

### 🐛 Describe the bug

1.build pytorch android according to Readme.md.

- git clone https://github.com/pytorch/pytorch.git
- cd pytorch
- git submodule update --init --recursive
- bash ./scripts/build_pytorch_android.sh

2.  compile and linking  failed

- torch::jit::script::Module module;
- module = torch::jit::load(model_path);  // ld: error: undefined symbol: torch::jit::load(std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> > const&, std::__ndk1::optional<c10::Device>, bool)

![2023-12-18 18-16-05屏幕截图](https://github.com/pytorch/pytorch/assets/44193711/15408d1a-34fe-45cb-b5bb-fad8d2b29524)


### Error logs

====================[ Build | main | Debug ]====================================
/home/vr/clion-2021.1.2/bin/cmake/linux/bin/cmake --build /home/vr/CLionProjects/torch_script_test/cmake-build-debug --target main -- -j 6
Scanning dependencies of target main
[ 50%] Building CXX object CMakeFiles/main.dir/main.cpp.o
[100%] Linking CXX executable main
ld: error: undefined symbol: torch::jit::load(std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> > const&, std::__ndk1::optional<c10::Device>, bool)
>>> referenced by main.cpp:26 (/home/vr/CLionProjects/torch_script_test/main.cpp:26)
>>>               CMakeFiles/main.dir/main.cpp.o:(main)
clang-14: error: linker command failed with exit code 1 (use -v to see invocation)
make[3]: *** [CMakeFiles/main.dir/build.make:115：main] 错误 1
make[2]: *** [CMakeFiles/Makefile2:95：CMakeFiles/main.dir/all] 错误 2
make[1]: *** [CMakeFiles/Makefile2:102：CMakeFiles/main.dir/rule] 错误 2
make: *** [Makefile:137：main] 错误 2

#include <torch/script.h> // One-stop header.
#include <ATen/NativeFunctions.h>
#include <torch/torch.h>
#include <iostream>
#include <memory>
#include <fstream>
#include <vector>
#include <iterator>
#include <string>
#include <opencv2/highgui.hpp>
#include <opencv2/core/core.hpp>
#include <opencv2/opencv.hpp>

int main(int argc, const char* argv[]) {

  std::string model_path = "/home/vr/NotebookProjects/abc.pt";

  torch::jit::script::Module module;
  module = torch::jit::load(model_path);

  return 0;
}


### Minified repro

_No response_

### Versions

Collecting environment information...
PyTorch version: N/A
Is debug build: N/A
CUDA used to build PyTorch: N/A
ROCM used to build PyTorch: N/A

OS: Ubuntu 18.04.5 LTS (x86_64)
GCC version: (Ubuntu 9.3.0-10ubuntu2) 9.3.0
Clang version: Could not collect
CMake version: version 3.28.0
Libc version: glibc-2.27

Python version: 3.8.8 (default, Apr 13 2021, 19:58:26)  [GCC 7.3.0] (64-bit runtime)
Python platform: Linux-5.4.0-42-generic-x86_64-with-glibc2.10
Is CUDA available: N/A
CUDA runtime version: 11.0.194
CUDA_MODULE_LOADING set to: N/A
GPU models and configuration: GPU 0: GeForce GTX 1650 SUPER
Nvidia driver version: 460.80
cuDNN version: Could not collect
HIP runtime version: N/A
MIOpen runtime version: N/A
Is XNNPACK available: N/A

CPU:
架构：           x86_64
CPU 运行模式：   32-bit, 64-bit
字节序：         Little Endian
CPU:             8
在线 CPU 列表：  0-7
每个核的线程数： 1
每个座的核数：   8
座：             1
NUMA 节点：      1
厂商 ID：        GenuineIntel
CPU 系列：       6
型号：           158
型号名称：       Intel(R) Core(TM) i7-9700 CPU @ 3.00GHz
步进：           13
CPU MHz：        800.100
CPU 最大 MHz：   4700.0000
CPU 最小 MHz：   800.0000
BogoMIPS：       6000.00
虚拟化：         VT-x
L1d 缓存：       32K
L1i 缓存：       32K
L2 缓存：        256K
L3 缓存：        12288K
NUMA 节点0 CPU： 0-7
标记：           fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault epb invpcid_single ssbd ibrs ibpb stibp ibrs_enhanced tpr_shadow vnmi flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid mpx rdseed adx smap clflushopt intel_pt xsaveopt xsavec xgetbv1 xsaves dtherm ida arat pln pts hwp hwp_notify hwp_act_window hwp_epp md_clear flush_l1d arch_capabilities

Versions of relevant libraries:
[pip3] flake8==3.9.0
[pip3] mypy-extensions==0.4.3
[pip3] numpy==1.24.4
[pip3] numpydoc==1.1.0
[pip3] onnxruntime==1.15.1
[pip3] torch-receptive-field==0.0.1
[conda] blas                      1.0                         mkl    defaults
[conda] mkl                       2021.2.0           h06a4308_296    defaults
[conda] mkl-service               2.3.0            py38h27cfd23_1    defaults
[conda] mkl_fft                   1.3.0            py38h42c9631_2    defaults
[conda] mkl_random                1.2.1            py38ha9443f7_2    defaults
[conda] numpy                     1.24.4                   pypi_0    pypi
[conda] numpydoc                  1.1.0              pyhd3eb1b0_1    defaults


cc @EikanWang @jgong5 @wenzhe-nrv @sanchitintel @ezyang @msaroufim @wconstab @bdhirsh @anijain2305 @zou3519
```[tasklist]
### Tasks
```