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 in SQLParser.cpp #420

Open
AhmedEleliemy opened this issue Aug 25, 2022 · 8 comments
Open

Error in SQLParser.cpp #420

AhmedEleliemy opened this issue Aug 25, 2022 · 8 comments

Comments

@AhmedEleliemy
Copy link
Collaborator

I am trying to compile daphne. However, I am getting the error below from SQLParser.cpp
@pdamme @corepointer any suggestions??

In file included from /daphne/src/parser/sql/SQLVisitor.h:19,
from /daphne/src/parser/sql/SQLParser.cpp:19:
/daphne/src/parser/ParserUtils.h: In member function 'mlir::Value ParserUtils::valueOrError(antlrcpp::Any)':
/daphne/src/parser/ParserUtils.h:209:14: error: 'using Any = class std::any' {aka 'class std::any'} has no member named 'is'
209 | if(a.ismlir::Value())
| ^~
/daphne/src/parser/ParserUtils.h:209:28: error: expected primary-expression before '>' token
209 | if(a.ismlir::Value())
| ^
/daphne/src/parser/ParserUtils.h:209:30: error: expected primary-expression before ')' token
209 | if(a.ismlir::Value())
| ^
/daphne/src/parser/ParserUtils.h:210:22: error: 'using Any = class std::any' {aka 'class std::any'} has no member named 'as'
210 | return a.asmlir::Value();
| ^~
/daphne/src/parser/ParserUtils.h:210:36: error: expected primary-expression before '>' token
210 | return a.asmlir::Value();
| ^
/daphne/src/parser/ParserUtils.h:210:38: error: expected primary-expression before ')' token
210 | return a.asmlir::Value();
| ^
/daphne/src/parser/sql/SQLParser.cpp: In member function 'mlir::Value SQLParser::parseStreamFrame(mlir::OpBuilder&, std::istream&, const string&)':
/daphne/src/parser/sql/SQLParser.cpp:52:14: error: 'using Any = class std::any' {aka 'class std::any'} has no member named 'is'
52 | if(a.ismlir::Value()){
| ^~
/daphne/src/parser/sql/SQLParser.cpp:52:28: error: expected primary-expression before '>' token
52 | if(a.ismlir::Value()){
| ^
/daphne/src/parser/sql/SQLParser.cpp:52:30: error: expected primary-expression before ')' token
52 | if(a.ismlir::Value()){
| ^
/daphne/src/parser/sql/SQLParser.cpp:53:20: error: 'using Any = class std::any' {aka 'class std::any'} has no member named 'as'
53 | return a.asmlir::Value();
| ^~
/daphne/src/parser/sql/SQLParser.cpp:53:34: error: expected primary-expression before '>' token
53 | return a.asmlir::Value();
| ^
/daphne/src/parser/sql/SQLParser.cpp:53:36: error: expected primary-expression before ')' token
53 | return a.asmlir::Value();
| ^
[44/93] Building CXX object src/parser/sql/CMakeFiles/SQLParser.dir/SQLVisitor.cpp.o
FAILED: src/parser/sql/CMakeFiles/SQLParser.dir/SQLVisitor.cpp.o
/usr/bin/c++ -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/daphne/thirdparty/llvm-project/llvm/include -I/daphne/thirdparty/build/llvm-project/include -I/daphne/thirdparty/llvm-project/mlir/include -I/daphne/thirdparty/build/llvm-project/tools/mlir/include -I/daphne/thirdparty/installed/include -I/daphne/thirdparty/installed/include/openblas -I/daphne/src -I/daphne/build/src -I/daphne/build -I/daphne/thirdparty/installed/include/antlr4-runtime -I/daphne/build/antlr4_generated_src/SQLGrammar -fPIC -fvisibility-inlines-hidden -Werror=date-time -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -Wimplicit-fallthrough -Wno-class-memaccess -Wno-redundant-move -Wno-pessimizing-move -Wno-noexcept-type -Wdelete-non-virtual-dtor -Wsuggest-override -Wno-comment -Wmisleading-indentation -fdiagnostics-color -ffunction-sections -fdata-sections -O3 -DNDEBUG -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -std=gnu++17 -MD -MT src/parser/sql/CMakeFiles/SQLParser.dir/SQLVisitor.cpp.o -MF src/parser/sql/CMakeFiles/SQLParser.dir/SQLVisitor.cpp.o.d -o src/parser/sql/CMakeFiles/SQLParser.dir/SQLVisitor.cpp.o -c /daphne/src/parser/sql/SQLVisitor.cpp
In file included from /daphne/src/parser/sql/SQLVisitor.h:19,
from /daphne/src/parser/sql/SQLVisitor.cpp:19:
/daphne/src/parser/ParserUtils.h: In member function 'mlir::Value ParserUtils::valueOrError(antlrcpp::Any)':
/daphne/src/parser/ParserUtils.h:209:14: error: 'using Any = class std::any' {aka 'class std::any'} has no member named 'is'
209 | if(a.ismlir::Value())
| ^~
/daphne/src/parser/ParserUtils.h:209:28: error: expected primary-expression before '>' token
209 | if(a.ismlir::Value())
| ^
/daphne/src/parser/ParserUtils.h:209:30: error: expected primary-expression before ')' token
209 | if(a.ismlir::Value())
| ^
/daphne/src/parser/ParserUtils.h:210:22: error: 'using Any = class std::any' {aka 'class std::any'} has no member named 'as'
210 | return a.asmlir::Value();
| ^~
/daphne/src/parser/ParserUtils.h:210:36: error: expected primary-expression before '>' token
210 | return a.asmlir::Value();
| ^
/daphne/src/parser/ParserUtils.h:210:38: error: expected primary-expression before ')' token
210 | return a.asmlir::Value();
| ^
/daphne/src/parser/sql/SQLVisitor.cpp: In member function 'virtual antlrcpp::Any SQLVisitor::visitGroupByClause(SQLGrammarParser::GroupByClauseContext*)':
/daphne/src/parser/sql/SQLVisitor.cpp:660:53: error: no match for 'operator=' (operand types are 'mlir::Value' and 'std::any')
660 | currentFrame = visit(ctx->havingClause());
| ^
In file included from /daphne/thirdparty/llvm-project/mlir/include/mlir/IR/BlockSupport.h:16,
from /daphne/thirdparty/llvm-project/mlir/include/mlir/IR/OperationSupport.h:18,
from /daphne/thirdparty/llvm-project/mlir/include/mlir/IR/Dialect.h:16,
from /daphne/thirdparty/llvm-project/mlir/include/mlir/IR/OpDefinition.h:22,
from /daphne/thirdparty/llvm-project/mlir/include/mlir/Interfaces/ControlFlowInterfaces.h:17,
from /daphne/src/ir/daphneir/Daphne.h:22,
from /daphne/src/parser/sql/SQLVisitor.cpp:18:
/daphne/thirdparty/llvm-project/mlir/include/mlir/IR/Value.h:86:10: note: candidate: 'constexpr mlir::Value& mlir::Value::operator=(const mlir::Value&)'
86 | Value &operator=(const Value &) = default;
| ^~~~~~~~
/daphne/thirdparty/llvm-project/mlir/include/mlir/IR/Value.h:86:20: note: no known conversion for argument 1 from 'std::any' to 'const mlir::Value&'
86 | Value &operator=(const Value &) = default;

@pdamme
Copy link
Collaborator

pdamme commented Aug 25, 2022

Hi @AhmedEleliemy, unfortunately, I cannot reprocude this problem. With the lastest commit on main, the build succeeds and tests pass on my system. Based on the error output, I suspect that something is going wrong with ANTLR. Have you tried cleaing all dependencies and rebuilding, i.e., ./build.sh --cleanAll && ./build.sh?

@corepointer
Copy link
Collaborator

I can reproduce if I specify ANTLR 4.9.3 in build.sh. Did you modify build.sh or could it be that some other ANTLR installed on your system is interfering ?

@corepointer
Copy link
Collaborator

If you were trying out 4.9.3 and switched back to 4.9.2 in build.sh you also need to remove the install_success file for it to get reinstalled ;-)

rm thirdparty/antlr_v4.9.2.install.success 

@DerSchmidt
Copy link
Collaborator

DerSchmidt commented Aug 25, 2022

There is actually a bug too.
In line 660 of the SQLVisitor.cpp is the only occurrence of an implicit cast of antlrcpp::Any to mlir::Value.
All the other times, the ParserUtils function valueOrError() is used.
I am working on it!

@AhmedEleliemy
Copy link
Collaborator Author

AhmedEleliemy commented Aug 26, 2022

@pdamme @corepointer @DerSchmidt thank you all.
Regarding the antlr version yes it is not 4.9.2. I tried to build daphe with this version but I got an error and after tracig it, I found that the error is because of compiling with GCC 11. I also found that switching to 4.10.1 fixes the error.
@corepointer when i switched to 4.10.1, I deleted the thirdparty folder before recompilig. So deleting antlr_v4.9.2.install.success is not the issue in my case. I will try now. 4.9.3
@corepointer @pdamme @DerSchmidt what is your version of GCC?
@DerSchmidt I switched to the new branch but I still get the same issue.
First error found to be in daphne/src/parser/ParserUtils.h:
daphne/src/parser/ParserUtils.h: In member function 'mlir::Value ParserUtils::valueOrError(antlrcpp::Any)':
/daphne/src/parser/ParserUtils.h:209:14: error: 'using Any = class std::any' {aka 'class std::any'} has no member named 'is'
if(a.ismlir::Value())
AnySuggetsion?

@corepointer
Copy link
Collaborator

I just checked out @DerSchmidt 's PR #422 which seems to be doing fine. I'll merge it soon©

Before change #422: ANTLR 4.9.2 == good, ANTLR 4.9.3 == bad.

  • I have (in the past) compiled successfully with GCC 8 through 12. Latest code base compiles just fine on Ubuntu 20/22 (GCC 9.4, 11.2) and Manjaro (GCC 12.1)
  • Please stay away from GCC versions before 5 due to ABI changes that can cause all sorts of problems [1]

[1] https://gcc.gnu.org/wiki/Cxx11AbiCompatibility

@DerSchmidt
Copy link
Collaborator

ANTLR4 is switching from using its own Any implementation to std::any. Std::any however doesn't support is() and as(). This change is from ANTLR Version 4.10 onwards.
So the question is why switching to 4.10.1 "fixes" the error when it should cause it.

@corepointer
Copy link
Collaborator

When @AhmedEleliemy said he recompiled everything with 4.10.1 because he has troubles with GCC 11 I automatically assumed this to be a reference to the GCC version aswell. But there's no GCC 4.10. My bad 😇

corepointer added a commit that referenced this issue Aug 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants