plast-lab / cclyzer

A tool for analyzing LLVM bitcode using Datalog.
MIT License
96 stars 14 forks source link

Python module Factgen error #5

Closed iusmanahmed closed 7 years ago

iusmanahmed commented 7 years ago

Sir, I am working on feature extraction and selection technique to make a scheduler for open Cl program. I have a issue when i run make file " blox compiler: Command not found" and its show that module fact-gen missing. Please help me to fix it

gbalats commented 7 years ago

The bloxcompiler command is one of the executables (required by cclyzer) provided by the LogicBlox Engine. Have you followed the setup instructions about installing the LB Engine?

iusmanahmed commented 7 years ago

Sir, LB Engine is running. I follow all steps and it's giving these mentioned error.

gbalats commented 7 years ago

Can you run bloxcompiler -h? Does the command which bloxcompiler return any path? If not, then you have not set up your PATH properly. Try echo $PATH to see if it includes the directory that contains bloxcompiler and bloxbatch.

iusmanahmed commented 7 years ago

screenshot from 2016-10-31 14-52-45 Sir, Please let me know what is compiler path. i search its all folder my all 3 servers are running.

iusmanahmed commented 7 years ago

My path variables path

gbalats commented 7 years ago

I see that you have installed the newer LB Engine (version 4.3). As specified in the setup instructions, CClyzer only works with versions 3.*.

So, you can either download an earlier version (3.*), or try pa-datalog instead, which is a modified LogicBlox v3 engine, intended for use in program analysis projects.

iusmanahmed commented 7 years ago

out Sir, Thank you i install pa-datalog its working now but when i make command it generate error ImportError: No module named factgen Please give any solution. I think it is related to some python library. I install python 2.7.12+.

iusmanahmed commented 7 years ago

Sir, This is the error. Please help out2

gbalats commented 7 years ago

This has to do with LLVM. Do you have the correct version installed? What is the output of clang -v?

iusmanahmed commented 7 years ago

screenshot from 2016-10-31 20-59-25 Sir, clang version is 3.8 which version is compatible

gbalats commented 7 years ago

Can you post all the errors produced when running make fact-generator?

iusmanahmed commented 7 years ago

sir check second last comment. these are all error

gbalats commented 7 years ago

These are not all the errors. Please provide the full output of the make fact-generator.clean fact-generator command as text (not a screenshot).

How did you install LLVM? Clang says it's version 3.8 but the error you have posted says 3.7 (/usr/lib/llvm-3.7/...). Maybe you have multiple versions of LLVM installed in your system? In any case, you won't be able to run cclyzer unless you successfully compile its fact-generator. It's not related to python.

The errors I'm seeing are caused by missing headers. This is probably due to either a missing LLVM package, or some version mismatch.

iusmanahmed commented 7 years ago

Running it from root

(venv) root@usman-Satellite-C850-B341:/home/usman/Downloads/cclyzer-master# make fact-generator.clean fact-generator make --directory=tools/fact-generator clean make[1]: Entering directory '/home/usman/Downloads/cclyzer-master/tools/fact-generator' rm -f -r ../../build/fact-generator make[1]: Leaving directory '/home/usman/Downloads/cclyzer-master/tools/fact-generator' make --directory=tools/fact-generator make[1]: Entering directory '/home/usman/Downloads/cclyzer-master/tools/fact-generator' mkdir -p ../../build/fact-generator Created dependency file: ../../build/fact-generator/TypeVisitor.d Created dependency file: ../../build/fact-generator/functions.d Created dependency file: ../../build/fact-generator/DebugInfoProcessorImpl.d Created dependency file: ../../build/fact-generator/DebugInfoProcessor.d Created dependency file: ../../build/fact-generator/main.d Created dependency file: ../../build/fact-generator/debuginfo_enums.d Created dependency file: ../../build/fact-generator/predicate_groups.d Created dependency file: ../../build/fact-generator/globals.d Created dependency file: ../../build/fact-generator/PyFactGen.d In file included from /usr/include/boost/python/detail/prefix.hpp:13:0, from /usr/include/boost/python/args.hpp:8, from /usr/include/boost/python.hpp:11, from src/PyFactGen.cpp:6: /usr/include/boost/python/detail/wrap_python.hpp:50:23: fatal error: pyconfig.h: No such file or directory

