Repository: pytorch
Issue: Missing librt.so.1, libdl.so.2, libz.so.1 and libpthread.so.0 in PyTorch Source Build (aarch64)
Labels: needs reproduction,module: build,triaged,module: arm

### 🐛 Describe the bug

I am building PyTorch from source on an aarch64 system and have noticed performance differences of Hugging face models(Bert, resnet etc) when running on 64 threads/cores, compared to the pip-installed version (2.4.0). Upon inspecting the shared libraries linked to libtorch_cpu.so, I found that the pip-installed version links to librt.so.1, libdl.so.2, libz.so.1 and libpthread.so.0, but these libraries are missing in the source build.
I used following method to build:
[[builder/aarch64_linux/aarch64_wheel_ci_build.py at main · pytorch/builder · GitHub](https://github.com/pytorch/builder/blob/main/aarch64_linux/aarch64_wheel_ci_build.py)].
Please help me out to build pytorch similar to pip-installed version including all missing libraries.



### Versions

Collecting environment information...
PyTorch version: 2.4.0
Is debug build: False
CUDA used to build PyTorch: None
ROCM used to build PyTorch: N/A

OS: Ubuntu 22.04.5 LTS (aarch64)
GCC version: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0
Clang version: 14.0.0-1ubuntu1.1
CMake version: version 3.22.1
Libc version: glibc-2.35

Python version: 3.10.12 (main, Sep 11 2024, 15:47:36) [GCC 11.4.0] (64-bit runtime)
Python platform: Linux-6.8.0-1015-aws-aarch64-with-glibc2.35
Is CUDA available: False
CUDA runtime version: No CUDA
CUDA_MODULE_LOADING set to: N/A
GPU models and configuration: No CUDA
Nvidia driver version: No CUDA
cuDNN version: No CUDA
HIP runtime version: N/A
MIOpen runtime version: N/A
Is XNNPACK available: True

CPU:
Architecture:                         aarch64
CPU op-mode(s):                       32-bit, 64-bit
Byte Order:                           Little Endian
CPU(s):                               64
On-line CPU(s) list:                  0-63
Vendor ID:                            ARM
Model:                                1
Thread(s) per core:                   1
Core(s) per cluster:                  64
Socket(s):                            -
Cluster(s):                           1
Stepping:                             r1p1
BogoMIPS:                             2100.00
Flags:                                fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp asimdhp cpuid asimdrdm jscvt fcma lrcpc dcpop sha3 sm3 sm4 asimddp sha512 sve asimdfhm dit uscat ilrcpc flagm ssbs paca pacg dcpodp svei8mm svebf16 i8mm bf16 dgh rng
L1d cache:                            4 MiB (64 instances)
L1i cache:                            4 MiB (64 instances)
L2 cache:                             64 MiB (64 instances)
L3 cache:                             32 MiB (1 instance)
NUMA node(s):                         1
NUMA node0 CPU(s):                    0-63
Vulnerability Gather data sampling:   Not affected
Vulnerability Itlb multihit:          Not affected
Vulnerability L1tf:                   Not affected
Vulnerability Mds:                    Not affected
Vulnerability Meltdown:               Not affected
Vulnerability Mmio stale data:        Not affected
Vulnerability Reg file data sampling: Not affected
Vulnerability Retbleed:               Not affected
Vulnerability Spec rstack overflow:   Not affected
Vulnerability Spec store bypass:      Mitigation; Speculative Store Bypass disabled via prctl
Vulnerability Spectre v1:             Mitigation; __user pointer sanitization
Vulnerability Spectre v2:             Mitigation; CSV2, BHB
Vulnerability Srbds:                  Not affected
Vulnerability Tsx async abort:        Not affected

Versions of relevant libraries:
[pip3] numpy==2.1.1
[pip3] torch==2.4.0
[pip3] torchvision==0.19.1
[conda] Could not collect

cc @malfet @seemethere @snadampal @milpuz01