[klee-dev] Ask for help with Error when apply KLEE to Busybox1.21.0

Daniel Liew daniel.liew at imperial.ac.uk
Thu Nov 28 12:25:13 GMT 2013


Read the error message, the compiler doesn't work, you should read the
generated config.log to find out why it doesn't work.

You can also check what happens when you try to compile a simple C program
$ export LLVM_COMPILER=llvm-gcc
$ export WLLVM_OUTPUT=debug
$ export LLVM_COMPILER_PATH=/home/user/llvm_and_clang/Debug+Asserts/bin
$ wllvm -c hello_world.c
$ wllvm hello_world.o -o hello_world

Most likely something isn't configured properly.

On 28 November 2013 07:59, Wang Shuai <waishuai at hotmail.com> wrote:
> On 11/27/2013 09:31 PM, Daniel Liew wrote:
>> The error message is telling you that the argparse module is missing.
>> This module is a command line argument parser in Python >=2.7. Because
>> that module is missing it probably means your version of python is
>> VERY OUT OF DATE (you can check your version by running python
>> --version) to use wllvm. If it's out of date you should upgrade!
>>
>> If you don't want to install a newer version of python then you can
>> try to use the older version of extract-bc that doesn't have an
>> argument parser (
>> https://github.com/travitch/whole-program-llvm/blob/1256a2e6c5e64fcac97758eeb723d2de47f3d5ce/extract-bc
>> ). I make no guarantees that this will work.
>>
>> Hope that helps,
>> Dan.
>    I followed your advice and changed my OS to ubuntu12.04 which has
> python2.7.3. But after I set up the wllvm, I tried to "CC=wllvm
> ./configure" in the "gzip1.6 "directory. Something was wrong:
>
> checking for a BSD-compatible install... /usr/bin/install -c
> checking whether build environment is sane... yes
> checking for a thread-safe mkdir -p... /bin/mkdir -p
> checking for gawk... no
> checking for mawk... mawk
> checking whether make sets $(MAKE)... yes
> checking whether make supports nested variables... yes
> checking whether make supports nested variables... (cached) yes
> checking for style of include used by make... GNU
> checking for gcc... /home/wang/work/wllvm-gcc/wllvm
> checking whether the C compiler works... no
> configure: error: in `/home/wang/work/projects/gzip-1.6':
> configure: error: C compiler cannot create executables
> See `config.log' for more details
>
> I never met this error in my previous OS. Also, LLVM_GCC works well. Why
> would this happen? Thank you very much.
>>
>> On 27 November 2013 12:28, Wang Shuai <waishuai at hotmail.com> wrote:
>>> On 11/27/2013 01:52 PM, Daniel Liew wrote:
>>>
>>> Hi,
>>>
>>> I would advise using my fork [1] of wllvm instead of klee-gcc for
>>> building programs to LLVM bitcode.
>>>
>>> I don't quite have the same error as you when I use wllvm. Instead I see ...
>>>
>>> ```
>>>
>>> Failed: -Wl,--start-group -lm -Wl,--end-group
>>>
>>>
>>>                   [76/1831]
>>> Output of:
>>> wllvm -fnested-functions -Wall -Wshadow -Wwrite-strings -Wundef
>>> -Wstrict-prototypes -Wunused -Wunused-parameter -Wunused-function
>>> -Wunused-value -Wmissing-prototypes -Wmissing-declarations
>>> -Wno-format-security -Wdeclaration-after-statement
>>>   -Wold-style-definition -fno-builtin-strlen -finline-limit=0
>>> -fomit-frame-pointer -ffunction-sections -fdata-sections
>>> -fno-guess-branch-probability -funsigned-char -static-libgcc
>>> -falign-functions=1 -falign-jumps=1 -falign-labels=1 -falign
>>> -loops=1 -fno-unwind-tables -fno-asynchronous-unwind-tables -Os -o
>>> busybox_unstripped -Wl,--sort-common -Wl,--sort-section,alignment
>>> -Wl,--gc-sections -Wl,--start-group applets/built-in.o archival/lib.a
>>> archival/libarchive/lib.a console-to
>>> ols/lib.a coreutils/lib.a coreutils/libcoreutils/lib.a
>>> debianutils/lib.a e2fsprogs/lib.a editors/lib.a findutils/lib.a
>>> init/lib.a libbb/lib.a libpwdgrp/lib.a loginutils/lib.a
>>> mailutils/lib.a miscutils/lib.a modutils/lib.a networking/lib.a
>>> networking/libiproute/lib.a networking/udhcp/lib.a printutils/lib.a
>>> procps/lib.a runit/lib.a selinux/lib.a shell/lib.a sysklogd/lib.a
>>> util-linux/lib.a util-linux/volume_id/lib.a archival/built-in.o
>>> archival/libarchive/built-in.o console-to
>>> ols/built-in.o coreutils/built-in.o coreutils/libcoreutils/built-in.o
>>> debianutils/built-in.o e2fsprogs/built-in.o editors/built-in.o
>>> findutils/built-in.o init/built-in.o libbb/built-in.o
>>> libpwdgrp/built-in.o loginutils/built-in.o mailutils
>>> /built-in.o miscutils/built-in.o modutils/built-in.o
>>> networking/built-in.o networking/libiproute/built-in.o
>>> networking/udhcp/built-in.o printutils/built-in.o procps/built-in.o
>>> runit/built-in.o selinux/built-in.o shell/built-in.o sysklogd/b
>>> uilt-in.o util-linux/built-in.o util-linux/volume_id/built-in.o
>>> -Wl,--end-group -Wl,--start-group -lm -Wl,--end-group
>>> ==========
>>> networking/lib.a(inetd.o): In function `inetd_main':
>>> networking/inetd.c:(.text.inetd_main+0x261): undefined reference to
>>> `__FDELT'
>>> networking/inetd.c:(.text.inetd_main+0x275): undefined reference to
>>> `__FDMASK'
>>>
>>> ...
>>> ```
>>>
>>> The errors I have are macros that expand to something that is not used
>>> as a symbol (_FDELT and _FDMASK). This seems to have something to do
>>> with llvm-gcc and the macros FD_CLEAR, FD_ISSET, FD_SET and FD_ZERO
>>> (in  lib/gcc/x86_64-unknown-linux-gnu/4.2.1/include/bits/select.h ).
>>>
>>> Anyway the quick way to avoid this issue is to not build the
>>> networking part of busybox by running make menuconfig (you may need
>>> remove .config file first) and then removing the networking bits and
>>> saving your configuration then building.
>>>
>>> If I do this then I can successfully build busybox using wllvm with
>>> llvm-gcc provided I also add to CFLAGS in Makefile.flags
>>> -fnested-functions i.e.
>>>
>>> CFLAGS += -fnested-function
>>>
>>> Hope that helps,
>>> Dan Liew
>>>
>>> [1] Make sure you use llvm-gcc branch of repository
>>> https://github.com/delcypher/whole-program-llvm/tree/llvm-gcc
>>>
>>> On 27 November 2013 03:29, 王帅 <waishuai at hotmail.com> wrote:
>>>
>>> Hi guys,
>>>     Recently, I'm trying to apply KLEE to busybox1.21.0. I followed the
>>> subsequent steps:
>>>
>>> mkdir obj-klee
>>> make -w O=obj-klee defconfig
>>> cd obj-klee
>>> make CC=klee-gcc LD="llvm-ld --disable-opt" AR=llvm-ar SKIP_STRIP=y V=1
>>> make CC=/home/wang/work/klee/scripts/klee-gcc LD="llvm-ld --disable-opt"
>>> SKIP_STRIP=y V=1 AR=llvm-ar CFLAGS=-fnested-functions
>>>
>>>
>>>    But,an error happened:
>>>
>>> ------------------------
>>> -------------------------
>>> ------------------------
>>>
>>> Trying libraries: m
>>> Failed: -Wl,--start-group -lm -Wl,--end-group
>>> Output of:
>>> /home/wang/work/klee/scripts/klee-gcc -fnested-functions -o
>>> busybox_unstripped -Wl,--start-group applets/built-in.o archival/lib.a
>>> archival/libarchive/lib.a console-tools/lib.a coreutils/lib.a
>>> coreutils/libcoreutils/lib.a debianutils/lib.a e2fsprogs/lib.a editors/lib.a
>>> findutils/lib.a init/lib.a libbb/lib.a libpwdgrp/lib.a loginutils/lib.a
>>> mailutils/lib.a miscutils/lib.a modutils/lib.a networking/lib.a
>>> networking/libiproute/lib.a networking/udhcp/lib.a printutils/lib.a
>>> procps/lib.a runit/lib.a selinux/lib.a shell/lib.a sysklogd/lib.a
>>> util-linux/lib.a util-linux/volume_id/lib.a archival/built-in.o
>>> archival/libarchive/built-in.o console-tools/built-in.o coreutils/built-in.o
>>> coreutils/libcoreutils/built-in.o debianutils/built-in.o
>>> e2fsprogs/built-in.o editors/built-in.o findutils/built-in.o init/built-in.o
>>> libbb/built-in.o libpwdgrp/built-in.o loginutils/built-in.o
>>> mailutils/built-in.o miscutils/built-in.o modutils/built-in.o
>>> networking/built-in.o networking/libiproute/built-in.o
>>> networking/udhcp/built-in.o printutils/built-in.o procps/built-in.o
>>> runit/built-in.o selinux/built-in.o shell/built-in.o sysklogd/built-in.o
>>> util-linux/built-in.o util-linux/volume_id/built-in.o -Wl,--end-group
>>> -Wl,--start-group -lm -Wl,--end-group
>>> ==========
>>> llvm-ld: error: Cannot find linker input 'selinux/lib.a'
>>> make[2]: *** [busybox_unstripped] Error 1
>>> make[1]: *** [_all] Error 2
>>> make: *** [all] Error 2
>>>
>>>
>>>    When I check selinux/lib.a, the file is there, but it contains only a
>>> single line with: "!<arch>" . Someone can help me ? If any, could you tell
>>> me how to solve it? I'm really hurried with this test. Thank you very much
>>> for advance!
>>>
>>> Thank know for your advice! It really helps me. Busybox 1.21.0 build
>>> successfully. But when I wanted to use extract-bc busybox_unstripped to
>>> generate LLVM bitcode, another error happened
>>>
>>> Traceback (most recent call last):
>>>    File "/home/wang/work/wllvm-gcc/extract-bc", line 269, in <module>
>>>      sys.exit(main(sys.argv))
>>>    File "/home/wang/work/wllvm-gcc/extract-bc", line 212, in main
>>>      import argparse
>>> ImportError: No module named argparse
>>>
>>> I also tried to apply wllvm to gzip1.6. There was the same error. Why? Was
>>> there something wrong with my instructions?
>>>
>>> export LLVM_COMPILER=llvm-gcc
>>> export LLVM_COMPILER_PATH=/home/wang/work/llvm-2.9/Release+Asserts/bin
>>> export WLLVM_OUTPUT=DEBUG
>>>
>>> make CC=wllvm defconfig
>>> make CC=wllvm
>>> extract-bc busybox_unstripped
>>>
>>>
>>>
>>>
>>>
>>
>




More information about the klee-dev mailing list