include

                   ^

compilation terminated. Created dependency file: ../../build/fact-generator/debuginfo_types.d Created dependency file: ../../build/fact-generator/operands.d Created dependency file: ../../build/fact-generator/predicate.d Created dependency file: ../../build/fact-generator/debuginfo_subranges.d Created dependency file: ../../build/fact-generator/debuginfo_scopes.d Created dependency file: ../../build/fact-generator/debuginfo_variables.d Created dependency file: ../../build/fact-generator/constants.d Created dependency file: ../../build/fact-generator/TypeAccumulator.d Created dependency file: ../../build/fact-generator/llvm_enums.d Created dependency file: ../../build/fact-generator/debuginfo_locations.d Created dependency file: ../../build/fact-generator/InstructionVisitor.d Created dependency file: ../../build/fact-generator/RefmodeEngine.d Created dependency file: ../../build/fact-generator/debuginfo_unions.d Created dependency file: ../../build/fact-generator/RefmodeEngineImpl.d Created dependency file: ../../build/fact-generator/FactGenerator.d Created dependency file: ../../build/fact-generator/assembly.d Created dependency file: ../../build/fact-generator/debuginfo_imports.d Created dependency file: ../../build/fact-generator/Options.d Created dependency file: ../../build/fact-generator/debuginfo_templates.d Created dependency file: ../../build/fact-generator/FactWriter.d g++ -fvisibility-inlines-hidden -Wall -W -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wnon-virtual-dtor -ffunction-sections -fdata-sections -O3 -fPIC -g -std=c++11 -I/usr/lib/llvm-3.8/include -D_GNU_SOURCE -DSTDC_CONSTANT_MACROS -DSTDC_FORMAT_MACROS -DSTDC_LIMIT_MACROS -I include -c -o ../../build/fact-generator/FactWriter.o src/FactWriter.cpp g++ -fvisibility-inlines-hidden -Wall -W -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wnon-virtual-dtor -ffunction-sections -fdata-sections -O3 -fPIC -g -std=c++11 -I/usr/lib/llvm-3.8/include -D_GNU_SOURCE -DSTDC_CONSTANT_MACROS -DSTDC_FORMAT_MACROS -DSTDC_LIMIT_MACROS -I include -c -o ../../build/fact-generator/debuginfo_templates.o src/debuginfo_templates.cpp g++ -fvisibility-inlines-hidden -Wall -W -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wnon-virtual-dtor -ffunction-sections -fdata-sections -O3 -fPIC -g -std=c++11 -I/usr/lib/llvm-3.8/include -D_GNU_SOURCE -DSTDC_CONSTANT_MACROS -DSTDC_FORMAT_MACROS -DSTDC_LIMIT_MACROS -I include -c -o ../../build/fact-generator/Options.o src/Options.cpp g++ -fvisibility-inlines-hidden -Wall -W -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wnon-virtual-dtor -ffunction-sections -fdata-sections -O3 -fPIC -g -std=c++11 -I/usr/lib/llvm-3.8/include -D_GNU_SOURCE -DSTDC_CONSTANT_MACROS -DSTDC_FORMAT_MACROS -DSTDC_LIMIT_MACROS -I include -c -o ../../build/fact-generator/debuginfo_imports.o src/debuginfo_imports.cpp g++ -fvisibility-inlines-hidden -Wall -W -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wnon-virtual-dtor -ffunction-sections -fdata-sections -O3 -fPIC -g -std=c++11 -I/usr/lib/llvm-3.8/include -D_GNU_SOURCE -DSTDC_CONSTANT_MACROS -DSTDC_FORMAT_MACROS -DSTDC_LIMIT_MACROS -I include -c -o ../../build/fact-generator/assembly.o src/assembly.cpp g++ -fvisibility-inlines-hidden -Wall -W -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wnon-virtual-dtor -ffunction-sections -fdata-sections -O3 -fPIC -g -std=c++11 -I/usr/lib/llvm-3.8/include -D_GNU_SOURCE -DSTDC_CONSTANT_MACROS -DSTDC_FORMAT_MACROS -DSTDC_LIMIT_MACROS -I include -c -o ../../build/fact-generator/FactGenerator.o src/FactGenerator.cpp src/FactGenerator.cpp: In member function ‘void cclyzer::FactGenerator::processModule(const llvm::Module&, const string&)’: src/FactGenerator.cpp:135:41: warning: unused variable ‘mdNode’ [-Wunused-variable] const llvm::MDNode &mdNode = _MDForInst[i].second; ^~ g++ -fvisibility-inlines-hidden -Wall -W -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wnon-virtual-dtor -ffunction-sections -fdata-sections -O3 -fPIC -g -std=c++11 -I/usr/lib/llvm-3.8/include -D_GNU_SOURCE -DSTDC_CONSTANT_MACROS -DSTDC_FORMAT_MACROS -DSTDC_LIMIT_MACROS -I include -c -o ../../build/fact-generator/RefmodeEngineImpl.o src/RefmodeEngineImpl.cpp g++ -fvisibility-inlines-hidden -Wall -W -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wnon-virtual-dtor -ffunction-sections -fdata-sections -O3 -fPIC -g -std=c++11 -I/usr/lib/llvm-3.8/include -D_GNU_SOURCE -DSTDC_CONSTANT_MACROS -DSTDC_FORMAT_MACROS -DSTDC_LIMIT_MACROS -I include -c -o ../../build/fact-generator/debuginfo_unions.o src/debuginfo_unions.cpp g++ -fvisibility-inlines-hidden -Wall -W -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wnon-virtual-dtor -ffunction-sections -fdata-sections -O3 -fPIC -g -std=c++11 -I/usr/lib/llvm-3.8/include -D_GNU_SOURCE -DSTDC_CONSTANT_MACROS -DSTDC_FORMAT_MACROS -DSTDC_LIMIT_MACROS -I include -c -o ../../build/fact-generator/RefmodeEngine.o src/RefmodeEngine.cpp g++ -fvisibility-inlines-hidden -Wall -W -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wnon-virtual-dtor -ffunction-sections -fdata-sections -O3 -fPIC -g -std=c++11 -I/usr/lib/llvm-3.8/include -D_GNU_SOURCE -DSTDC_CONSTANT_MACROS -DSTDC_FORMAT_MACROS -DSTDC_LIMIT_MACROS -I include -c -o ../../build/fact-generator/InstructionVisitor.o src/InstructionVisitor.cpp g++ -fvisibility-inlines-hidden -Wall -W -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wnon-virtual-dtor -ffunction-sections -fdata-sections -O3 -fPIC -g -std=c++11 -I/usr/lib/llvm-3.8/include -D_GNU_SOURCE -DSTDC_CONSTANT_MACROS -DSTDC_FORMAT_MACROS -DSTDC_LIMIT_MACROS -I include -c -o ../../build/fact-generator/debuginfo_locations.o src/debuginfo_locations.cpp g++ -fvisibility-inlines-hidden -Wall -W -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wnon-virtual-dtor -ffunction-sections -fdata-sections -O3 -fPIC -g -std=c++11 -I/usr/lib/llvm-3.8/include -D_GNU_SOURCE -DSTDC_CONSTANT_MACROS -DSTDC_FORMAT_MACROS -DSTDC_LIMIT_MACROS -I include -c -o ../../build/fact-generator/llvm_enums.o src/llvm_enums.cpp g++ -fvisibility-inlines-hidden -Wall -W -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wnon-virtual-dtor -ffunction-sections -fdata-sections -O3 -fPIC -g -std=c++11 -I/usr/lib/llvm-3.8/include -D_GNU_SOURCE -DSTDC_CONSTANT_MACROS -DSTDC_FORMAT_MACROS -DSTDC_LIMIT_MACROS -I include -c -o ../../build/fact-generator/TypeAccumulator.o src/TypeAccumulator.cpp g++ -fvisibility-inlines-hidden -Wall -W -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wnon-virtual-dtor -ffunction-sections -fdata-sections -O3 -fPIC -g -std=c++11 -I/usr/lib/llvm-3.8/include -D_GNU_SOURCE -DSTDC_CONSTANT_MACROS -DSTDC_FORMAT_MACROS -DSTDC_LIMIT_MACROS -I include -c -o ../../build/fact-generator/constants.o src/constants.cpp g++ -fvisibility-inlines-hidden -Wall -W -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wnon-virtual-dtor -ffunction-sections -fdata-sections -O3 -fPIC -g -std=c++11 -I/usr/lib/llvm-3.8/include -D_GNU_SOURCE -DSTDC_CONSTANT_MACROS -DSTDC_FORMAT_MACROS -DSTDC_LIMIT_MACROS -I include -c -o ../../build/fact-generator/debuginfo_variables.o src/debuginfo_variables.cpp g++ -fvisibility-inlines-hidden -Wall -W -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wnon-virtual-dtor -ffunction-sections -fdata-sections -O3 -fPIC -g -std=c++11 -I/usr/lib/llvm-3.8/include -D_GNU_SOURCE -DSTDC_CONSTANT_MACROS -DSTDC_FORMAT_MACROS -DSTDC_LIMIT_MACROS -I include -c -o ../../build/fact-generator/debuginfo_scopes.o src/debuginfo_scopes.cpp src/debuginfo_scopes.cpp: In static member function ‘static void cclyzer::DebugInfoProcessor::Impl::write_di_subprogram::write(const llvm::DISubprogram&, const refmode_t&, cclyzer::DebugInfoProcessor::Impl::write_di_node::DIProc&)’: src/debuginfo_scopes.cpp:127:51: error: ‘const class llvm::DISubprogram’ has no member named ‘getFunction’ if (const llvm::Function func = disubprogram.getFunction()) { ^~~ Makefile:59: recipe for target '../../build/fact-generator/debuginfo_scopes.o' failed make[1]: _* [../../build/fact-generator/debuginfo_scopes.o] Error 1 make[1]: Leaving directory '/home/usman/Downloads/cclyzer-master/tools/fact-generator' Makefile:27: recipe for target 'fact-generator' failed make: *\ [fact-generator] Error 2

Please help

gbalats commented 7 years ago

Have you installed python-dev? If not, that is probably the cause of the first error (pyconfig.h: No such file or directory). Run sudo apt-get install python-dev and check if the first error persists.

iusmanahmed commented 7 years ago

Yes, Sir Install (venv) root@usman-Satellite-C850-B341:/home/usman/Downloads/cclyzer-master# sudo apt-get install python-dev Reading package lists... Done Building dependency tree
Reading state information... Done python-dev is already the newest version (2.7.11-2). 0 upgraded, 0 newly installed, 0 to remove and 52 not upgraded.

Same error remains

gbalats commented 7 years ago

Turns out this is caused by a change introduced in LLVM 3.8, where llvm::DISubprogram::getFunction() was removed and the inverse llvm::Function::getSubprogram() was added.

The reason for this change is described here.

I will try to come up with a fix that works with both LLVM 3.7 and 3.8.

iusmanahmed commented 7 years ago

which clang version will work ?

gbalats commented 7 years ago

LLVM 3.7 should work but it may require to build LLVM from source due to some binary compatibility issues (between clang and gcc) introduced by C++11.

You can retry though (after pulling the latest changes from master) with LLVM 3.8, where the prebuilt binary should work fine. The error should be fixed with the last commits.

However, I ran into another (linking) error on Ubuntu 14.04:

/usr/bin/ld: cannot find -ltinfo

There was a libtinfo.so.5 file under /lib/x86_64-linux-gnu but no libtinfo.so for some reason. I fixed this by adding a symlink:

cd /lib/x86_64-linux-gnu
sudo ln -s libtinfo.so.5 libtinfo.so

If you ran into this one too, I'll probably add it as a separate issue.