I am trying to build PyTorch from source using TBB instead of OpenMP but I am getting the following errors every time:
    /usr/bin/ld: <PATH>/pytorch/build/lib/libtorch_cpu.so: undefined reference to `omp_get_max_threads'
    /usr/bin/ld: <PATH>/pytorch/build/lib/libtorch_cpu.so: undefined reference to `omp_get_num_threads'
    /usr/bin/ld: <PATH>/pytorch/build/lib/libtorch_cpu.so: undefined reference to `GOMP_barrier'
    /usr/bin/ld: <PATH>/pytorch/build/lib/libtorch_cpu.so: undefined reference to `GOMP_parallel'
    /usr/bin/ld: <PATH>/pytorch/build/lib/libtorch_cpu.so: undefined reference to `omp_in_parallel'
    /usr/bin/ld: <PATH>/pytorch/build/lib/libtorch_cpu.so: undefined reference to `omp_get_thread_num'
    collect2: error: ld returned 1 exit status
    make[2]: *** [caffe2/CMakeFiles/kernel_function_legacy_test.dir/build.make:109: bin/kernel_function_legacy_test] Error 1

You can find the full log file HERE:

To Reproduce
Steps to reproduce the behavior:

git clone https://github.com/pytorch/pytorch
cd pytorch
ATEN_THREADING=TBB BUILD_BINARY=1 USE_EIGEN_THREADPOOL=1 USE_CUDA=0 PARALLEL_BACKEND=NATIVE_TBB USE_OPENMP=0 USE_TBB=1 MKL_THREADING=TBB BLAS=MKL USE_MKLDNN=1 MKLDNN_THREADING=TBB BUILD_BINARY=1 python setup.py build --cmake 2>&1 | tee ~/output.txt 


PyTorch Version (e.g., 1.0): 1.10.0a0+git1798ff0
OS (e.g., Linux): Manjaro
How you installed PyTorch (conda, pip, source): pip
Python version: 3.9.5
CUDA/cuDNN version: NO
GPU models and configuration: NO