mirror of
https://github.com/zebrajr/pytorch.git
synced 2025-12-06 12:20:52 +01:00
[CPP] Update GCC minversion check to 9 or newer (#120126)
It's already a requirement for building PyTorch, but should be a requirement for linking extensions with it, as that can lead to runtime crashes, as `std::optional` template layout is incompatible between gcc-9 and older compilers. Also, update minimum supported clang version to 9.x(used to build Android), as clang-5 is clearly not C++17 compliant. Fixes https://github.com/pytorch/pytorch/issues/120020 Pull Request resolved: https://github.com/pytorch/pytorch/pull/120126 Approved by: https://github.com/Skylion007
This commit is contained in:
parent
48bdd0fb47
commit
3ad067fe2b
|
|
@ -158,7 +158,7 @@ They require JetPack 4.2 and above, and [@dusty-nv](https://github.com/dusty-nv)
|
|||
#### Prerequisites
|
||||
If you are installing from source, you will need:
|
||||
- Python 3.8 or later (for Linux, Python 3.8.1+ is needed)
|
||||
- A compiler that fully supports C++17, such as clang or gcc (especially for aarch64, gcc 9.4.0 or newer is required)
|
||||
- A compiler that fully supports C++17, such as clang or gcc (gcc 9.4.0 or newer is required)
|
||||
|
||||
We highly recommend installing an [Anaconda](https://www.anaconda.com/download) environment. You will get a high-quality BLAS library (MKL) and you get controlled dependency versions regardless of your Linux distro.
|
||||
|
||||
|
|
|
|||
|
|
@ -8,6 +8,17 @@
|
|||
#include <type_traits>
|
||||
#include <utility>
|
||||
|
||||
#if !defined(__clang__) && !defined(_MSC_VER) && defined(__GNUC__) && \
|
||||
__GNUC__ < 9
|
||||
#error \
|
||||
"You're trying to build PyTorch with a too old version of GCC. We need GCC 9 or later."
|
||||
#endif
|
||||
|
||||
#if defined(__clang__) && __clang_major__ < 9
|
||||
#error \
|
||||
"You're trying to build PyTorch with a too old version of Clang. We need Clang 9 or later."
|
||||
#endif
|
||||
|
||||
#if (defined(_MSC_VER) && (!defined(_MSVC_LANG) || _MSVC_LANG < 201703L)) || \
|
||||
(!defined(_MSC_VER) && __cplusplus < 201703L)
|
||||
#error You need C++17 to compile PyTorch
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user