<h2 dir="auto"><g-emoji class="g-emoji" alias="bug" fallback-src="https://github.githubassets.com/images/icons/emoji/unicode/1f41b.png">🐛</g-emoji> Bug</h2>
<p dir="auto">I'm trying to build PyTorch 1.2.0 from source. The CMake phase passes successfully, but building fails.</p>
<h2 dir="auto">To Reproduce</h2>
<p dir="auto">Steps to reproduce the behavior:</p>
<div class="highlight highlight-text-shell-session notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="$ python setup.py build
In file included from nt/c/scratch/sciteam/stewart1/spack-stage/spack-stage-faGxK3/spack-src/c10/util/typeid.h:24:0^[[K,
                 from nt/c/scratch/sciteam/stewart1/spack-stage/spack-stage-faGxK3/spack-src/c10/core/DefaultDtype.cpp:1^[[K:
nt/c/scratch/sciteam/stewart1/spack-stage/spack-stage-faGxK3/spack-src/c10/util/Half.h:^[[K':
nt/c/scratch/sciteam/stewart1/spack-stage/spack-stage-faGxK3/spack-src/c10/util/Half.h:106:56:^[[K' was not declared in this scope
           const uint32_t sign = w &amp; UINT32_C(0x80000000);
^[[K
nt/c/scratch/sciteam/stewart1/spack-stage/spack-stage-faGxK3/spack-src/c10/util/Half.h:138:72:^[[K' was not declared in this scope
             ((int32_t)(nonsign + 0x04000000) &gt;&gt; 8) &amp; INT32_C(0x7F800000);
^[[K
nt/c/scratch/sciteam/stewart1/spack-stage/spack-stage-faGxK3/spack-src/c10/util/Half.h:^[[K':
nt/c/scratch/sciteam/stewart1/spack-stage/spack-stage-faGxK3/spack-src/c10/util/Half.h:197:56:^[[K' was not declared in this scope
           const uint32_t sign = w &amp; UINT32_C(0x80000000);
^[[K
In file included from nt/c/scratch/sciteam/stewart1/spack-stage/spack-stage-faGxK3/spack-src/c10/util/typeid.h:24:0^[[K,
                 from nt/c/scratch/sciteam/stewart1/spack-stage/spack-stage-faGxK3/spack-src/c10/core/DefaultDtype.cpp:1^[[K:
nt/c/scratch/sciteam/stewart1/spack-stage/spack-stage-faGxK3/spack-src/c10/util/Half.h:_fp32_value(float)^[[K':
nt/c/scratch/sciteam/stewart1/spack-stage/spack-stage-faGxK3/spack-src/c10/util/Half.h:308:56:^[[K' was not declared in this scope
           const uint32_t sign = w &amp; UINT32_C(0x80000000);
^[[K
nt/c/scratch/sciteam/stewart1/spack-stage/spack-stage-faGxK3/spack-src/c10/util/Half.h:319:81:^[[K' was not declared in this scope
           return (sign &gt;&gt; 16) | (shl1_w &gt; UINT32_C(0xFF000000) ? UINT16_C(0x7E00) : nonsign);
^[[K
[  4%] Generating python/data_parallel_model.py
gmake[2]: *** [c10/CMakeFiles/c10.dir/core/DefaultDtype.cpp.o] Error 1
gmake[1]: *** [c10/CMakeFiles/c10.dir/all] Error 2
gmake[1]: *** Waiting for unfinished jobs...."><pre class="notranslate">$ <span class="pl-s1">python setup.py build</span>
<span class="pl-c1">In file included from nt/c/scratch/sciteam/stewart1/spack-stage/spack-stage-faGxK3/spack-src/c10/util/typeid.h:24:0^[[K,</span>
<span class="pl-c1">                 from nt/c/scratch/sciteam/stewart1/spack-stage/spack-stage-faGxK3/spack-src/c10/core/DefaultDtype.cpp:1^[[K:</span>
<span class="pl-c1">nt/c/scratch/sciteam/stewart1/spack-stage/spack-stage-faGxK3/spack-src/c10/util/Half.h:^[[K':</span>
<span class="pl-c1">nt/c/scratch/sciteam/stewart1/spack-stage/spack-stage-faGxK3/spack-src/c10/util/Half.h:106:56:^[[K' was not declared in this scope</span>
<span class="pl-c1">           const uint32_t sign = w &amp; UINT32_C(0x80000000);</span>
<span class="pl-c1">^[[K</span>
<span class="pl-c1">nt/c/scratch/sciteam/stewart1/spack-stage/spack-stage-faGxK3/spack-src/c10/util/Half.h:138:72:^[[K' was not declared in this scope</span>
<span class="pl-c1">             ((int32_t)(nonsign + 0x04000000) &gt;&gt; 8) &amp; INT32_C(0x7F800000);</span>
<span class="pl-c1">^[[K</span>
<span class="pl-c1">nt/c/scratch/sciteam/stewart1/spack-stage/spack-stage-faGxK3/spack-src/c10/util/Half.h:^[[K':</span>
<span class="pl-c1">nt/c/scratch/sciteam/stewart1/spack-stage/spack-stage-faGxK3/spack-src/c10/util/Half.h:197:56:^[[K' was not declared in this scope</span>
<span class="pl-c1">           const uint32_t sign = w &amp; UINT32_C(0x80000000);</span>
<span class="pl-c1">^[[K</span>
<span class="pl-c1">In file included from nt/c/scratch/sciteam/stewart1/spack-stage/spack-stage-faGxK3/spack-src/c10/util/typeid.h:24:0^[[K,</span>
<span class="pl-c1">                 from nt/c/scratch/sciteam/stewart1/spack-stage/spack-stage-faGxK3/spack-src/c10/core/DefaultDtype.cpp:1^[[K:</span>
<span class="pl-c1">nt/c/scratch/sciteam/stewart1/spack-stage/spack-stage-faGxK3/spack-src/c10/util/Half.h:_fp32_value(float)^[[K':</span>
<span class="pl-c1">nt/c/scratch/sciteam/stewart1/spack-stage/spack-stage-faGxK3/spack-src/c10/util/Half.h:308:56:^[[K' was not declared in this scope</span>
<span class="pl-c1">           const uint32_t sign = w &amp; UINT32_C(0x80000000);</span>
<span class="pl-c1">^[[K</span>
<span class="pl-c1">nt/c/scratch/sciteam/stewart1/spack-stage/spack-stage-faGxK3/spack-src/c10/util/Half.h:319:81:^[[K' was not declared in this scope</span>
<span class="pl-c1">           return (sign &gt;&gt; 16) | (shl1_w &gt; UINT32_C(0xFF000000) ? UINT16_C(0x7E00) : nonsign);</span>
<span class="pl-c1">^[[K</span>
<span class="pl-c1">[  4%] Generating python/data_parallel_model.py</span>
<span class="pl-c1">gmake[2]: *** [c10/CMakeFiles/c10.dir/core/DefaultDtype.cpp.o] Error 1</span>
<span class="pl-c1">gmake[1]: *** [c10/CMakeFiles/c10.dir/all] Error 2</span>
<span class="pl-c1">gmake[1]: *** Waiting for unfinished jobs....</span></pre></div>
<h2 dir="auto">Expected behavior</h2>
<p dir="auto">Should build fine.</p>
<h2 dir="auto">Environment</h2>
<ul dir="auto">
<li>PyTorch Version (e.g., 1.0): 1.2.0</li>
<li>OS (e.g., Linux): Cray CNL5</li>
<li>How you installed PyTorch (<code class="notranslate">conda</code>, <code class="notranslate">pip</code>, source): source</li>
<li>Build command you used (if compiling from source): python setup.py build</li>
<li>Python version: 3.7.4</li>
<li>CUDA/cuDNN version: 9.1.85</li>
</ul>
<h2 dir="auto">🐛 Bug</h2>

<h2 dir="auto">To Reproduce</h2>
<p dir="auto">Steps to reproduce the behavior:</p>
<ol dir="auto">
<li>git clone the pytorch repo and all the submodules</li>
<li>Build pytorch with:</li>
</ol>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="export CMAKE_PREFIX_PATH=$LINUXBREWHOME:$LINUXBREWHOME/Cellar/cuda/10.1
export CUDA_HOME=$LINUXBREWHOME/Cellar/cuda/10.1
export BLAS=OpenBLAS
export MAX_JOBS=16
export USE_CUDA=1
export USE_CUDNN=1
export USE_NUMPY=1
export TORCH_CUDA_ARCH_LIST=&quot;6.1;7.5&quot;
export LIBRARY_PATH=$LINUXBREWHOME/lib:$LINUXBREWHOME/Cellar/cuda/10.1/lib
export CC=$LINUXBREWHOME/bin/gcc-5
export CXX=$LINUXBREWHOME/bin/g++-5
python3 setup.py clean
python3 setup.py bdist_wheel"><pre class="notranslate"><code class="notranslate">export CMAKE_PREFIX_PATH=$LINUXBREWHOME:$LINUXBREWHOME/Cellar/cuda/10.1
export CUDA_HOME=$LINUXBREWHOME/Cellar/cuda/10.1
export BLAS=OpenBLAS
export MAX_JOBS=16
export USE_CUDA=1
export USE_CUDNN=1
export USE_NUMPY=1
export TORCH_CUDA_ARCH_LIST="6.1;7.5"
export LIBRARY_PATH=$LINUXBREWHOME/lib:$LINUXBREWHOME/Cellar/cuda/10.1/lib
export CC=$LINUXBREWHOME/bin/gcc-5
export CXX=$LINUXBREWHOME/bin/g++-5
python3 setup.py clean
python3 setup.py bdist_wheel
</code></pre></div>
<p dir="auto">where I have all my compiler toolchain in $LINUXBREWHOME<br>
3. I got this error:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="/home/aznb/.linuxbrew/bin/g++-5  -DHAVE_MALLOC_USABLE_SIZE=1 -DHAVE_MMAP=1 -DHAVE_SHM_OPEN=1 -DHAVE_SHM_UNLINK=1 -DONNX_NAMESPACE=onnx_torch -DUSE_GCC_ATOMICS=1 -D_FILE_OFFSET_BITS=64 -Dc10_EXPORTS -I../aten/src -I. -I../ -I../third_party/protobuf/src -I../cmake/../third_party/benchmark/include -Icaffe2/contrib/aten -I../third_party/onnx -Ithird_party/onnx -I../third_party/foxi -Ithird_party/foxi -I../c10/.. -isystem third_party/gloo -isystem ../cmake/../third_party/gloo -isystem ../cmake/../third_party/googletest/googlemock/include -isystem ../cmake/../third_party/googletest/googletest/include -isystem ../third_party/gemmlowp -isystem ../third_party/neon2sse -isystem ../third_party -isystem /usr/include -isystem ../cmake/../third_party/eigen -isystem /home/aznb/.linuxbrew/Cellar/python/3.7.4/include/python3.7m -isystem /home/aznb/.linuxbrew/Cellar/python/3.7.4/lib/python3.7/site-packages/numpy/core/include -isystem ../cmake/../third_party/pybind11/include -isystem /home/aznb/.linuxbrew/Cellar/open-mpi/4.0.1_1/include -isystem ../third_party/ideep/mkl-dnn/include -isystem ../third_party/ideep/include -isystem ../third_party/ideep/mkl-dnn/external/mklml_lnx_2019.0.3.20190220/include -Wno-deprecated -fvisibility-inlines-hidden -fopenmp -DUSE_FBGEMM -O2 -fPIC -Wno-narrowing -Wall -Wextra -Wno-missing-field-initializers -Wno-type-limits -Wno-array-bounds -Wno-unknown-pragmas -Wno-sign-compare -Wno-unused-parameter -Wno-unused-variable -Wno-unused-function -Wno-unused-result -Wno-strict-overflow -Wno-strict-aliasing -Wno-error=deprecated-declarations -Wno-error=pedantic -Wno-error=redundant-decls -Wno-error=old-style-cast -Wno-unused-but-set-variable -Wno-maybe-uninitialized -fno-math-errno -fno-trapping-math -O3  -fPIC   -DCAFFE2_USE_GLOO -DCUDA_HAS_FP16=1 -DHAVE_GCC_GET_CPUID -DUSE_AVX -DUSE_AVX2 -DTH_HAVE_THREAD -DC10_BUILD_MAIN_LIB -fvisibility=hidden -std=gnu++11 -MD -MT c10/CMakeFiles/c10.dir/core/CPUAllocator.cpp.o -MF c10/CMakeFiles/c10.dir/core/CPUAllocator.cpp.o.d -o c10/CMakeFiles/c10.dir/core/CPUAllocator.cpp.o -c ../c10/core/CPUAllocator.cpp
In file included from ../c10/util/typeid.h:24:0,
                 from ../c10/core/CPUAllocator.cpp:2:
../c10/util/Half.h: In function 'uint32_t c10::detail::fp16_ieee_to_fp32_bits(uint16_t)':
../c10/util/Half.h:107:56: error: 'UINT32_C' was not declared in this scope
           const uint32_t sign = w &amp; UINT32_C(0x80000000);
                                                        ^
../c10/util/Half.h:139:72: error: 'INT32_C' was not declared in this scope
             ((int32_t)(nonsign + 0x04000000) &gt;&gt; 8) &amp; INT32_C(0x7F800000);
                                                                        ^
../c10/util/Half.h: In function 'float c10::detail::fp16_ieee_to_fp32_value(uint16_t)':
../c10/util/Half.h:198:56: error: 'UINT32_C' was not declared in this scope
           const uint32_t sign = w &amp; UINT32_C(0x80000000);"><pre class="notranslate"><code class="notranslate">/home/aznb/.linuxbrew/bin/g++-5  -DHAVE_MALLOC_USABLE_SIZE=1 -DHAVE_MMAP=1 -DHAVE_SHM_OPEN=1 -DHAVE_SHM_UNLINK=1 -DONNX_NAMESPACE=onnx_torch -DUSE_GCC_ATOMICS=1 -D_FILE_OFFSET_BITS=64 -Dc10_EXPORTS -I../aten/src -I. -I../ -I../third_party/protobuf/src -I../cmake/../third_party/benchmark/include -Icaffe2/contrib/aten -I../third_party/onnx -Ithird_party/onnx -I../third_party/foxi -Ithird_party/foxi -I../c10/.. -isystem third_party/gloo -isystem ../cmake/../third_party/gloo -isystem ../cmake/../third_party/googletest/googlemock/include -isystem ../cmake/../third_party/googletest/googletest/include -isystem ../third_party/gemmlowp -isystem ../third_party/neon2sse -isystem ../third_party -isystem /usr/include -isystem ../cmake/../third_party/eigen -isystem /home/aznb/.linuxbrew/Cellar/python/3.7.4/include/python3.7m -isystem /home/aznb/.linuxbrew/Cellar/python/3.7.4/lib/python3.7/site-packages/numpy/core/include -isystem ../cmake/../third_party/pybind11/include -isystem /home/aznb/.linuxbrew/Cellar/open-mpi/4.0.1_1/include -isystem ../third_party/ideep/mkl-dnn/include -isystem ../third_party/ideep/include -isystem ../third_party/ideep/mkl-dnn/external/mklml_lnx_2019.0.3.20190220/include -Wno-deprecated -fvisibility-inlines-hidden -fopenmp -DUSE_FBGEMM -O2 -fPIC -Wno-narrowing -Wall -Wextra -Wno-missing-field-initializers -Wno-type-limits -Wno-array-bounds -Wno-unknown-pragmas -Wno-sign-compare -Wno-unused-parameter -Wno-unused-variable -Wno-unused-function -Wno-unused-result -Wno-strict-overflow -Wno-strict-aliasing -Wno-error=deprecated-declarations -Wno-error=pedantic -Wno-error=redundant-decls -Wno-error=old-style-cast -Wno-unused-but-set-variable -Wno-maybe-uninitialized -fno-math-errno -fno-trapping-math -O3  -fPIC   -DCAFFE2_USE_GLOO -DCUDA_HAS_FP16=1 -DHAVE_GCC_GET_CPUID -DUSE_AVX -DUSE_AVX2 -DTH_HAVE_THREAD -DC10_BUILD_MAIN_LIB -fvisibility=hidden -std=gnu++11 -MD -MT c10/CMakeFiles/c10.dir/core/CPUAllocator.cpp.o -MF c10/CMakeFiles/c10.dir/core/CPUAllocator.cpp.o.d -o c10/CMakeFiles/c10.dir/core/CPUAllocator.cpp.o -c ../c10/core/CPUAllocator.cpp
In file included from ../c10/util/typeid.h:24:0,
                 from ../c10/core/CPUAllocator.cpp:2:
../c10/util/Half.h: In function 'uint32_t c10::detail::fp16_ieee_to_fp32_bits(uint16_t)':
../c10/util/Half.h:107:56: error: 'UINT32_C' was not declared in this scope
           const uint32_t sign = w &amp; UINT32_C(0x80000000);
                                                        ^
../c10/util/Half.h:139:72: error: 'INT32_C' was not declared in this scope
             ((int32_t)(nonsign + 0x04000000) &gt;&gt; 8) &amp; INT32_C(0x7F800000);
                                                                        ^
../c10/util/Half.h: In function 'float c10::detail::fp16_ieee_to_fp32_value(uint16_t)':
../c10/util/Half.h:198:56: error: 'UINT32_C' was not declared in this scope
           const uint32_t sign = w &amp; UINT32_C(0x80000000);
</code></pre></div>

<h2 dir="auto">Expected behavior</h2>
<p dir="auto">pytorch build successfully</p>
<h2 dir="auto">Environment</h2>
<ul dir="auto">
<li>PyTorch Version (e.g., 1.0): 1.1.0</li>
<li>OS (e.g., Linux): centos 6.9</li>
<li>How you installed PyTorch (<code class="notranslate">conda</code>, <code class="notranslate">pip</code>, source): source</li>
<li>Build command you used (if compiling from source): see above</li>
<li>Python version: 3.7.4</li>
<li>CUDA/cuDNN version: 10.1/7.6.2</li>
<li>GPU models and configuration: GTX 1080</li>
<li>Any other relevant information:</li>
</ul>
<h2 dir="auto">Additional context</h2>
<p dir="auto">gcc has it's definition for INT32_C in stdint-gcc.h. If I add #include &lt;stdint-gcc.h&gt; to c10/util/Half.h then it compiles fine</p>