skyhover / Deckard

Code clone detection; clone-related bug detection; sematic clone analysis
Other
211 stars 79 forks source link

Build fails #21

Closed alipourm closed 5 years ago

alipourm commented 5 years ago

Build fails. It seems that it is related to solidity parser.

/mainsol.py solidity.y
bison -d pt_solidity.y -o pt_solidity.tab.cc -v -g
pt_solidity.y:213.9-15: syntax error, unexpected identifier, expecting string
make[1]: *** [pt_solidity.tab.cc] Error 1
make: *** [TARGET] Error 2
chenzimin commented 5 years ago

I have encountered the same problem on MacOS, and I solved it by installing the latest version of bison.

alipourm commented 5 years ago

bison is already the latest version.

$ brew install bison Warning: bison 3.3.2 is already installed and up-to-date

chenzimin commented 5 years ago

You have to, if you haven't done it already, force link bison (in MacOS at least), otherwise it still uses the older version of bison:

brew link bison --force

and export the bin path to bison:

'export PATH="/usr/local/opt/bison/bin:$PATH"' >> ~/.bash_profile
source ~/.bash_profile

You can check the bison version by:

bison -V
alipourm commented 5 years ago

Thanks! It worked.

SavinduHerath commented 2 years ago

:\Deckard Source\Deckard\src\main>bash build.sh rm -f *.pyc make -C simple clean make[1]: Entering directory '/mnt/c/Deckard Source/Deckard/src/ptgen/simple' rm -f .o lex.yy.cc pt_c.tab pt_c.y head.cc c_ptgen make[1]: Leaving directory '/mnt/c/Deckard Source/Deckard/src/ptgen/simple' make -C gcc clean make[1]: Entering directory '/mnt/c/Deckard Source/Deckard/src/ptgen/gcc' rm -f .o lex.yy.cc pt_c.tab pt_c.y head.cc gccptgen.a make[1]: Leaving directory '/mnt/c/Deckard Source/Deckard/src/ptgen/gcc' make -C java clean make[1]: Entering directory '/mnt/c/Deckard Source/Deckard/src/ptgen/java' rm -f .o lex.yy.cc pt_j.tab pt_j.y head.cc javaptgen.a make[1]: Leaving directory '/mnt/c/Deckard Source/Deckard/src/ptgen/java' make -C php5 clean make[1]: Entering directory '/mnt/c/Deckard Source/Deckard/src/ptgen/php5' rm -f .o lex.yy.cc pt_zend_language_parser.tab pt_zend_language_parser.y head.cc phpptgen.a make[1]: Leaving directory '/mnt/c/Deckard Source/Deckard/src/ptgen/php5' make -C sol clean make[1]: Entering directory '/mnt/c/Deckard Source/Deckard/src/ptgen/sol' rm -f .o lex.yy.cc pt_solidity. head.cc solidityptgen.a make[1]: Leaving directory '/mnt/c/Deckard Source/Deckard/src/ptgen/sol' make -C gcc make[1]: Entering directory '/mnt/c/Deckard Source/Deckard/src/ptgen/gcc' ./mainc.py c.y bison -d pt_c.y -o pt_c.tab.cc bison: pt_c.y: cannot open: No such file or directory make[1]: [Makefile:59: pt_c.tab.cc] Error 1 make[1]: Leaving directory '/mnt/c/Deckard Source/Deckard/src/ptgen/gcc' make: [Makefile:35: TARGET] Error 2 Error: ptgen make failed. Exit. Error: ptgen make failed. Deckard build fails.

I get this error when building. Can anyone help me with this? I am running the latest version of bison and python 2.7

shangeethas commented 2 years ago

Even after linking to the latest bison, the build fails with following error in MacOS. make -C sol ./mainsol.py solidity.y bison -d pt_solidity.y -o pt_solidity.tab.cc -v -g pt_solidity.y:2.1-12: warning: deprecated directive: ‘%pure-parser’, use ‘%define api.pure’ [-Wdeprecated] 2 | %pure-parser | ^~~~ | %define api.pure pt_solidity.y: warning: 31 shift/reduce conflicts [-Wconflicts-sr] pt_solidity.y: warning: 14 reduce/reduce conflicts [-Wconflicts-rr] pt_solidity.y: note: rerun with option '-Wcounterexamples' to generate conflict counterexamples pt_solidity.y: warning: fix-its can be applied. Rerun with option '--update'. [-Wother] flex -olex.yy.cc solidity.l g++ -O3 -I../../include -c -o lex.yy.o lex.yy.cc solidity.l:9:10: fatal error: 'error.h' file not found

include

     ^~~~~~~~~

1 error generated. make[1]: [lex.yy.o] Error 1 make: [TARGET] Error 2 Error: ptgen make failed. Exit. Error: ptgen make failed. Deckard build fails.

Can anyone help in fixing this issue?

Xiaoven commented 7 months ago

Even after linking to the latest bison, the build fails with following error in MacOS. make -C sol ./mainsol.py solidity.y bison -d pt_solidity.y -o pt_solidity.tab.cc -v -g pt_solidity.y:2.1-12: warning: deprecated directive: ‘%pure-parser’, use ‘%define api.pure’ [-Wdeprecated] 2 | %pure-parser | ^~~~ | %define api.pure pt_solidity.y: warning: 31 shift/reduce conflicts [-Wconflicts-sr] pt_solidity.y: warning: 14 reduce/reduce conflicts [-Wconflicts-rr] pt_solidity.y: note: rerun with option '-Wcounterexamples' to generate conflict counterexamples pt_solidity.y: warning: fix-its can be applied. Rerun with option '--update'. [-Wother] flex -olex.yy.cc solidity.l g++ -O3 -I../../include -c -o lex.yy.o lex.yy.cc solidity.l:9:10: fatal error: 'error.h' file not found #include ^~~~~ 1 error generated. make[1]: [lex.yy.o] Error 1 make: [TARGET] Error 2 Error: ptgen make failed. Exit. Error: ptgen make failed. Deckard build fails.

Can anyone help in fixing this issue?

It seems '' doesn't exist on MacOS.

A replacement is to use #include <mach/error.h> on Mac OS.

My approach is to remove the include statement, since it is not used in solidity.l. After removing it, my build succeeded.