Closed kimwalisch closed 5 years ago
Hi @kimwalisch,
IKOS compiles without problem on my laptop, but I'm using macOS High Sierra. I see that you got a few errors and warnings, let's check them one by one:
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'python_requires'
warnings.warn(msg)
error in virtualenv setup command: 'extras_require' must be a dictionary whose values are strings or lists of strings containing valid project/version requirement specifiers.
If reporting this issue please do so at (not Homebrew/brew or Homebrew/core):
https://github.com/nasa-sw-vnv/homebrew-core/issues
This is a python warning raised by a homebrew command. I think this has nothing to do with IKOS. Please make sure homebrew is up-to-date. I tried to google the warning and it looks like pip/setuptools/virtualenv might be out of date on your system, which is very suspicious.
/usr/local/Homebrew/Library/Homebrew/utils/github.rb:245:in `raise_api_error': GitHub Must specify two-factor authentication OTP code.:The GitHub credentials in the macOS keychain may be invalid. (GitHub::AuthenticationFailedError)
Clear them with:
printf "protocol=https\nhost=github.com\n" | git credential-osxkeychain erase
Or create a personal access token:
https://github.com/settings/tokens/new?scopes=gist,public_repo&description=Homebrew
echo 'export HOMEBREW_GITHUB_API_TOKEN=your_token_here' >> ~/.bash_profile
from /usr/local/Homebrew/Library/Homebrew/utils/github.rb:206:in `open_api'
from /usr/local/Homebrew/Library/Homebrew/utils/github.rb:324:in `search'
from /usr/local/Homebrew/Library/Homebrew/utils/github.rb:257:in `search_issues'
from /usr/local/Homebrew/Library/Homebrew/utils/github.rb:270:in `issues_for_formula'
from /usr/local/Homebrew/Library/Homebrew/exceptions.rb:372:in `fetch_issues'
from /usr/local/Homebrew/Library/Homebrew/exceptions.rb:368:in `issues'
from /usr/local/Homebrew/Library/Homebrew/exceptions.rb:422:in `dump'
from /usr/local/Homebrew/Library/Homebrew/brew.rb:127:in `rescue in <main>'
from /usr/local/Homebrew/Library/Homebrew/brew.rb:17:in `<main>'
It looks like homebrew cannot clone or download a resource from Github. You might have invalid Github credentials in your keychain. Personally, I define the HOMEBREW_GITHUB_API_TOKEN
environment variable, see https://stackoverflow.com/questions/20130681/setting-github-api-token-for-homebrew
$ CXX=/usr/local/opt/llvm@7/bin/clang++ CC=/usr/local/opt/llvm@7/bin/clang cmake .. -DLLVM_CONFIG_EXECUTABLE="$(brew --prefix)/opt/llvm@7/bin/llvm-config"
Why are you trying to compile with clang 7? You should probably let cmake
find your default compiler, Apple Clang.
Try to remove CXX=
and CC=
but keep -DLLVM_CONFIG_EXECUTABLE=
, that's necessary.
[ 46%] Building CXX object analyzer/CMakeFiles/ikos-analyzer.dir/src/analysis/memory_location.cpp.o
/Users/kim/Downloads/ikos-master/analyzer/src/analysis/call_context.cpp:60:16: error: no member named 'try_emplace' in 'llvm::DenseMap<std::__1::pair<ikos::analyzer::CallContext *,
ikos::ar::CallBase *>, std::__1::unique_ptr<ikos::analyzer::CallContext, std::__1::default_delete<ikos::analyzer::CallContext> >,
llvm::DenseMapInfo<std::__1::pair<ikos::analyzer::CallContext *, ikos::ar::CallBase *> > >'
this->_map.try_emplace({parent, call},
~~~~~~~~~~ ^
1 error generated.
make[2]: *** [analyzer/CMakeFiles/ikos-analyzer.dir/src/analysis/call_context.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....
In file included from /Users/kim/Downloads/ikos-master/analyzer/src/analysis/memory_location.cpp:47:
In file included from /Users/kim/Downloads/ikos-master/analyzer/include/ikos/analyzer/util/source_location.hpp:50:
In file included from /Users/kim/Downloads/ikos-master/frontend/llvm/include/ikos/frontend/llvm/import/source_location.hpp:50:
In file included from /usr/local/Cellar/llvm/7.0.0_1/include/llvm/IR/DebugInfoMetadata.h:26:
In file included from /usr/local/Cellar/llvm/7.0.0_1/include/llvm/BinaryFormat/Dwarf.h:28:
/usr/local/Cellar/llvm/7.0.0_1/include/llvm/Support/FormatVariadicDetails.h:66:20: error: no template named 'SameType'
static char test(SameType<Signature_format, &U::format> *);
^
In file included from /Users/kim/Downloads/ikos-master/analyzer/src/analysis/memory_location.cpp:47:
In file included from /Users/kim/Downloads/ikos-master/analyzer/include/ikos/analyzer/util/source_location.hpp:50:
In file included from /Users/kim/Downloads/ikos-master/frontend/llvm/include/ikos/frontend/llvm/import/source_location.hpp:50:
/usr/local/Cellar/llvm/7.0.0_1/include/llvm/IR/DebugInfoMetadata.h:72:9: error: unknown type name 'Metadata'
const Metadata *MD = nullptr;
^
/usr/local/Cellar/llvm/7.0.0_1/include/llvm/IR/DebugInfoMetadata.h:79:33: error: unknown type name 'Metadata'
explicit TypedDINodeRef(const Metadata *MD) : MD(MD) {
^
/usr/local/Cellar/llvm/7.0.0_1/include/llvm/IR/DebugInfoMetadata.h:90:12: error: unknown type name 'Metadata'
operator Metadata *() const { return const_cast<Metadata *>(MD); }
^
/usr/local/Cellar/llvm/7.0.0_1/include/llvm/IR/DebugInfoMetadata.h:98:34: error: unknown type name 'DINode'; did you mean 'MDNode'?
using DINodeRef = TypedDINodeRef<DINode>;
^
/Library/Frameworks/Mono.framework/Headers/llvm/IR/Metadata.h:126:7: note: 'MDNode' declared here
class MDNode : public Value, public FoldingSetNode {
^
In file included from /Users/kim/Downloads/ikos-master/analyzer/src/analysis/memory_location.cpp:47:
In file included from /Users/kim/Downloads/ikos-master/analyzer/include/ikos/analyzer/util/source_location.hpp:50:
In file included from /Users/kim/Downloads/ikos-master/frontend/llvm/include/ikos/frontend/llvm/import/source_location.hpp:50:
/usr/local/Cellar/llvm/7.0.0_1/include/llvm/IR/DebugInfoMetadata.h:99:35: error: use of undeclared identifier 'DIScope'
using DIScopeRef = TypedDINodeRef<DIScope>;
This is weird. Those are errors in llvm that I have never seen before.
This is a python warning raised by a homebrew command. I think this has nothing to do with IKOS. Please make sure homebrew is up-to-date. I tried to google the warning and it looks like pip/setuptools/virtualenv might be out of date on your system, which is very suspicious.
I have updated setuptools and virtualenv on GitHub and set my GitHub API token but the installation using brew install
still fails. Note that I already upgraded brew to the latest version before as described in your installation instructions.
pip install --upgrade setuptools --user
pip install --upgrade virtualenv --user
export HOMEBREW_GITHUB_API_TOKEN=XXX
brew install nasa-sw-vnv/core/ikos
==> Installing ikos from nasa-sw-vnv/core
==> Downloading https://github.com/nasa-sw-vnv/ikos/releases/download/v2.1/ikos-2.1.tar.gz
Already downloaded: /Users/kim/Library/Caches/Homebrew/downloads/dad01cb7251bcbeb8345d543aa960a47f31758f2ea6a65cf2d43bf0aa1210f09--ikos-2.1.tar.gz
==> Downloading https://files.pythonhosted.org/packages/4e/8b/75469c270ac544265f0020aa7c4ea925c5284b23e445cf3aa8b99f662690/virtualenv-16.1.0.tar.g
Already downloaded: /Users/kim/Library/Caches/Homebrew/downloads/bda8bcde19a275fd9c84a7ec957593976e90dfd0e461a87f5698f1d2286c0197--virtualenv-16.1.0.tar.gz
==> python -c import setuptools... --no-user-cfg install --prefix=/private/tmp/ikos--homebrew-virtualenv-20181213-5640-1ghpl3t/target --install-sc
Last 15 lines from /Users/kim/Library/Logs/Homebrew/ikos/01.python:
-c
import setuptools, tokenize
__file__ = 'setup.py'
exec(compile(getattr(tokenize, 'open', open)(__file__).read()
.replace('\r\n', '\n'), __file__, 'exec'))
--no-user-cfg
install
--prefix=/private/tmp/ikos--homebrew-virtualenv-20181213-5640-1ghpl3t/target
--install-scripts=/private/tmp/ikos--homebrew-virtualenv-20181213-5640-1ghpl3t/target/bin
--single-version-externally-managed
--record=installed.txt
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'python_requires'
warnings.warn(msg)
error in virtualenv setup command: 'extras_require' must be a dictionary whose values are strings or lists of strings containing valid project/version requirement specifiers.
If reporting this issue please do so at (not Homebrew/brew or Homebrew/core):
https://github.com/nasa-sw-vnv/homebrew-core/issues
I have now successfully compiled ikos on Ubuntu 18.10 x64 using Clang 7 :-)
But I first got a linker error:
CXX=clang++ CC=clang cmake .. -DLLVM_CONFIG_EXECUTABLE="/home/xxx/Downloads/clang+llvm-7.0.0-x86_64-linux-gnu-ubuntu-16.04/bin/llvm-config"
make -j4
[ 36%] Building CXX object frontend/llvm/CMakeFiles/ikos-pp.dir/src/ikos_pp.cpp.o
[ 36%] Building CXX object frontend/llvm/CMakeFiles/ikos-llvm-to-ar.dir/src/import/source_location.cpp.o
[ 38%] Building CXX object frontend/llvm/CMakeFiles/ikos-llvm-to-ar.dir/src/import/type.cpp.o
[ 38%] Linking CXX static library libikos-ar.a
[ 38%] Built target ikos-ar
[ 38%] Linking CXX executable ikos-pp
CMakeFiles/ikos-pp.dir/src/ikos_pp.cpp.o:(.data.rel.ro._ZTIN4llvm2cl15OptionValueCopyINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEE[_ZTIN4llvm2cl15OptionValueCopyINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEE]+0x10): undefined reference to `typeinfo for llvm::cl::GenericOptionValue'
CMakeFiles/ikos-pp.dir/src/ikos_pp.cpp.o:(.data.rel.ro._ZTIN4llvm2cl4listINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEbNS0_6parserIS7_EEEE[_ZTIN4llvm2cl4listINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEbNS0_6parserIS7_EEEE]+0x18): undefined reference to `typeinfo for llvm::cl::Option'
CMakeFiles/ikos-pp.dir/src/ikos_pp.cpp.o:(.data.rel.ro._ZTIN4llvm2cl3optI12OptLevelTypeLb0ENS0_6parserIS2_EEEE[_ZTIN4llvm2cl3optI12OptLevelTypeLb0ENS0_6parserIS2_EEEE]+0x18): undefined reference to `typeinfo for llvm::cl::Option'
CMakeFiles/ikos-pp.dir/src/ikos_pp.cpp.o:(.data.rel.ro._ZTIN4llvm2cl6parserI12OptLevelTypeEE[_ZTIN4llvm2cl6parserI12OptLevelTypeEE]+0x10): undefined reference to `typeinfo for llvm::cl::generic_parser_base'
CMakeFiles/ikos-pp.dir/src/ikos_pp.cpp.o:(.data.rel.ro._ZTIN4llvm2cl15OptionValueCopyI12OptLevelTypeEE[_ZTIN4llvm2cl15OptionValueCopyI12OptLevelTypeEE]+0x10): undefined reference to `typeinfo for llvm::cl::GenericOptionValue'
CMakeFiles/ikos-pp.dir/src/ikos_pp.cpp.o:(.data.rel.ro._ZTIN4llvm2cl4listIPKNS_8PassInfoEbNS_14PassNameParserEEE[_ZTIN4llvm2cl4listIPKNS_8PassInfoEbNS_14PassNameParserEEE]+0x18): undefined reference to `typeinfo for llvm::cl::Option'
CMakeFiles/ikos-pp.dir/src/ikos_pp.cpp.o:(.data.rel.ro._ZTIN4llvm2cl15OptionValueCopyIbEE[_ZTIN4llvm2cl15OptionValueCopyIbEE]+0x10): undefined reference to `typeinfo for llvm::cl::GenericOptionValue'
libikos-pp.a(lower_cst_expr.cpp.o):(.data.rel.ro._ZTIN12_GLOBAL__N_116LowerCstExprPassE+0x10): undefined reference to `typeinfo for llvm::FunctionPass'
libikos-pp.a(lower_select.cpp.o):(.data.rel.ro._ZTIN12_GLOBAL__N_115LowerSelectPassE+0x10): undefined reference to `typeinfo for llvm::FunctionPass'
libikos-pp.a(mark_internal_inline.cpp.o):(.data.rel.ro._ZTIN12_GLOBAL__N_122MarkInternalInlinePassE+0x10): undefined reference to `typeinfo for llvm::ModulePass'
libikos-pp.a(mark_no_return_function.cpp.o):(.data.rel.ro._ZTIN12_GLOBAL__N_124MarkNoReturnFunctionPassE+0x10): undefined reference to `typeinfo for llvm::ModulePass'
libikos-pp.a(name_values.cpp.o):(.data.rel.ro._ZTIN12_GLOBAL__N_114NameValuesPassE+0x10): undefined reference to `typeinfo for llvm::ModulePass'
libikos-pp.a(remove_printf_calls.cpp.o):(.data.rel.ro._ZTIN12_GLOBAL__N_121RemovePrintfCallsPassE+0x10): undefined reference to `typeinfo for llvm::FunctionPass'
libikos-pp.a(remove_unreachable_blocks.cpp.o):(.data.rel.ro._ZTIN12_GLOBAL__N_127RemoveUnreachableBlocksPassE+0x10): undefined reference to `typeinfo for llvm::FunctionPass'
[ 38%] Linking CXX static library libikos-llvm-to-ar.a
clang-7: error: linker command failed with exit code 1 (use -v to see invocation)
frontend/llvm/CMakeFiles/ikos-pp.dir/build.make:134: recipe for target 'frontend/llvm/ikos-pp' failed
make[2]: *** [frontend/llvm/ikos-pp] Error 1
CMakeFiles/Makefile2:1820: recipe for target 'frontend/llvm/CMakeFiles/ikos-pp.dir/all' failed
make[1]: *** [frontend/llvm/CMakeFiles/ikos-pp.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
[ 38%] Built target ikos-llvm-to-ar
Makefile:140: recipe for target 'all' failed
make: *** [all] Error 2
I was able to fix that linker error by adding -DCMAKE_CXX_FLAGS="-fno-rtti"
:
CXX=clang++ CC=clang cmake .. -DCMAKE_CXX_FLAGS="-fno-rtti" -DLLVM_CONFIG_EXECUTABLE="/home/kim/Downloads/clang+llvm-7.0.0-x86_64-linux-gnu-ubuntu-16.04/bin/llvm-config"
make -j4
...
Unfortunately none of my projects could be analysed using ikos:
# https://github.com/kimwalisch/primesieve
$ ikos-scan cmake .. -DBUILD_SHARED_LIBS=OFF
$ ikos-scan make
...
Analyze primesieve? [Y/n] Y
[*] Running ikos primesieve.bc -o primesieve.db
[*] Running ikos preprocessor
[*] Running ikos analyzer
[*] Translating LLVM bitcode to AR
ikos-analyzer: /tmp/ikos-eJchin/primesieve.pp.bc: error: unexpected null pointer in llvm::DICompositeType with DW_TAG_structure_type or DW_TAG_class_type tag
ikos: error: a run-time error occured
# https://github.com/kimwalisch/libpopcnt
$ ikos-scan cmake ..
$ ikos-scan make
...
Analyze benchmark? [Y/n] Y
[*] Running ikos benchmark.bc -o benchmark.db
[*] Running ikos preprocessor
[*] Running ikos analyzer
[*] Translating LLVM bitcode to AR
ikos-analyzer: /tmp/ikos-p_Q2Kq/benchmark.pp.bc: error: unsupported intrinsic function @llvm.x86.avx2.pslli.q
ikos: error: a run-time error occured
For the issue with homebrew, see NASA-SW-VNV/homebrew-core#1
I am investigating the errors with primesieve and libpopcnt. Please give me time.
I fixed a few bugs (see de14a546e30fa9fc0be2f813d34aa4d15ca9d155 and b0c2048582d57926d36a2524bb5545aa8ee53eb3).
Could you try again? Please open separate issues for each different error, thanks.
I have now rebuilt ikos from scratch on Ubuntu 18.04 x64 and clang-7 using your latest code. The good news is that the linker error from Ubuntu I reported earlier has gone away (it was caused by myself by having installed incompatible packages).
Unfortunately ikos still fails to analyse primesieve because of the same issue:
# https://github.com/kimwalisch/primesieve
$ ikos-scan cmake .. -DBUILD_SHARED_LIBS=OFF
$ ikos-scan make
Scanning dependencies of target libprimesieve-static
[ 4%] Building CXX object CMakeFiles/libprimesieve-static.dir/src/api-c.cpp.o
[ 8%] Building CXX object CMakeFiles/libprimesieve-static.dir/src/api.cpp.o
...
[100%] Linking CXX executable primesieve
[100%] Built target primesieve
Analyze primesieve? [Y/n] Y
[*] Running ikos primesieve.bc -o primesieve.db
[*] Running ikos preprocessor
[*] Running ikos analyzer
[*] Translating LLVM bitcode to AR
ikos-analyzer: /tmp/ikos-qrPPF6/primesieve.pp.bc: error: unexpected null pointer in llvm::DICompositeType with DW_TAG_structure_type or DW_TAG_class_type tag
ikos: error: a run-time error occured
ikos also fails to analyse libpopcnt but the error is different from last time:
# https://github.com/kimwalisch/libpopcnt
$ ikos-scan cmake ..
$ ikos-scan make
Scanning dependencies of target benchmark
[ 16%] Building CXX object CMakeFiles/benchmark.dir/benchmark.cpp.o
[ 33%] Linking CXX executable benchmark
...
[100%] Built target test1
Analyze benchmark? [Y/n] Y
[*] Running ikos benchmark.bc -o benchmark.db
[*] Running ikos preprocessor
[*] Running ikos analyzer
[*] Translating LLVM bitcode to AR
ikos-analyzer: /tmp/ikos-m3za0s/benchmark.pp.bc: error: unexpected llvm::BinaryOperator (opcode: add)
ikos: error: a run-time error occured
Hi again, @kimwalisch:
For primesieve, I think the error has been fixed with baecd7f2cee9a187b44fe5728a2232de3ee47b31. Please recompile ikos (master branch) and try again. For libpopcnt, the error is tracked here: #41. I will fix this soon.
The error message has changed using your latest code:
Analyze primesieve? [Y/n] Y
[*] Running ikos primesieve.bc -o primesieve.db
[*] Running ikos preprocessor
[*] Running ikos analyzer
[*] Translating LLVM bitcode to AR
ikos-analyzer: /tmp/ikos-RnR8iJ/primesieve.pp.bc: error: unexpected tag for union member of llvm::DICompositeType
ikos: error: a run-time error occured
This error has been fixed in 94f12518991ab75f3a3ed5cb22080a941f9fb481, please try again.
The previous error has been fixed. But here is a new one ;-)
Analyze primesieve? [Y/n] Y
[*] Running ikos primesieve.bc -o primesieve.db
[*] Running ikos preprocessor
[*] Running ikos analyzer
[*] Translating LLVM bitcode to AR
error: type of parameter %7 of function call 'call @_ZN10primesieve13SievingPrimesC2EPNS_4EratERNS_8PreSieveE($2, %3, %7)' does not match the function type ({0: ui64, 8: ui64, 16: ui64, 24: ui8*, 32: {0: {0: {0: {0: {0: ui8*}}}}}}* != {0: si64, 8: si64, 16: si64, 24: si8*, 32: {0: {0: {0: {0: {0: si8*}}}}}}*)
error: type of parameter %8 of function call 'call @_ZN10primesieve10PrimeSieveC2EPS0_($3, %8)' does not match the function type ({0: si32 (...)**, 8: si64, 16: si64, 24: {0: [6 x si64]}, 72: double, 80: si64, 88: si64, 96: double, 104: si32, 108: si32, 112: {...}*, 120: {0: si64, 8: si64, 16: si64, 24: si8*, 32: {0: {0: {0: {0: {0: si8*}}}}}}}* != {0: si32 (...)**, 8: ui64, 16: ui64, 24: {0: [6 x ui64]}, 72: double, 80: ui64, 88: ui64, 96: double, 104: si32, 108: si32, 112: {...}*, 120: {0: ui64, 8: ui64, 16: ui64, 24: ui8*, 32: {0: {0: {0: {0: {0: ui8*}}}}}}}*)
ikos-analyzer: /tmp/ikos-8WNsCU/primesieve.pp.bc: error: type checker
ikos: error: a run-time error occurred
Could you please send me primesieve.bc
?
I am getting a different error than you:
$ ikos primesieve.bc
[*] Running ikos preprocessor
[*] Running ikos analyzer
[!] ikos was compiled in debug mode, the analysis might be slow
[*] Translating LLVM bitcode to AR
ikos-analyzer: /var/folders/9g/hvg_xszs3q79k8tvtqhm_q5s5y3dxb/T/ikos-12EIuh/primesieve.pp.bc: error: function @_ZNSt3__16__treeINS_12__value_typeINS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEEN12_GLOBAL__N_18OptionIDEEENS_19__map_value_compareIS7_SA_NS_4lessIS7_EELb1EEENS5_ISA_EEE16__construct_nodeIJRKNS_4pairIKS7_S9_EEEEENS_10unique_ptrINS_11__tree_nodeISA_PvEENS_22__tree_node_destructorINS5_ISQ_EEEEEEDpOT_ has more than one ehresume block (use the -mergereturn pass?)
ikos: error: a run-time error occurred
Could you please send me primesieve.bc?
Here it is: primesieve.bc.zip
Thanks, I can reproduce the error. I will need more time to investigate.
Commit caad19f3b0b257b0fac9bdf4f869078312820c4d should fix the issue with primesieve.
If you still have problems, please open new issues. I would like to have one different thread per error message to keep track of the different (often unrelated) bugs.
Thank you.
Hi,
I failed to get it working. Here is my frustrating list of what I have tried:
brew install
I am an expert C/C++ user, it is very rare that I fail to build any C/C++ project!
Below are 2 error messages I encountered:
brew install
.