Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when compiling with GCC 7 #63843

Closed
Diana-Dubov opened this issue Jul 13, 2023 · 19 comments
Closed

Error when compiling with GCC 7 #63843

Diana-Dubov opened this issue Jul 13, 2023 · 19 comments
Assignees

Comments

@Diana-Dubov
Copy link

Diana-Dubov commented Jul 13, 2023

According to llvm documentation it shall [support GCC 7] (https://llvm.org/docs/GettingStarted.html#host-c-toolchain-both-compiler-and-standard-library).
This commit: [ADT] Add deduction guide for iterator_range breaks it.
Getting this error when compiling with GCC7.4:

     std::void_t<decltype(static_cast<To>(
                          ^~~~~~~~~~~~~~~~
         std::declval<std::add_rvalue_reference_t<From>>()))>> : std::true_type {
         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from external/llvm-project/mlir/include/mlir/Support/TypeID.h:20:0,
                 from external/llvm-project/mlir/include/mlir/IR/MLIRContext.h:13,
                 from external/llvm-project/mlir/include/mlir/IR/DialectRegistry.h:16,
                 from external/llvm-project/mlir/include/mlir/IR/Dialect.h:16,
                 from external/llvm-project/mlir/include/mlir/IR/OpDefinition.h:22,
                 from external/llvm-project/mlir/include/mlir/IR/Builders.h:12,
                 from external/llvm-project/mlir/include/mlir/IR/PatternMatch.h:12,
                 from external/llvm-project/mlir/lib/IR/PatternMatch.cpp:9:
external/llvm-project/llvm/include/llvm/ADT/STLExtras.h:399:3: note: candidate: llvm::mapped_iterator_base<DerivedT, ItTy, ReferenceTy>::mapped_iterator_base(ItTy) [with DerivedT = mlir::ValueTypeIterator<llvm::detail::indexed_accessor_range_base<mlir::ResultRange, mlir::detail::OpResultImpl*, mlir::OpResult, mlir::OpResult, mlir::OpResult>::iterator>; ItTy = llvm::detail::indexed_accessor_range_base<mlir::ResultRange, mlir::detail::OpResultImpl*, mlir::OpResult, mlir::OpResult, mlir::OpResult>::iterator; ReferenceTy = mlir::Type]
   mapped_iterator_base(ItTy U)

It is fixed in GCC8 and later, but the issue at GCC7 exists and breaks the promise to support this version.

Thank you

@llvmbot
Copy link
Collaborator

llvmbot commented Jul 13, 2023

@llvm/issue-subscribers-mlir

@Diana-Dubov
Copy link
Author

@steakhal can you please take a look?

@joker-eph
Copy link
Collaborator

@Diana-Dubov I left a comment in the revision, this is the most usual way to signal that something is broken.

@steakhal
Copy link
Contributor

I'll look at this on the weekend.

@steakhal
Copy link
Contributor

Here is a partial revert "fix" for the build, by removing the SFINAE constraint and putting back the TODO which was originally there.
https://reviews.llvm.org/D155441

@steakhal steakhal self-assigned this Jul 17, 2023
@unterumarmung
Copy link
Contributor

Why not just ifdef it on the version of the compiler?
I mean, if someone writes a code that doesn't satisfy SFINAE with GCC7, then there will be compiler-error in the CI

@steakhal
Copy link
Contributor

Please reply to the patch. I don't usually monitor Github notifications.

Why not just ifdef it on the version of the compiler?
I mean, if someone writes a code that doesn't satisfy SFINAE with GCC7, then there will be compiler-error in the CI

Accommodated the patch according to this.

jdoerfert pushed a commit to jdoerfert/llvm-project that referenced this issue Jul 24, 2023
It turns out the SFINAE constraint breaks building MLIR using GCC-7,
which is an outdated, but supported compiler by llvm-project.

I tried to find a solution for fixing it, but I decided to cut branches
and just simply remove the SFINAE constraint until we drop GCC-7.
It was originally introduced by D152891.

Allegedly, GCC-8 and above builds just fine.
I tested GCC 8.4.0, and GCC 7.5.0, and now builds fine on both.

Differential Revision: https://reviews.llvm.org/D155441

Fixes llvm#63843
@MaskRay
Copy link
Member

MaskRay commented Jul 26, 2023

Not for this specific instance, but in general I suspect that 7.4 may not be good enough to build llvm-project, and we may require 7.5.

I created Require GCC>=7.5 as GCC 7.3 cannot build llvm.

@loongknown
Copy link

Here is a partial revert "fix" for the build, by removing the SFINAE constraint and putting back the TODO which was originally there. https://reviews.llvm.org/D155441

However, the issue still exists in the KylinV10 system.My gcc version is gcc8.3.0.

@loongknown
Copy link

However, the issue still exists in the KylinV10 system.My gcc version is gcc8.3.0.

@steakhal
Copy link
Contributor

However, the issue still exists in the KylinV10 system.My gcc version is gcc8.3.0.

Do you imply that we should check #if __GNUC__ == 8 instead?
Could you clarify your expectations @loongknown?

@joker-eph
Copy link
Collaborator

We have a gcc 7.5 bot here FYI: https://lab.llvm.org/buildbot/#/builders/264

@steakhal
Copy link
Contributor

We have a gcc 7.5 bot here FYI: https://lab.llvm.org/buildbot/#/builders/264

Thanks Mehdi! Then it seems like it should build on that version of gcc (GNU 7.5.0). 🤔

@loongknown
Copy link

Could you clarify your expectations

My operating system is KylinV10, and my GCC version is 8.5.0. I hope to successfully compile LLVM.

@joker-eph
Copy link
Collaborator

Please file another bug with detailed instruction on your environment, the sequence of commands you ran, and join the detailed log that lead to the error.

@loongknown
Copy link

loongknown commented Feb 19, 2024

@joker-eph
my gcc version is 8.3.0 and my os is ubuntu/centos/kylin/debian.The compilation command is as follows:
cmake -G "Unix Makefiles" ../llvm
-DLLVM_ENABLE_PROJECTS="mlir"
-DCMAKE_BUILD_TYPE=Release
-DLLVM_TARGETS_TO_BUILD="X86"
make -j 32
The error message is as follows:

/home/dongshuai/test/llvm-project/llvm/include/llvm/ADT/iterator_range.h:33:26: error: no matching function for call to ‘llvm::detail::indexed_accessor_range_base<mlir::ValueRange, llvm::PointerUnion<const mlir::Value*, mlir::OpOperand*, mlir::detail::OpResultImpl*>, mlir::Value, mlir::Value, mlir::Value>::iterator::iterator(llvm::detail::indexed_accessor_range_base<mlir::ResultRange, mlir::detail::OpResultImpl*, mlir::OpResult, mlir::OpResult, mlir::OpResult>::iterator)’
std::void_t<decltype(static_cast(
^~~~~~~~~~~~~~~~
std::declval<std::add_rvalue_reference_t>()))>> : std::true_type {
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /home/dongshuai/test/llvm-project/mlir/include/mlir/Support/TypeID.h:20,
from /home/dongshuai/test/llvm-project/mlir/include/mlir/IR/MLIRContext.h:13,
from /home/dongshuai/test/llvm-project/mlir/include/mlir/IR/DialectRegistry.h:16,
from /home/dongshuai/test/llvm-project/mlir/include/mlir/IR/Dialect.h:16,
from /home/dongshuai/test/llvm-project/mlir/lib/IR/Dialect.cpp:9:
/home/dongshuai/test/llvm-project/llvm/include/llvm/ADT/STLExtras.h:1262:5: note: candidate: ‘llvm::detail::indexed_accessor_range_base<DerivedT, BaseT, T, PointerT, ReferenceT>::iterator::iterator(BaseT, ptrdiff_t) [with DerivedT = mlir::ValueRange; BaseT = llvm::PointerUnion<const mlir::Value*, mlir::OpOperand*, mlir::detail::OpResultImpl*>; T = mlir::Value; PointerT = mlir::Value; ReferenceT = mlir::Value; ptrdiff_t = long int]’
iterator(BaseT owner, ptrdiff_t curIndex)
^~~~~~~~
/home/dongshuai/test/llvm-project/llvm/include/llvm/ADT/STLExtras.h:1262:5: note: candidate expects 2 arguments, 1 provided
/home/dongshuai/test/llvm-project/llvm/include/llvm/ADT/STLExtras.h:1253:9: note: candidate: ‘constexpr llvm::detail::indexed_accessor_range_base<mlir::ValueRange, llvm::PointerUnion<const mlir::Value*, mlir::OpOperand*, mlir::detail::OpResultImpl*>, mlir::Value, mlir::Value, mlir::Value>::iterator::iterator(const llvm::detail::indexed_accessor_range_base<mlir::ValueRange, llvm::PointerUnion<const mlir::Value*, mlir::OpOperand*, mlir::detail::OpResultImpl*>, mlir::Value, mlir::Value, mlir::Value>::iterator&)’
class iterator : public indexed_accessor_iterator<iterator, BaseT, T,
^~~~~~~~
/home/dongshuai/test/llvm-project/llvm/include/llvm/ADT/STLExtras.h:1253:9: note: no known conversion for argument 1 from ‘llvm::detail::indexed_accessor_range_base<mlir::ResultRange, mlir::detail::OpResultImpl*, mlir::OpResult, mlir::OpResult, mlir::OpResult>::iterator’ to ‘const llvm::detail::indexed_accessor_range_base<mlir::ValueRange, llvm::PointerUnion<const mlir::Value*, mlir::OpOperand*, mlir::detail::OpResultImpl*>, mlir::Value, mlir::Value, mlir::Value>::iterator&’
/home/dongshuai/test/llvm-project/llvm/include/llvm/ADT/STLExtras.h:1253:9: note: candidate: ‘constexpr llvm::detail::indexed_accessor_range_base<mlir::ValueRange, llvm::PointerUnion<const mlir::Value*, mlir::OpOperand*, mlir::detail::OpResultImpl*>, mlir::Value, mlir::Value, mlir::Value>::iterator::iterator(llvm::detail::indexed_accessor_range_base<mlir::ValueRange, llvm::PointerUnion<const mlir::Value*, mlir::OpOperand*, mlir::detail::OpResultImpl*>, mlir::Value, mlir::Value, mlir::Value>::iterator&&)’
/home/dongshuai/test/llvm-project/llvm/include/llvm/ADT/STLExtras.h:1253:9: note: no known conversion for argument 1 from ‘llvm::detail::indexed_accessor_range_base<mlir::ResultRange, mlir::detail::OpResultImpl*, mlir::OpResult, mlir::OpResult, mlir::OpResult>::iterator’ to ‘llvm::detail::indexed_accessor_range_base<mlir::ValueRange, llvm::PointerUnion<const mlir::Value*, mlir::OpOperand*, mlir::detail::OpResultImpl*>, mlir::Value, mlir::Value, mlir::Value>::iterator&&’
In file included from /home/dongshuai/test/llvm-project/llvm/include/llvm/ADT/iterator.h:12,
from /home/dongshuai/test/llvm-project/llvm/include/llvm/ADT/STLExtras.h:24,
from /home/dongshuai/test/llvm-project/mlir/include/mlir/Support/TypeID.h:20,
from /home/dongshuai/test/llvm-project/mlir/include/mlir/IR/MLIRContext.h:13,
from /home/dongshuai/test/llvm-project/mlir/include/mlir/IR/DialectRegistry.h:16,
from /home/dongshuai/test/llvm-project/mlir/include/mlir/IR/Dialect.h:16,
from /home/dongshuai/test/llvm-project/mlir/lib/IR/Dialect.cpp:9:
/home/dongshuai/test/llvm-project/llvm/include/llvm/ADT/iterator_range.h: In instantiation of ‘struct llvm::explicitly_convertible<const mlir::Type*, llvm::detail::indexed_accessor_range_base<mlir::TypeRange, llvm::PointerUnion<const mlir::Value*, const mlir::Type*, mlir::OpOperand*, mlir::detail::OpResultImpl*>, mlir::Type, mlir::Type, mlir::Type>::iterator, void>’:
/home/dongshuai/test/llvm-project/llvm/include/llvm/ADT/iterator_range.h:53:72: required by substitution of ‘template<class Container, std::enable_if_t<llvm::explicitly_convertible<decltype (llvm::adl_begin(declval<Container&>())), llvm::detail::indexed_accessor_range_base<mlir::TypeRange, llvm::PointerUnion<const mlir::Value*, const mlir::Type*, mlir::OpOperand*, mlir::detail::OpResultImpl*>, mlir::Type, mlir::Type, mlir::Type>::iterator, void>::value, void>* > llvm::iterator_range<llvm::detail::indexed_accessor_range_base<mlir::TypeRange, llvm::PointerUnion<const mlir::Value*, const mlir::Type*, mlir::OpOperand*, mlir::detail::OpResultImpl*>, mlir::Type, mlir::Type, mlir::Type>::iterator>::iterator_range(Container&&) [with Container = llvm::ArrayRefmlir::Type; std::enable_if_t<llvm::explicitly_convertible<decltype (llvm::adl_begin(declval<Container&>())), llvm::detail::indexed_accessor_range_base<mlir::TypeRange, llvm::PointerUnion<const mlir::Value*, const mlir::Type*, mlir::OpOperand*, mlir::detail::OpResultImpl*>, mlir::Type, mlir::Type, mlir::Type>::iterator, void>::value, void>* = ]’
/home/dongshuai/test/llvm-project/mlir/include/mlir/IR/TypeRange.h:51:40: required from here

@joker-eph
Copy link
Collaborator

@loongknown : as instructed above, please open another bug. This bug is closed, and you have a slightly different issue.

(also please include the CMake configuration log, and add these logs as textual file attachment instead of plain text in the description).

@joker-eph
Copy link
Collaborator

@loongknown :
#82643

@loongknown
Copy link

@loongknown : #82643

Have you tested on GCC 8.3.0? Even after applying this patch, I'm still getting compilation errors. The error message is as follows:

/home/dongshuai/test/llvm-project/mlir/lib/Transforms/Utils/CFGToSCF.cpp: In function ‘mlir::FailureOr<llvm::SmallVectormlir::Block* > transformToStructuredCFBranches(mlir::Block*, mlir::function_ref<mlir::Value(unsigned int)>, mlir::function_refmlir::Value(mlir::Type), mlir::CFGToSCFInterface&, mlir::DominanceInfo&)’:
/home/dongshuai/test/llvm-project/mlir/lib/Transforms/Utils/CFGToSCF.cpp:1187:61: error: call of overloaded ‘OperandRange(mlir::MutableOperandRange)’ is ambiguous
getMutableSuccessorOperands(user->getBlock(), 0)));
^
In file included from /home/dongshuai/test/llvm-project/mlir/include/mlir/Support/TypeID.h:20,
from /home/dongshuai/test/llvm-project/mlir/include/mlir/IR/MLIRContext.h:13,
from /home/dongshuai/test/llvm-project/mlir/include/mlir/IR/DialectRegistry.h:16,
from /home/dongshuai/test/llvm-project/mlir/include/mlir/IR/Dialect.h:16,
from /home/dongshuai/test/llvm-project/mlir/include/mlir/IR/OpDefinition.h:22,
from /home/dongshuai/test/llvm-project/mlir/include/mlir/IR/Builders.h:12,
from /home/dongshuai/test/llvm-project/mlir/include/mlir/Transforms/CFGToSCF.h:18,
from /home/dongshuai/test/llvm-project/mlir/lib/Transforms/Utils/CFGToSCF.cpp:116:
/home/dongshuai/test/llvm-project/llvm/include/llvm/ADT/STLExtras.h:1273:3: note: candidate: ‘llvm::detail::indexed_accessor_range_base<DerivedT, BaseT, T, PointerT, ReferenceT>::indexed_accessor_range_base(const llvm::iterator_range<llvm::detail::indexed_accessor_range_base<DerivedT, BaseT, T, PointerT, ReferenceT>::iterator>&) [with DerivedT = mlir::OperandRange; BaseT = mlir::OpOperand*; T = mlir::Value; PointerT = mlir::Value; ReferenceT = mlir::Value]’
indexed_accessor_range_base(const iterator_range &range)
^~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /home/dongshuai/test/llvm-project/mlir/include/mlir/IR/TypeRange.h:18,
from /home/dongshuai/test/llvm-project/mlir/include/mlir/IR/OperationSupport.h:23,
from /home/dongshuai/test/llvm-project/mlir/include/mlir/IR/Dialect.h:17,
from /home/dongshuai/test/llvm-project/mlir/include/mlir/IR/OpDefinition.h:22,
from /home/dongshuai/test/llvm-project/mlir/include/mlir/IR/Builders.h:12,
from /home/dongshuai/test/llvm-project/mlir/include/mlir/Transforms/CFGToSCF.h:18,
from /home/dongshuai/test/llvm-project/mlir/lib/Transforms/Utils/CFGToSCF.cpp:116:
/home/dongshuai/test/llvm-project/mlir/include/mlir/IR/ValueRange.h:44:21: note: inherited here
using RangeBaseT::RangeBaseT;
^~~~~~~~~~
/home/dongshuai/test/llvm-project/mlir/include/mlir/IR/ValueRange.h:41:7: note: candidate: ‘constexpr mlir::OperandRange::OperandRange(const mlir::OperandRange&)’
class OperandRange final : public llvm::detail::indexed_accessor_range_base<
^~~~~~~~~~~~
/home/dongshuai/test/llvm-project/mlir/include/mlir/IR/ValueRange.h:41:7: note: candidate: ‘constexpr mlir::OperandRange::OperandRange(mlir::OperandRange&&)’

veselypeta pushed a commit to veselypeta/cherillvm that referenced this issue Sep 6, 2024
It turns out the SFINAE constraint breaks building MLIR using GCC-7,
which is an outdated, but supported compiler by llvm-project.

I tried to find a solution for fixing it, but I decided to cut branches
and just simply remove the SFINAE constraint until we drop GCC-7.
It was originally introduced by D152891.

Allegedly, GCC-8 and above builds just fine.
I tested GCC 8.4.0, and GCC 7.5.0, and now builds fine on both.

Differential Revision: https://reviews.llvm.org/D155441

Fixes llvm/llvm-project#63843
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants