LLVM + KLEE: 'main' function not found in module - llvm

Im trying to set up Klee for a project and Im running into difficulties when testing coreutils as per http://klee.llvm.org/TestingCoreutils.html
src$ $KLEE cut.bc
'main' function not found in module.
*** glibc detected *** /home/klee/Development//klee-build/Debug+Asserts/bin/klee: double free or corruption (!prev): 0x0000000003a79850 ***
The problem is most likely with the llvm build itself, not Klee, because when I dissasemble the .bc files with llvm-dis, only the module ID is there, no actual code
Looking at the build output, what strikes me as odd is this:
Potential incompatible plugin version. GCC: 4.6 (20120301). Expected: 4.6 (20120301)
Defines 'dragonegg_disable_version_check' as env variable to remove this warning
Please note that unexpected errors might occur.
Any ideas are appreaciated.

The problem is with your LLVM version. KLEE is not yet compatible with llvm3.0 or later. Try building one of llvm 2.7 .. 2.9.

Related

How to correct path to overcome Error 127?

I'm trying to run a c++ file which requires an mkl library. I installed that library in a folder on home. But I'm getting following error. I searched that this error is due to incorrect path assign. How can I correct that path?
`/public/intel/bin/icpc -g -I/public/intel/mkl/include -c main.cc
make: /public/intel/bin/icpc: Command not found
[main.o] Error 127
makefile:6: recipe for target 'main.o' failed
make: *** [main.o] Error 127`
Jerry,
It looks like you are using Linux or UNIX. Also it looks like you are trying to use ICC (the Intel compiler) with MKL. If you are using ICC, the Linux compile command is "icc", the Windows compile command is "icl".
Beyond that, you need to source the ??vars.sh files if you have not set the environment variables manually. For example, if you installed Parallel Studio, you would set up compiler environment variables as explained here: https://software.intel.com/en-us/articles/setting-up-the-build-environment-for-using-intel-c-or-fortran-compilers; and you would set up MKL environment variables as explained here: https://software.intel.com/en-us/mkl-linux-developer-guide-scripts-to-set-environment-variables.
Let me know if this helps.

Can't generate SDK for Windows with Yocto

I've build a Linux image for freescale imx6qpsabreai board and SDK with toolchain which works well on Linux.
Now I want to support development on Windows and following this post I've
downloaded oe meta-mingw into sources/meta-openembedded/meta-mingw
added SDKMACHINE=x86_64-mingw32 to local.conf in my project
however, I can't build new SDK this way.
~/yocto/fsl-community-bsp/build_fsl_framebuffer$ bitbake fsl-image-machine-test -c populate_sdk
Loading cache: 100% |###############################################################################################################################################################################| Time: 0:00:00
Loaded 2 entries from dependency cache.
ERROR: /home/slavskaya/yocto/fsl-community-bsp/sources/meta-openembedded/meta-mingw/recipes-support/libiconv/libiconv_1.14.bb: Error executing a python function in <code>: | ETA: --:--:--
The stack trace of python calls that resulted in this exception/failure was:
File: '<code>', lineno: 13, function: <module>
0009:__anon_35__home_slavskaya_yocto_fsl_community_bsp_sources_poky_meta_classes_devshell_bbclass(d)
0010:__anon_106__home_slavskaya_yocto_fsl_community_bsp_sources_poky_meta_classes_sstate_bbclass(d)
0011:__anon_45__home_slavskaya_yocto_fsl_community_bsp_sources_poky_meta_classes_blacklist_bbclass(d)
0012:__anon_158__home_slavskaya_yocto_fsl_community_bsp_sources_poky_meta_classes_siteinfo_bbclass(d)
*** 0013:__anon_31__home_slavskaya_yocto_fsl_community_bsp_sources_meta_openembedded_meta_mingw_recipes_support_libiconv_libiconv_1_14_bb(d)
File: '/home/slavskaya/yocto/fsl-community-bsp/sources/meta-openembedded/meta-mingw/recipes-support/libiconv/libiconv_1.14.bb', lineno: 28, function: __anon_31__home_slavskaya_yocto_fsl_community_bsp_sources_meta_openembedded_meta_mingw_recipes_support_libiconv_libiconv_1_14_bb
0024:inherit autotools pkgconfig gettext
0025:
0026:python __anonymous() {
0027: if d.getVar("TARGET_OS") != "linux":
*** 0028: return
0029: if d.getVar("TCLIBC") == "glibc":
0030: raise bb.parse.SkipPackage("libiconv is provided for use with uClibc only - glibc already provides iconv")
0031:}
0032:
Exception: TypeError: getVar() missing 1 required positional argument: 'expand'
ERROR: Failed to parse recipe: /home/slavskaya/yocto/fsl-community-bsp/sources/meta-openembedded/meta-mingw/recipes-support/libiconv/libiconv_1.14.bb
Summary: There were 2 ERROR messages shown, returning a non-zero exit code.
Also, I am not an experienced C/C++ programmer, but from my point of view mingw doesn't contain compiler for arm architecture, so maybe I just can't get arm toolchain to use on Windows?
meta-mingw builds a cross compile from Linux to Windows (mingw). It then uses this cross compiler to construct a standard toolchain from (mingw) to the target SDK environment. You are using the correct layer, but have a different problem.
It appears that you are using a layer (meta-mingw) that is expecting the newer bitbake semantics:
0027: if d.getVar("TARGET_OS") != "linux":
*** 0028: return
Exception: TypeError: getVar() missing 1 required positional argument: 'expand'
Bitbake used to require two arguments to 'd.getVar', and now only requires one (the second is optional).
I would suggest that you identify which version of oe-core/poky you are using and get a matching version of meta-mingw. (It may be as simple as checking out the correct branch.)

