panda-planner-dev / pandaPIparser

The parser of the pandaPI planning system
BSD 3-Clause "New" or "Revised" License
13 stars 10 forks source link

Error on master build (macOS) #2

Closed Sebastian-G closed 4 years ago

Sebastian-G commented 4 years ago

Hi guys, I'm trying to build the project, but it seems impossible (commit: 46b43aec21e69c0f346d8c4dbc85383d34aa2fb5).

I'm running the build on a MAC, using:

Any ideas if this is a general issue or just an incompatibility of my versions?

➜ make -j           
bison -v -d -o src/hddl.cpp src/hddl.y
src/hddl.y:24.9-19: syntax error, unexpected identifier, expecting string
make: *** [src/hddl.cpp] Error 1
galvusdamor commented 4 years ago

Hi Sebastian,

it seems that your version of bison is very old. Bison 2.3 was published in 2006. Since then a lot of features like the one in line 24 (%define parse.error verbose) were added. I'm currently using bison 3.7.2.

This seems to be a know issue for Mac-Users as the bison version provided by Apple is just outdated. It seems that if you use a brew-version of bison it should work. I can't test this myself unfortunately, as I don't have a Mac. You you try it with brew and report whether it works or not? If it does I'll add a note to the parser's README.

Kind regards, Gregor

Sebastian-G commented 4 years ago

I was able to update it to 3.7.4 LTS but now new errors occur:

is flex also outdated? I changed it to flex 2.6.4


➜ make -j
bison -v -d -o src/hddl.cpp src/hddl.y
flex --yylineno -o src/hddl-token.cpp src/hddl-token.l
g++ -O3 -pipe -Wall -Wextra -pedantic -std=c++17 -DNDEBUG -Wno-unused-parameter  -o src/hddl.o -c src/hddl.cpp
g++ -O3 -pipe -Wall -Wextra -pedantic -std=c++17 -DNDEBUG -Wno-unused-parameter  -o src/main.o -c src/main.cpp
g++ -O3 -pipe -Wall -Wextra -pedantic -std=c++17 -DNDEBUG -Wno-unused-parameter  -o src/sortexpansion.o -c src/sortexpansion.cpp
g++ -O3 -pipe -Wall -Wextra -pedantic -std=c++17 -DNDEBUG -Wno-unused-parameter  -o src/parsetree.o -c src/parsetree.cpp
g++ -O3 -pipe -Wall -Wextra -pedantic -std=c++17 -DNDEBUG -Wno-unused-parameter  -o src/util.o -c src/util.cpp
g++ -O3 -pipe -Wall -Wextra -pedantic -std=c++17 -DNDEBUG -Wno-unused-parameter  -o src/domain.o -c src/domain.cpp
g++ -O3 -pipe -Wall -Wextra -pedantic -std=c++17 -DNDEBUG -Wno-unused-parameter  -o src/output.o -c src/output.cpp
g++ -O3 -pipe -Wall -Wextra -pedantic -std=c++17 -DNDEBUG -Wno-unused-parameter  -o src/parametersplitting.o -c src/parametersplitting.cpp
g++ -O3 -pipe -Wall -Wextra -pedantic -std=c++17 -DNDEBUG -Wno-unused-parameter  -o src/cwa.o -c src/cwa.cpp
g++ -O3 -pipe -Wall -Wextra -pedantic -std=c++17 -DNDEBUG -Wno-unused-parameter  -o src/typeof.o -c src/typeof.cpp
g++ -O3 -pipe -Wall -Wextra -pedantic -std=c++17 -DNDEBUG -Wno-unused-parameter  -o src/shopWriter.o -c src/shopWriter.cpp
g++ -O3 -pipe -Wall -Wextra -pedantic -std=c++17 -DNDEBUG -Wno-unused-parameter  -o src/hpdlWriter.o -c src/hpdlWriter.cpp
g++ -O3 -pipe -Wall -Wextra -pedantic -std=c++17 -DNDEBUG -Wno-unused-parameter  -o src/hddlWriter.o -c src/hddlWriter.cpp
g++ -O3 -pipe -Wall -Wextra -pedantic -std=c++17 -DNDEBUG -Wno-unused-parameter  -o src/orderingDecomposition.o -c src/orderingDecomposition.cpp
g++ -O3 -pipe -Wall -Wextra -pedantic -std=c++17 -DNDEBUG -Wno-unused-parameter  -o src/plan.o -c src/plan.cpp
g++ -O3 -pipe -Wall -Wextra -pedantic -std=c++17 -DNDEBUG -Wno-unused-parameter  -o src/verify.o -c src/verify.cpp
g++ -O3 -pipe -Wall -Wextra -pedantic -std=c++17 -DNDEBUG -Wno-unused-parameter  -o src/properties.o -c src/properties.cpp
g++ -O3 -pipe -Wall -Wextra -pedantic -std=c++17 -DNDEBUG -Wno-unused-parameter  -o src/hddl-token.o -c src/hddl-token.cpp
src/parsetree.cpp:114:1: warning: non-void function does not return a value in all control paths [-Wreturn-type]
}
^
src/hddl-token.cpp:825:2: error: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
        register yy_state_type yy_current_state;
        ^~~~~~~~~
