skyhover / Deckard

Code clone detection; clone-related bug detection; sematic clone analysis
Other
209 stars 78 forks source link

build fails #23

Open sungbin opened 5 years ago

sungbin commented 5 years ago

In Mac OS(Mojave 10.14.5) and Linux(Ubuntu 18.04.2 LTS), cannot build. I command $sh build.sh in src/main/

Error Message

Mac OS

rm -f .pyc make -C simple clean rm -f .o lex.yy.cc pt_c.tab pt_c.y head.cc c_ptgen make -C gcc clean rm -f .o lex.yy.cc pt_c.tab pt_c.y head.cc gccptgen.a make -C java clean rm -f .o lex.yy.cc pt_j.tab pt_j.y head.cc javaptgen.a make -C php5 clean rm -f .o lex.yy.cc pt_zend_language_parser.tab pt_zend_language_parser.y head.cc phpptgen.a make -C sol clean rm -f .o lex.yy.cc pt_solidity.* head.cc solidityptgen.a make -C gcc ./mainc.py c.y Traceback (most recent call last): File "./mainc.py", line 43, in import YaccParser,YaccLexer File "../YaccParser.py", line 77 except antlr.RecognitionException, ex: ^ SyntaxError: invalid syntax make[1]: [pt_c.y] Error 1 make: [TARGET] Error 2 Error: ptgen make failed. Exit. Error: ptgen make failed. Deckard build fails.

Linux

rm -f .pyc make -C simple clean make[1]: Entering directory '/home/imseongbin/Deckard/src/ptgen/simple' rm -f .o lex.yy.cc pt_c.tab pt_c.y head.cc c_ptgen make[1]: Leaving directory '/home/imseongbin/Deckard/src/ptgen/simple' make -C gcc clean make[1]: Entering directory '/home/imseongbin/Deckard/src/ptgen/gcc' rm -f .o lex.yy.cc pt_c.tab pt_c.y head.cc gccptgen.a make[1]: Leaving directory '/home/imseongbin/Deckard/src/ptgen/gcc' make -C java clean make[1]: Entering directory '/home/imseongbin/Deckard/src/ptgen/java' rm -f .o lex.yy.cc pt_j.tab pt_j.y head.cc javaptgen.a make[1]: Leaving directory '/home/imseongbin/Deckard/src/ptgen/java' make -C php5 clean make[1]: Entering directory '/home/imseongbin/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 '/home/imseongbin/Deckard/src/ptgen/php5' make -C sol clean make[1]: Entering directory '/home/imseongbin/Deckard/src/ptgen/sol' rm -f .o lex.yy.cc pt_solidity.* head.cc solidityptgen.a make[1]: Leaving directory '/home/imseongbin/Deckard/src/ptgen/sol' make -C gcc make[1]: Entering directory '/home/imseongbin/Deckard/src/ptgen/gcc' ./mainc.py c.y bison -d pt_c.y -o pt_c.tab.cc make[1]: bison: Command not found Makefile:59: recipe for target 'pt_c.tab.cc' failed make[1]: [pt_c.tab.cc] Error 127 make[1]: Leaving directory '/home/imseongbin/Deckard/src/ptgen/gcc' Makefile:35: recipe for target 'TARGET' failed make: [TARGET] Error 2 Error: ptgen make failed. Exit. Error: ptgen make failed. Deckard build fails.

plz, help me.

zhengxiaohuaya commented 4 years ago

@sungbin hi,I also had this problem during installation. Do you have a solution?

chenzimin commented 4 years ago

Maybe this is related to https://github.com/skyhover/Deckard/issues/21?

qw3ry commented 4 years ago

Looks like a python3 issue to me. If you have python2 still installed (its officially unsupported since Jan/20) you can edit the shebang in src/ptgen/*/main*.py from /usr/bin/env python to /usr/bin/env python2. This worked for me on Arch Linux.

caicaifearless commented 4 years ago

I met the same error on linux(Ubuntu 18.04.2 LTS) as your error on Mac. Did you solve your error on Mac?

qw3ry commented 4 years ago

As I wrote, it works when you replace python with python2 in the first line of the python files in ptgen

caicaifearless commented 4 years ago

As I wrote, it works when you replace python with python2 in the first line of the python files in ptgen

Thanks.

SavinduHerath commented 2 years ago

C:\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?

wcy1997 commented 2 years ago

I have solved this problem. This problem is mainly caused by the incompatibility of python2 and python3. The .py files in this project is written by python2, but it calls python3 in your computer during installation. An approach is to change these python2 files into python3 using 2to3.py. 2to3.py is a built-in tool of python. You can use it in Unix-like OS by: 2to3 -w xxx.py. After transforming all python2 files into python3, it can be built successfully.

Another problem is assigning a value to True/False in several files(e.g /src/ptgrn/antlr.py). I just delete the relevent code fragment. I hope this will not cause other problems.