Compile z3 on Raspberry

Let me first of all apologize in case the question is unnecassary, but I am very new to modifiying compilers and cross architectural designs.
In order to evaluate the performance on various platforms I have been trying to compile the Z3 SMT solver on a raspberry pi 2. However there seems to be a problem due to the arm architecture. My intention so far was to use the configure script supplied by Mircrosoft Research, which works neatly and produces the following outcome:
Testing ar...
Testing g++...
Testing gcc...
Testing OpenMP...
Host platform: Linux
C++ Compiler: g++
C Compiler : gcc
Arithmetic: internal
OpenMP: True
Prefix: /usr
64-bit: False
Python version: 2.7
Writing build/Makefile
Copied Z3Py example 'example.py' to 'build'
Makefile was successfully generated.
python packages dir: /usr/lib/python2.7/dist-packages
compilation mode: Release
Type 'cd build; make' to build Z3
When building I first of all encouter the problem:
src/shell/install_tactic.cpp
cc1plus: error: unrecognized command line option '-mfpmath=sse'
cc1plus: error: unrecognized command line option 'u2018-msse'
cc1plus: error: unrecognized command line option 'u2018-msse2'
Makefile:3159: recipe for target 'shell/install_tactic.o' failed
make: *** [shell/install_tactic.o] Error 1
If I understood the meaning of this error correctly, these commad line options refer to clever tatics used to compute mathematical exercises and are not necessary if performance is not an issue. (Simply speaking, it should still work, even if it is slower).Removing the flags from the respective config.mk, allows building to a certain extend.
After sucessfully producing a lot of outcome files, the make process terminates with the following error:
src/util/hwf.cpp
../src/util/hwf.cpp:55:23: fatal error: emmintrin.h: Datei oder Verzeichnis nicht gefunden
compilation terminated.
Makefile:163: recipe for target 'util/hwf.o' failed
make: *** [util/hwf.o] Error 1
My question now is, whether it is again possible to compile without using emmintrin.h (simply copying the missing library to the Pi does not work, due to architectural hurdles). Has anyone ever done this?
Thank you in advance for all you helpful comments.
Both, the unsupported options and the error in hwf.cpp refer to the support for floating-point operations in Z3. The options are trying to make sure that the floating-point unit is set up correctly, and the error in hwf.cpp is because we're trying to get to hardware intrinsics for floating point operations. Essentially, the consequences of those changes are that some floating-point operations may be imprecise if those options are removed; however, not many pieces of Z3 rely on that, so it's unlikely you'll see errors later.
I do have a RPi at home, so I'll see whether we can use different options for that when I get home tonight. It may be that the RPi doesn't have a floating point unit at all though, in that case I'll have to switch it to soft floats (which we also have support for, but it may be slower).

Error in compiling when installing Stan for R and when using Rcpp