src/hddl-token.cpp:826:2: error: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
        register char *yy_cp, *yy_bp;
        ^~~~~~~~~
src/hddl-token.cpp:826:2: error: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
        register char *yy_cp, *yy_bp;
        ^~~~~~~~~
src/hddl-token.cpp:827:2: error: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
        register int yy_act;
        ^~~~~~~~~
src/hddl-token.cpp:875:4: error: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
                        register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
                        ^~~~~~~~~
src/hddl-token.cpp:1343:6: error: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
        register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
        ^~~~~~~~~
src/hddl-token.cpp:1344:2: error: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
        register char *source = (yytext_ptr);
        ^~~~~~~~~
src/hddl-token.cpp:1345:2: error: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
        register int number_to_move, i;
        ^~~~~~~~~
src/hddl-token.cpp:1345:2: error: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
        register int number_to_move, i;
        ^~~~~~~~~
src/hddl-token.cpp:1477:2: error: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
        register yy_state_type yy_current_state;
        ^~~~~~~~~
src/hddl-token.cpp:1478:2: error: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
        register char *yy_cp;
        ^~~~~~~~~
src/hddl-token.cpp:1484:3: error: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
                register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
                ^~~~~~~~~
src/hddl-token.cpp:1509:2: error: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
        register int yy_is_jam;
        ^~~~~~~~~
src/hddl-token.cpp:1510:6: error: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
        register char *yy_cp = (yy_c_buf_p);
        ^~~~~~~~~
src/hddl-token.cpp:1512:2: error: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
        register YY_CHAR yy_c = 1;
        ^~~~~~~~~
src/hddl-token.cpp:1530:33: error: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
    static void yyunput (int c, register char * yy_bp )
                                ^~~~~~~~~
src/hddl-token.cpp:1532:2: error: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
        register char *yy_cp;
        ^~~~~~~~~
src/hddl-token.cpp:1542:3: error: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
                register yy_size_t number_to_move = (yy_n_chars) + 2;
                ^~~~~~~~~
