NASA-SW-VnV / ikos

Static analyzer for C/C++ based on the theory of Abstract Interpretation.
Other
2.03k stars 152 forks source link

Failed to get it working #20

Closed kimwalisch closed 5 years ago

kimwalisch commented 5 years ago

Hi,

I failed to get it working. Here is my frustrating list of what I have tried:

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:

  1. The first error message is from brew install.
  2. The second error message is from building ikos from source on macOS Mojave using clang++-7.
$ brew install nasa-sw-vnv/core/ikos
Updating Homebrew...
==> Auto-updated Homebrew!
Updated 1 tap (homebrew/core).
==> Updated Formulae
mutt

==> Tapping nasa-sw-vnv/core
Cloning into '/usr/local/Homebrew/Library/Taps/nasa-sw-vnv/homebrew-core'...
remote: Enumerating objects: 7, done.
remote: Counting objects: 100% (7/7), done.
remote: Compressing objects: 100% (7/7), done.
remote: Total 7 (delta 0), reused 5 (delta 0), pack-reused 0
Unpacking objects: 100% (7/7), done.
Tapped 2 formulae (34 files, 32.5KB).
==> Installing ikos from nasa-sw-vnv/core
==> Installing dependencies for nasa-sw-vnv/core/ikos: ppl and apron
==> Installing nasa-sw-vnv/core/ikos dependency: ppl
==> Downloading https://homebrew.bintray.com/bottles/ppl-1.2.mojave.bottle.1.tar.gz
==> Downloading from https://akamai.bintray.com/59/59aa81dbfdc59de055e528724282fb0a1f7c627fc4bbc2f6b2d026e0
######################################################################## 100.0%
==> Pouring ppl-1.2.mojave.bottle.1.tar.gz
🍺  /usr/local/Cellar/ppl/1.2: 1,882 files, 43.4MB
==> Installing nasa-sw-vnv/core/ikos dependency: apron
==> Downloading http://apron.cri.ensmp.fr/library/apron-0.9.10.tgz
######################################################################## 100.0%
==> Patching
patching file ppl/ppl_user.cc
patching file products/Makefile
==> make APRON_PREFIX=/usr/local/Cellar/apron/0.9.10 GMP_PREFIX=/usr/local/opt/gmp MPFR_PREFIX=/usr/local/o
🍺  /usr/local/Cellar/apron/0.9.10: 125 files, 8.8MB, built in 1 minute 40 seconds
==> Installing nasa-sw-vnv/core/ikos
==> Downloading https://github.com/nasa-sw-vnv/ikos/releases/download/v2.1/ikos-2.1.tar.gz
==> Downloading from https://github-production-release-asset-2e65be.s3.amazonaws.com/107311216/92e8fc00-fc91-11e8-9865-791f35ccb369?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYA
######################################################################## 100.0%
==> Downloading https://files.pythonhosted.org/packages/4e/8b/75469c270ac544265f0020aa7c4ea925c5284b23e445cf3aa8b99f662690/virtualenv-16.1.0.tar.gz
######################################################################## 100.0%
==> python -c import setuptools... --no-user-cfg install --prefix=/private/tmp/ikos--homebrew-virtualenv-20181212-90845-13xpewv/target --install-scripts=/private/tmp/ikos--homebrew-virtualenv-
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-20181212-90845-13xpewv/target
--install-scripts=/private/tmp/ikos--homebrew-virtualenv-20181212-90845-13xpewv/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

