Build from source error

koutoftimer: <p>I have clonned v1.13.0 and trying to build pytorch with CUDA 3.5 support.</p>
<pre data-code-wrap="console"><code class="lang-nohighlight">$ nvidia-smi 
Wed Dec  7 18:38:18 2022       
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 470.141.03   Driver Version: 470.141.03   CUDA Version: 11.4     |
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|                               |                      |               MIG M. |
|===============================+======================+======================|
|   0  NVIDIA GeForce ...  Off  | 00000000:01:00.0 N/A |                  N/A |
| N/A   36C    P8    N/A /  N/A |    152MiB /  2001MiB |     N/A      Default |
|                               |                      |                  N/A |
+-------------------------------+----------------------+----------------------+
                                                                               
+-----------------------------------------------------------------------------+
| Processes:                                                                  |
|  GPU   GI   CI        PID   Type   Process name                  GPU Memory |
|        ID   ID                                                   Usage      |
|=============================================================================|
|  No running processes found                                                 |
+-----------------------------------------------------------------------------+

$ USE_SYSTEM_LIBS=1 MAX_JOBS=2 TORCH_CUDA_ARCH_LIST=3.5 python setup.py install
...
-- Configuring incomplete, errors occurred!
See also "/tmp/pytorch/build/CMakeFiles/CMakeOutput.log".
See also "/tmp/pytorch/build/CMakeFiles/CMakeError.log".

$ tail build/CMakeFiles/CMakeError.log

Run Build Command(s):/usr/bin/ninja cmTC_8db07 &amp;&amp; [1/2] Building CXX object CMakeFiles/cmTC_8db07.dir/src.cxx.o
FAILED: CMakeFiles/cmTC_8db07.dir/src.cxx.o 
/usr/bin/c++ -DHAS_FCOLOR_DIAGNOSTICS  -fvisibility-inlines-hidden -DUSE_PTHREADPOOL -fopenmp -DNDEBUG -DUSE_KINETO -DUSE_FBGEMM -DUSE_QNNPACK -DUSE_PYTORCH_QNNPACK -DUSE_XNNPACK -DSYMBOLICATE_MOBILE_DEBUG_HANDLE -DEDGE_PROFILER_USE_KINETO -O2 -fPIC -Wno-narrowing -Wall -Wextra -Werror=return-type -Werror=non-virtual-dtor -Wno-missing-field-initializers -Wno-type-limits -Wno-array-bounds -Wno-unknown-pragmas -Wunused-local-typedefs -Wno-unused-parameter -Wno-unused-function -Wno-unused-result -Wno-strict-overflow -Wno-strict-aliasing -Wno-error=deprecated-declarations -Wno-stringop-overflow -Wno-psabi -Wno-error=pedantic -Wno-error=redundant-decls -Wno-error=old-style-cast  -fPIE   -fcolor-diagnostics -std=gnu++14 -o CMakeFiles/cmTC_8db07.dir/src.cxx.o -c /tmp/pytorch/build/CMakeFiles/CMakeTmp/src.cxx
c++: error: unrecognized command-line option '-fcolor-diagnostics'
ninja: build stopped: subcommand failed.


Source file was:
int main() { return 0; }

$ c++ --version
c++ (Gentoo 11.3.0 p7) 11.3.0
Copyright (C) 2021 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

$ ninja --version
1.11.1

$ cmake --version
cmake version 3.24.3
</code></pre>
<p>I’m stuck at this point.</p>
<p>UPD: gcc has an option called fdiagnostics-color (not -fcolor-diagnostics), is it cmake bug?</p>
<p>UPD2: looks like problem with <code>Cannot add target-level dependencies to non-existent target "gloo_cuda"</code>. Will try master branch…</p>
<pre><code class="lang-auto">-- Found uv: 1.38.1 (found version "1.38.1")                                                                                                
Found gloo: /usr/lib64/libgloo.so                                                                                                           
CMake Error at cmake/Dependencies.cmake:1500 (add_dependencies):                                                                            
  Cannot add target-level dependencies to non-existent target "gloo_cuda".                                                                  
                                                                                                                                            
  The add_dependencies works for top-level logical targets created by the                                                                   
  add_executable, add_library, or add_custom_target commands.  If you want to                                                               
  add file-level dependencies see the DEPENDS option of the add_custom_target                                                               
  and add_custom_command commands.                                                                                                          
Call Stack (most recent call first):                                                                                                        
  CMakeLists.txt:715 (include)     
</code></pre>