src/hddl-token.cpp:1543:3: error: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
                register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[
                ^~~~~~~~~
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
make: *** [src/hddl-token.o] Error 1
make: *** Waiting for unfinished jobs....
src/verify.cpp:1464:25: warning: loop variable 'c' of type 'const std::__1::string' (aka 'const basic_string<char, char_traits<char>,
      allocator<char> >') creates a copy from type 'const std::__1::string' [-Wrange-loop-analysis]
                                                for (const string c : s.second){
                                                                  ^
src/verify.cpp:1464:12: note: use reference type 'const std::__1::string &' (aka 'const basic_string<char, char_traits<char>,
      allocator<char> > &') to prevent copying
                                                for (const string c : s.second){
                                                     ^~~~~~~~~~~~~~~~
                                                                  &
1 warning generated.
1 warning generated.
galvusdamor commented 4 years ago

Not really outdated, but the 2.5.* versions still use register which is not allowed any more in C++17. This was a known bug and has been fixed in version 2.6. Can you try to also update flex?

Sebastian-G commented 4 years ago

I already changed to:

➜ flex -V
flex 2.6.4
➜ make -j
g++ -O3 -pipe -Wall -Wextra -pedantic -std=c++17 -DNDEBUG -Wno-unused-parameter  -o src/hddl-token.o -c src/hddl-token.cpp
src/hddl-token.cpp:825:2: error: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
        register yy_state_type yy_current_state;
        ^~~~~~~~~
src/hddl-token.cpp:826:2: error: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
        register char *yy_cp, *yy_bp;
        ^~~~~~~~~
src/hddl-token.cpp:826:2: error: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
        register char *yy_cp, *yy_bp;
        ^~~~~~~~~
src/hddl-token.cpp:827:2: error: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
        register int yy_act;
        ^~~~~~~~~
src/hddl-token.cpp:875:4: error: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
                        register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
                        ^~~~~~~~~
src/hddl-token.cpp:1343:6: error: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
        register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
        ^~~~~~~~~
src/hddl-token.cpp:1344:2: error: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
        register char *source = (yytext_ptr);
        ^~~~~~~~~
src/hddl-token.cpp:1345:2: error: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
        register int number_to_move, i;
        ^~~~~~~~~
src/hddl-token.cpp:1345:2: error: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
        register int number_to_move, i;
        ^~~~~~~~~
src/hddl-token.cpp:1477:2: error: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
        register yy_state_type yy_current_state;
        ^~~~~~~~~
src/hddl-token.cpp:1478:2: error: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
        register char *yy_cp;
        ^~~~~~~~~
src/hddl-token.cpp:1484:3: error: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
                register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
                ^~~~~~~~~
src/hddl-token.cpp:1509:2: error: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
        register int yy_is_jam;
        ^~~~~~~~~
src/hddl-token.cpp:1510:6: error: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
        register char *yy_cp = (yy_c_buf_p);
        ^~~~~~~~~
src/hddl-token.cpp:1512:2: error: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
        register YY_CHAR yy_c = 1;
        ^~~~~~~~~
src/hddl-token.cpp:1530:33: error: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
    static void yyunput (int c, register char * yy_bp )
                                ^~~~~~~~~
src/hddl-token.cpp:1532:2: error: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
        register char *yy_cp;
        ^~~~~~~~~
src/hddl-token.cpp:1542:3: error: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
                register yy_size_t number_to_move = (yy_n_chars) + 2;
                ^~~~~~~~~
src/hddl-token.cpp:1543:3: error: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
                register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[
                ^~~~~~~~~
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
make: *** [src/hddl-token.o] Error 1
galvusdamor commented 4 years ago

Have you perform a make clear after updating flex?

Sebastian-G commented 4 years ago

now I did 👍 , but there is a new error 😢

➜ make -j
g++ -O3 -lm -flto -static -static-libgcc -DNDEBUG src/hddl-token.o src/hddl.o src/main.o src/sortexpansion.o src/parsetree.o src/util.o src/domain.o src/output.o src/parametersplitting.o src/cwa.o src/typeof.o src/shopWriter.o src/hpdlWriter.o src/hddlWriter.o src/orderingDecomposition.o src/plan.o src/verify.o src/properties.o -o pandaPIparser
clang: warning: argument unused during compilation: '-static-libgcc' [-Wunused-command-line-argument]
ld: library not found for -lcrt0.o
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [pandaPIparser] Error 1
galvusdamor commented 4 years ago

Well the good news is that we are making progress :)

This one seems to be a general MacOS Problem. We link the executable statically (for speed reasons). This brings only a very slight advantage so it is not a problem to disable it. The problem is that you need statically linked (system) libraries in order to statically link them into your program. MacOS does not seem to have this (https://stackoverflow.com/questions/3801011/ld-library-not-found-for-lcrt0-o-on-osx-10-6-with-gcc-clang-static-flag). So if you remove the -static -static-libgcc from the LINKERFLAGS in the makefile, it should link correctly.

Sebastian-G commented 4 years ago

Thanks a lot! It is working now.

galvusdamor commented 4 years ago

Perfect! I'll add the necessary comments to the README.