I need to install Rstan for a data analysis class. The instructions are posted here http://code.google.com/p/stan/wiki/RStanGettingStarted. I'm running Mac OS 10.5.8 and R 2.15.1 GUI 1.52 Leopard build 32-bit (6188). I just installed Xcode version 3.1.4, the Xcode c++ compiler that is compatible with leopard (I had to get a mac developer account to do this).
Per the Stan installation instruction, I entered the following code to see if my compiler was working:
library(inline)
library(Rcpp)
src <- '
std::vector<std::string> s;
s.push_back("hello");
s.push_back("world");
return Rcpp::wrap(s);
'
hellofun <- cxxfunction(body = src, includes = '', plugin = 'Rcpp', verbose = FALSE)
cat(hellofun(), '\n')
It returns the following error:
Error in compileCode(f, code, language = language, verbose = verbose) :
Compilation ERROR, function(s)/method(s) not created!
Library/Frameworks/R.framework/Versions/2.15/Resources/library/
Rcpp/include/Rcpp/internal/export.h: In function ‘void
Rcpp::internal::export_range__dispatch(SEXPREC*, InputIterator,
Rcpp::traits::r_type_primitive_tag)’:
/Library/Frameworks/R.framework/Versions/2.15/Resources/
library/Rcpp/include/Rcpp/internal/export.h:56: internal
compiler error: Bus error
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://developer.apple.com/bugreporter> for
instructions.
make: *** [file795214e66510.o] Error 1
In addition: Warning message:
running command '/Library/Frameworks/R.framework/Resources/bin/
R CMD SHLIB file795214e66510.cpp 2>
file795214e66510.cpp.err.txt' had status 1
When I try to install stan:
install.packages('rstan', type = 'source') ]
I get this warning:
Warning message:
In install.packages("rstan", type = "source") :
installation of package ‘rstan’ had non-zero exit status
I have no idea how C++ works. All of my coding experience is in R and has not before required compiling into C++. I've been trying really hard to figure out what's wrong for the last 4 hours or so, googling these error messages over and over without much luck. Any help would be greatly appreciated and would also help about 10 other students in my class who are having identical or analogous problems. Thank you very, very much.
This looks to me like an issue with the installation of your C++ compiler or with your installation of the Rcpp package, rather than an issue with the rstan package. However, if g++ is causing an intractable problem for you, an alternative is the clang compiler, which should work with Rcpp and rstan if you create $HOME/.R/Makevars with these two lines
CC=clang
CXX=clang++
As mentioned in another answer, the first step is to get Rcpp working on your Mac (i.e,. at least pass the hello world example).
A similar issue for Rcpp previously:
https://stat.ethz.ch/pipermail/r-sig-mac/2010-July/007574.html
In addition, from this webpage http://useyourloaf.com/blog/2011/03/21/compiler-options-in-xcode-gcc-or-llvm.html, it seems that gcc 4.2 and 4.0 are both in Xcode 3.14 (not sure as it does not say it's 3.14). So try to make sure gcc 4.2.1 is used by R is important. Executing the following in a terminal will show what is the current version of gcc.
$ g++ -v

Cross-Compiling gcc

I am following the instructions here for cross-compiling GCC. I am on a mac. When I run this command from the gcc source folder: ./configure --target=i586-elf --prefix=/usr/local/cross --disable-nls --without-headers --enable-languages=c,ada,c++,fortran,java,objc,obj-c++,treelang I get this error: configure: error: GMP 4.1 and MPFR 2.2.1 or newer versions required by fortran. When I change the command to this (I couln't compile GMP): ./configure --target=i586-elf --prefix=/usr/local/cross --disable-nls --without-headers --enable-languages=c,ada,c++,java,objc,obj-c++,treelang I get this error:
The following requested languages could not be built: ada
Recognised languages are: c,ada,c++,fortran,java,objc,obj-c++,treelang
which doesn't make sense to me because it says ada is recognized. All other configurations of the enable-languages settings (and when the setting isn't changed and the default is used) give me this error:
/usr/local/cross/i586-elf/bin/ranlib ./libgcov.a
_error_not_here_yet - havent even thought about it - it may even work
make[1]: _error_not_here_yet: Command not found
make[1]: *** [treelang.all.cross] Error 127
make: *** [all-gcc] Error 2
How can I cross compile GCC?
Are you running configure from the gcc source tree? If so: don't do that. Follow the instructions (verbatim) in the page you linked to.
Look carefully and you'll notice that they're running the configure command from outside the gcc source tree.
If your platform is supported by it, the crosstool script (also linked from the bottom of your instructions page) is very helpful.
Edit: As potatoswatter points out in a comment, your installation is probably hosed at this point. Remove the whole tree and start from scratch. (It sounds like it will take too long, and you'll want to take a short cut, but it will be faster in the end if you just start from scratch now.)