/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>'
$ 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"
-- The C compiler identification is Clang 7.0.0
-- The CXX compiler identification is Clang 7.0.0
-- Check for working C compiler: /usr/local/opt/llvm@7/bin/clang
-- Check for working C compiler: /usr/local/opt/llvm@7/bin/clang -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/local/opt/llvm@7/bin/clang++
-- Check for working CXX compiler: /usr/local/opt/llvm@7/bin/clang++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- All libraries and binaries will be installed in /Users/kim/Downloads/ikos-master/install
-- Including core
-- All libraries and binaries will be installed in /Users/kim/Downloads/ikos-master/install
-- Found Boost: /usr/local/include (found version "1.68.0")
-- Found the following Boost libraries:
--   unit_test_framework
-- Found GMP: /usr/local/include  
-- Found MPFR: /usr/local/include (Required is at least version "1.0.0") 
-- Found PPL: /usr/local/Cellar/ppl/1.2/include  
-- Found APRON: /usr/local/include  
-- Performing Test CXX_SUPPORTS_CXX14
-- Performing Test CXX_SUPPORTS_CXX14 - Success
-- Performing Test CXX_SUPPORTS_FVISIBILITY_INLINES_HIDDEN
-- Performing Test CXX_SUPPORTS_FVISIBILITY_INLINES_HIDDEN - Success
-- Performing Test CXX_SUPPORTS_WALL
-- Performing Test CXX_SUPPORTS_WALL - Success
-- Performing Test CXX_SUPPORTS_WEXTRA
-- Performing Test CXX_SUPPORTS_WEXTRA - Success
-- Performing Test CXX_SUPPORTS_WEVERYTHING
-- Performing Test CXX_SUPPORTS_WEVERYTHING - Success
-- Performing Test CXX_SUPPORTS_WNO_SWITCH_ENUM
-- Performing Test CXX_SUPPORTS_WNO_SWITCH_ENUM - Success
-- Performing Test CXX_SUPPORTS_WNO_PADDED
-- Performing Test CXX_SUPPORTS_WNO_PADDED - Success
-- Performing Test CXX_SUPPORTS_WNO_CXX98_COMPAT
-- Performing Test CXX_SUPPORTS_WNO_CXX98_COMPAT - Success
-- Performing Test CXX_SUPPORTS_WNO_CXX98_COMPAT_PEDANTIC
-- Performing Test CXX_SUPPORTS_WNO_CXX98_COMPAT_PEDANTIC - Success
-- Performing Test CXX_SUPPORTS_WNO_C99_EXTENSIONS
-- Performing Test CXX_SUPPORTS_WNO_C99_EXTENSIONS - Success
-- Performing Test CXX_SUPPORTS_WNO_COVERED_SWITCH_DEFAULT
-- Performing Test CXX_SUPPORTS_WNO_COVERED_SWITCH_DEFAULT - Success
-- Performing Test CXX_SUPPORTS_WNO_EXIT_TIME_DESTRUCTORS
-- Performing Test CXX_SUPPORTS_WNO_EXIT_TIME_DESTRUCTORS - Success
-- Performing Test CXX_SUPPORTS_WNO_GLOBAL_CONSTRUCTORS
-- Performing Test CXX_SUPPORTS_WNO_GLOBAL_CONSTRUCTORS - Success
-- Performing Test CXX_SUPPORTS_WNO_WEAK_VTABLES
-- Performing Test CXX_SUPPORTS_WNO_WEAK_VTABLES - Success
-- Performing Test CXX_SUPPORTS_WNO_DISABLED_MACRO_EXPANSION
-- Performing Test CXX_SUPPORTS_WNO_DISABLED_MACRO_EXPANSION - Success
-- Found Doxygen: /usr/local/bin/doxygen (found version "1.8.14") found components:  doxygen dot 
-- Including ar
-- All libraries and binaries will be installed in /Users/kim/Downloads/ikos-master/install
-- Found Boost: /usr/local/include (found version "1.68.0")
-- Including frontend/llvm
-- All libraries and binaries will be installed in /Users/kim/Downloads/ikos-master/install
-- Found Boost: /usr/local/include (found version "1.68.0")
-- Found the following Boost libraries:
--   filesystem
--   system
-- Found LLVM: /usr/local/Cellar/llvm/7.0.0_1 (found version "7.0.0") 
-- Performing Test LLVM_NO_OLD_LIBSTDCXX
-- Performing Test LLVM_NO_OLD_LIBSTDCXX - Success
-- Performing Test C_SUPPORTS_FPIC
-- Performing Test C_SUPPORTS_FPIC - Success
-- Performing Test CXX_SUPPORTS_FPIC
-- Performing Test CXX_SUPPORTS_FPIC - Success
-- Building with -fPIC
-- Performing Test SUPPORTS_FVISIBILITY_INLINES_HIDDEN_FLAG
-- Performing Test SUPPORTS_FVISIBILITY_INLINES_HIDDEN_FLAG - Success
-- Performing Test C_SUPPORTS_WERROR_DATE_TIME
-- Performing Test C_SUPPORTS_WERROR_DATE_TIME - Success
-- Performing Test CXX_SUPPORTS_WERROR_DATE_TIME
-- Performing Test CXX_SUPPORTS_WERROR_DATE_TIME - Success
-- Performing Test C_SUPPORTS_WERROR_UNGUARDED_AVAILABILITY_NEW
-- Performing Test C_SUPPORTS_WERROR_UNGUARDED_AVAILABILITY_NEW - Success
-- Performing Test CXX_SUPPORTS_WERROR_UNGUARDED_AVAILABILITY_NEW
-- Performing Test CXX_SUPPORTS_WERROR_UNGUARDED_AVAILABILITY_NEW - Success
-- Performing Test CXX_SUPPORTS_CXX11
-- Performing Test CXX_SUPPORTS_CXX11 - Success
-- Linker detection: ld64
-- Including analyzer
-- All libraries and binaries will be installed in /Users/kim/Downloads/ikos-master/install
-- Found Boost: /usr/local/include (found version "1.68.0")
-- Found the following Boost libraries:
--   filesystem
--   system
-- Found SQLite3: /Library/Frameworks/Mono.framework/Headers  
-- Found PythonInterp: /usr/bin/python (found version "2.7.10") 
-- Building with -fPIC
-- Linker detection: ld64
-- Found Clang: /usr/local/Cellar/llvm/7.0.0_1/bin/clang (found version "7.0.0") 
-- Performing Test CXX_SUPPORTS_WNO_UNUSED_LOCAL_TYPEDEFS
-- Performing Test CXX_SUPPORTS_WNO_UNUSED_LOCAL_TYPEDEFS - Success
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/kim/Downloads/ikos-master/build
Delphines-MBP:build kim$ time make -j8
Scanning dependencies of target ikos-python
Scanning dependencies of target ikos-llvm-to-ar
Scanning dependencies of target ikos-pp-lib
Scanning dependencies of target ikos-ar
[  1%] Generating python/ikos/settings/__init__.py
[  1%] Generating python/build/lib/ikos/__init__.py
[  3%] Building CXX object frontend/llvm/CMakeFiles/ikos-pp-lib.dir/src/pass/initialize.cpp.o
[  5%] Building CXX object frontend/llvm/CMakeFiles/ikos-pp-lib.dir/src/pass/lower_cst_expr.cpp.o
[  5%] Building CXX object frontend/llvm/CMakeFiles/ikos-pp-lib.dir/src/pass/mark_internal_inline.cpp.o
[  5%] Building CXX object frontend/llvm/CMakeFiles/ikos-pp-lib.dir/src/pass/lower_select.cpp.o
[  6%] Building CXX object frontend/llvm/CMakeFiles/ikos-pp-lib.dir/src/pass/mark_no_return_function.cpp.o
[  6%] Built target ikos-python
[  6%] Building CXX object frontend/llvm/CMakeFiles/ikos-pp-lib.dir/src/pass/name_values.cpp.o
[  8%] Building CXX object frontend/llvm/CMakeFiles/ikos-llvm-to-ar.dir/src/import/bundle.cpp.o
[ 10%] Building CXX object ar/CMakeFiles/ikos-ar.dir/src/format/dot.cpp.o
[ 10%] Building CXX object frontend/llvm/CMakeFiles/ikos-llvm-to-ar.dir/src/import/constant.cpp.o
[ 10%] Building CXX object ar/CMakeFiles/ikos-ar.dir/src/format/namer.cpp.o
[ 11%] Building CXX object frontend/llvm/CMakeFiles/ikos-llvm-to-ar.dir/src/import/data_layout.cpp.o
[ 13%] Building CXX object ar/CMakeFiles/ikos-ar.dir/src/format/text.cpp.o
[ 13%] Building CXX object frontend/llvm/CMakeFiles/ikos-llvm-to-ar.dir/src/import/exception.cpp.o
[ 15%] Building CXX object frontend/llvm/CMakeFiles/ikos-pp-lib.dir/src/pass/remove_printf_calls.cpp.o
[ 15%] Building CXX object ar/CMakeFiles/ikos-ar.dir/src/pass/add_loop_counters.cpp.o
[ 15%] Building CXX object frontend/llvm/CMakeFiles/ikos-pp-lib.dir/src/pass/remove_unreachable_blocks.cpp.o
[ 16%] Building CXX object ar/CMakeFiles/ikos-ar.dir/src/pass/name_values.cpp.o
[ 18%] Building CXX object frontend/llvm/CMakeFiles/ikos-llvm-to-ar.dir/src/import/function.cpp.o
[ 18%] Building CXX object ar/CMakeFiles/ikos-ar.dir/src/pass/pass.cpp.o
[ 20%] Linking CXX static library libikos-pp.a
[ 20%] Building CXX object frontend/llvm/CMakeFiles/ikos-llvm-to-ar.dir/src/import/importer.cpp.o
[ 20%] Built target ikos-pp-lib
[ 21%] Building CXX object ar/CMakeFiles/ikos-ar.dir/src/pass/simplify_cfg.cpp.o
[ 23%] Building CXX object frontend/llvm/CMakeFiles/ikos-llvm-to-ar.dir/src/import/library_function.cpp.o
Scanning dependencies of target ikos-pp
[ 23%] Building CXX object ar/CMakeFiles/ikos-ar.dir/src/pass/unify_exit_nodes.cpp.o
[ 25%] Building CXX object frontend/llvm/CMakeFiles/ikos-pp.dir/src/ikos_pp.cpp.o
[ 25%] Building CXX object frontend/llvm/CMakeFiles/ikos-llvm-to-ar.dir/src/import/source_location.cpp.o
[ 26%] Building CXX object frontend/llvm/CMakeFiles/ikos-llvm-to-ar.dir/src/import/type.cpp.o
[ 28%] Building CXX object ar/CMakeFiles/ikos-ar.dir/src/pass/simplify_upcast_comparison.cpp.o
[ 28%] Building CXX object ar/CMakeFiles/ikos-ar.dir/src/semantic/bundle.cpp.o
[ 30%] Building CXX object ar/CMakeFiles/ikos-ar.dir/src/semantic/code.cpp.o
[ 30%] Building CXX object ar/CMakeFiles/ikos-ar.dir/src/semantic/context.cpp.o
[ 31%] Building CXX object ar/CMakeFiles/ikos-ar.dir/src/semantic/context_impl.cpp.o
[ 31%] Building CXX object ar/CMakeFiles/ikos-ar.dir/src/semantic/data_layout.cpp.o
[ 33%] Building CXX object ar/CMakeFiles/ikos-ar.dir/src/semantic/function.cpp.o
[ 33%] Building CXX object ar/CMakeFiles/ikos-ar.dir/src/semantic/intrinsic.cpp.o
[ 35%] Building CXX object ar/CMakeFiles/ikos-ar.dir/src/semantic/statement.cpp.o
[ 35%] Building CXX object ar/CMakeFiles/ikos-ar.dir/src/semantic/type.cpp.o
[ 35%] Linking CXX executable ikos-pp
[ 36%] Building CXX object ar/CMakeFiles/ikos-ar.dir/src/semantic/value.cpp.o
[ 36%] Built target ikos-pp
[ 36%] Building CXX object ar/CMakeFiles/ikos-ar.dir/src/verify/frontend.cpp.o
[ 38%] Building CXX object ar/CMakeFiles/ikos-ar.dir/src/verify/type.cpp.o
[ 38%] Linking CXX static library libikos-llvm-to-ar.a
[ 38%] Built target ikos-llvm-to-ar
[ 38%] Linking CXX static library libikos-ar.a
[ 38%] Built target ikos-ar
Scanning dependencies of target ikos-import
Scanning dependencies of target ikos-analyzer
[ 40%] Building CXX object frontend/llvm/CMakeFiles/ikos-import.dir/src/ikos_import.cpp.o
[ 40%] Building CXX object analyzer/CMakeFiles/ikos-analyzer.dir/src/analysis/call_context.cpp.o
[ 41%] Building CXX object analyzer/CMakeFiles/ikos-analyzer.dir/src/ikos_analyzer.cpp.o
[ 43%] Building CXX object analyzer/CMakeFiles/ikos-analyzer.dir/src/analysis/fixpoint_profile.cpp.o
[ 43%] Building CXX object analyzer/CMakeFiles/ikos-analyzer.dir/src/analysis/hardware_addresses.cpp.o
[ 45%] Building CXX object analyzer/CMakeFiles/ikos-analyzer.dir/src/analysis/literal.cpp.o
[ 45%] Building CXX object analyzer/CMakeFiles/ikos-analyzer.dir/src/analysis/liveness.cpp.o
[ 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>;
...
arthaud commented 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.

kimwalisch commented 5 years ago

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 installstill 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
kimwalisch commented 5 years ago

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
...
kimwalisch commented 5 years ago

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
arthaud commented 5 years ago

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.

arthaud commented 5 years ago

I fixed a few bugs (see de14a546e30fa9fc0be2f813d34aa4d15ca9d155 and b0c2048582d57926d36a2524bb5545aa8ee53eb3).

Could you try again? Please open separate issues for each different error, thanks.

kimwalisch commented 5 years ago

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
arthaud commented 5 years ago

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.

kimwalisch commented 5 years ago

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
arthaud commented 5 years ago

This error has been fixed in 94f12518991ab75f3a3ed5cb22080a941f9fb481, please try again.

kimwalisch commented 5 years ago

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
arthaud commented 5 years ago

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
kimwalisch commented 5 years ago

Could you please send me primesieve.bc?

Here it is: primesieve.bc.zip

arthaud commented 5 years ago

Thanks, I can reproduce the error. I will need more time to investigate.

arthaud commented 5 years ago

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.