Hi!
So I am trying to build libtorch on my linux machine using cmake and the instructions here:
  

      github.com
  

  
    pytorch/pytorch/blob/master/docs/libtorch.rst 2


    libtorch (C++-only)
===================

The core of pytorch does not depend on Python. A
CMake-based build system compiles the C++ source code into a shared
object, libtorch.so.

Building libtorch using Python
------------------------------

You can use a python script/module located in tools package to build libtorch
::
   cd <pytorch_root>

   # Make a new folder to build in to avoid polluting the source directories
   mkdir build_libtorch && cd build_libtorch

   # You might need to export some required environment variables here.
   Normally setup.py sets good default env variables, but you'll have to do
   that manually.



  This file has been truncated. show original

  

  
    
    
  

  


For this, first I create a conda environment, and install the packages highlighted here:
  
      

      GitHub
  

  
    

GitHub - pytorch/pytorch: Tensors and Dynamic neural networks in Python with...

  Tensors and Dynamic neural networks in Python with strong GPU acceleration - GitHub - pytorch/pytorch: Tensors and Dynamic neural networks in Python with strong GPU acceleration


  

  
    
    
  

  


I am trying to configure my build using the following command:
cmake -DBUILD_SHARED_LIBS:BOOL=ON -DCMAKE_BUILD_TYPE:STRING=Release -DPYTHON_EXECUTABLE:PATH=`which python3` -DCMAKE_INSTALL_PREFIX:PATH=/raid/projects/pytorch-install -DGLIBCXX_USE_CXX11_ABI=0 -DBUILD_PYTHON:BOOL=OFF ../pytorch

During the configuration step I see strange warnings ending that they are meant for developers only. I am not sure if that is normal or not, but the configure finishes without other issues. Then I move on an call:
cmake --build . -j 16 --target install

It compiles seemingly without an issue but I see warnings like:
[ 13%] Building CXX object third_party/ideep/mkl-dnn/src/cpu/CMakeFiles/dnnl_cpu.dir/nspc_batch_normalization.cpp.o

Skipping full_like because it is a factory method
Skipping from_file because it is a factory method
Skipping hann_window because it is a factory method
Skipping hamming_window because it is a factory method
Skipping kaiser_window because it is a factory method
Skipping index_copy Because of Arg: Dimname (Dimname)
Skipping kthvalue Because of Arg: Dimname (Dimname)
Skipping kthvalue Because of Arg: Dimname (Dimname)
Skipping fbgemm_linear_quantize_weight Because of Ret: double (double)
Skipping linspace because it is a factory method
Skipping logspace because it is a factory method
... more lines like that ...
... more lines like that ...

It seems it only affects the mkl-ddn part. I tried it on an HPC and my laptop, with PT 1.10 and 1.7 and I get the same issues. Following this, when I try to link libtorch with another code I get errors like this:
/data/miniconda3/envs/pytorch-conda39-build/bin/../lib/gcc/x86_64-conda-linux-gnu/9.3.0/../../../../x86_64-conda-linux-gnu/bin/ld: /raid/projects/pytorch-install/lib/libtorch_cpu.so: undefined reference to `MKL_Somatadd'
/data/miniconda3/envs/pytorch-conda39-build/bin/../lib/gcc/x86_64-conda-linux-gnu/9.3.0/../../../../x86_64-conda-linux-gnu/bin/ld: /raid/projects/pytorch-install/lib/libtorch_cpu.so: undefined reference to `MKL_Get_Version_String'
/data/miniconda3/envs/pytorch-conda39-build/bin/../lib/gcc/x86_64-conda-linux-gnu/9.3.0/../../../../x86_64-conda-linux-gnu/bin/ld: /raid/projects/pytorch-install/lib/libtorch_cpu.so: undefined reference to `vsSqrt'
... more errors like that ...
... more errors like that ...

which is rather strange. I wonder if the two issues are related. Has anybody seen this behavior before?