nevillegrech / MadMax

Ethereum Static Vulnerability Detector for Gas-Focussed Vulnerabilities
BSD 3-Clause "New" or "Revised" License
130 stars 16 forks source link

Compilation failure errors #6

Closed nettrino closed 2 years ago

nettrino commented 2 years ago

Hello, wanted to test MadMax and run into some compilation issues for a contract:

Compiling /home/nettrino/smartcontractfuzzing/tools/madmax/MadMax/madmax.dl to C++ program and executable
compiler error: cannot compile source file /home/nettrino/smartcontractfuzzing/tools/madmax/MadMax/gigahorse-toolchain/cache/dddbde8644ecadfa59a1c5ace530c43e.cpp
g++ -std=c++17   -fwrapv  -DUSE_NCURSES  -O3 -DUSE_LIBZ  -DUSE_SQLITE  -fopenmp  -march=native  -std=c++17 -Wdate-time -D_FORTIFY_SOURCE=2 -o/home/nettrino/smartcontractfuzzing/tools/madmax/MadMax/gigahorse-tool
chain/cache/dddbde8644ecadfa59a1c5ace530c43e /home/nettrino/smartcontractfuzzing/tools/madmax/MadMax/gigahorse-toolchain/cache/dddbde8644ecadfa59a1c5ace530c43e.cpp  -ldl -lpthread -lsqlite3 -lz -lncurses -lfunct
ors  -I/usr/bin/../include -I/usr/bin/include
g++: fatal error: Killed signal terminated program cc1plus
compilation terminated.
failed to compile C++ source </home/nettrino/smartcontractfuzzing/tools/madmax/MadMax/gigahorse-toolchain/cache/dddbde8644ecadfa59a1c5ace530c43e.cpp>
Process Process-3:
Traceback (most recent call last):
  File "/usr/lib/python3.9/multiprocessing/process.py", line 315, in _bootstrap
    self.run()
  File "/usr/lib/python3.9/multiprocessing/process.py", line 108, in run
    self._target(*self._args, **self._kwargs)
  File "/home/nettrino/smartcontractfuzzing/tools/madmax/MadMax/gigahorse-toolchain/gigahorse.py", line 287, in compile_datalog
    assert not(process.returncode), "Compilation failed. Stopping."
AssertionError: Compilation failed. Stopping.
Processing contract names.
Setting up workers.
Analysing...

0: test.hex completed in 0.01 + 3.07 + 0.28 + 0.06 secs

Finished 1 contracts...

gigahorse-toolchain /gigahorse.py -j3 ~/test.hex works fine. Is this a bug or is there something wrong with my setup? (I am on Debian 11 and had to go through some hoops to install the older version of souffle needed). Attaching a zip with the binary for reference: test.hex.zip

nettrino commented 2 years ago

Looks like the issue is cannot find -lfunctors - strange I would expect this to be found because the library is indeed under MadMax/gigahorse-toolchain/souffle-addon/libfunctors.so.
g++ -std=c++17 -fwrapv -DUSE_NCURSES -O3 -DUSE_LIBZ -DUSE_SQLITE -fopenmp -march=native -std=c++17 -Wdate-time -D_FORTIFY_SOURCE=2 -o /home/nettrino/smartcontractfuzzing/tools/madmax/MadMax/gigahorse-toolchain/cache/dddbde8644ecadfa59a1c5ace530c43e /home/nettrino/smartcontractfuzzing/tools/madmax/MadMax/gigahorse-toolchain/cache/dddbde8644ecadfa59a1c5ace530c43e.cpp -Lpwd/gigahorse-toolchain/souffle-addon -ldl -lpthread -lsqlite3 -lz -lncurses -lfunctors -I/usr/bin/../include -I/usr/bin/include fixes the issue