Compiler (c++) not compatible with the compiler Pytorch was built

MauroPfister: <p>When I’m compiling custom cuda extensions I get the following warning but the extensions still compile and seem to work just fine.</p>
<pre><code class="lang-auto">                               !! WARNING !!

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Your compiler (c++) is not compatible with the compiler Pytorch was
built with for this platform, which is g++ on linux. Please
use g++ to to compile your extension. Alternatively, you may
compile PyTorch from source using c++, and then you can also use
c++ to compile your extension.

See https://github.com/pytorch/pytorch/blob/master/CONTRIBUTING.md for help
with compiling PyTorch from source.
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

                              !! WARNING !!
</code></pre>
<p>I had a quick look at the <a href="https://pytorch.org/docs/1.4.0/_modules/torch/utils/cpp_extension.html" rel="nofollow noopener">source code</a> of <code>torch.utils.cpp_extension.py</code> and saw that the accepted compilers on Linux are <code>['g++', 'gcc', 'gnu-c++', 'gnu-cc']</code>. The compiler used to build the extensions on my Linux machine (5.4.33-3-MANJARO) is <code>/usr/bin/c++</code>. The output of <code>c++ --version</code> is <code>c++ (Arch Linux 9.3.0-1) 9.3.0</code>.</p>
<p>Can someone tell me if there is actually an incompatibility between the compilers or if this is a bug in PyTorch?</p>
<p>Thanks a lot!</p>

Jayant_Parashar: <p>I am also getting the same warning with this file address before it :</p>
<pre><code class="lang-auto">../python3.7/site-packages/torch/utils/cpp_extension.py:171: UserWarning

</code></pre>
<p>I think we did not have g++ libraries when we installed pytorch, so it used whatever it found i.e. cpp. Since Pytorch is build on top of g++ for linux. Straightforward solution can be to uninstall and ensure g++ installation first, but I am not sure. If you find a workaround to this problem, let me know.</p>

glaringlee: <p><a class="mention" href="/u/mauropfister">@MauroPfister</a> Normally different compilers should be compatible as long as they follow the same c++ standard. But we can not guarantee this.</p>

MauroPfister: <p>Thanks for the answers <a class="mention" href="/u/jayant_parashar">@Jayant_Parashar</a> and <a class="mention" href="/u/glaringlee">@glaringlee</a>!</p>
<p>I just do not understand why my compiler ( <code>c++ (Arch Linux 9.3.0-1) 9.3.0</code>) is different from <code>gnu-c++</code>? They do not have exactly the same name, but the arch linux package (<a href="https://www.archlinux.org/packages/core/x86_64/gcc/" rel="nofollow noopener">https://www.archlinux.org/packages/core/x86_64/gcc/</a>) says it is the gnu compiler. I do not have much experience in this area though, so I am happy if someone can correct me!</p>

glaringlee: <p><a class="mention" href="/u/mauropfister">@MauroPfister</a><br>
ArchLinux’s compiler does follow the rolling base of GNU, I would say they should be fully compatible. The reason we still give warning is that ArchLinux is a independent linux distribution, their software might contains their own Proprietary software and is not endorsed by the GNU project.</p>