Hi Nicholas,

On Thu, Oct 15, 2009 at 5:16 PM, Nicholas S. Childers
<nickchilders at umail.ucsb.edu> wrote:
> I was able to quickly get klee up and running on an x86_64 machine and
> confirmed that the two tutorials worked, however I am getting compile
> time errors when trying to build the klee version of uclibc.
>
> My first thought was to read though this mailing list and I noticed
> that x86_64 bit support is rather new. Thus, I was wondering if anyone
> had tested the uclibc library.

Yes, I have built it and verified some basic things work (with
coreutils). However, I haven't done extensive testing yet.

> After that, I tried simply hacking my
> way to victory, but did not get very far.
>
> The first problem was this:
> In file included from /usr/include/asm/posix_types.h:4,
> ? ? ? ? ? ? ? ? ?from /usr/include/linux/posix_types.h:47,
> ? ? ? ? ? ? ? ? ?from /usr/include/linux/types.h:5,
> ? ? ? ? ? ? ? ? ?from /usr/include/linux/if_ether.h:24,
> ? ? ? ? ? ? ? ? ?from ./include/netinet/if_ether.h:26,
> ? ? ? ? ? ? ? ? ?from ./include/netinet/ether.h:26,
> ? ? ? ? ? ? ? ? ?from libc/inet/ether_addr.c:31:
> /usr/include/asm/posix_types_64.h:10: error: redefinition of typedef
> '__kernel_ino_t'
> ./include/bits/kernel_types.h:11: error: previous declaration of
> '__kernel_ino_t' was here
> ...
> (more redefinition errors)
>
> A quick glance at the offending header files show that a #define that
> is supposed to match posix_types does not in fact
> match(_ASM_X86_POSIX_TYPES_64_H vs _ASM_X86_64_POSIX_TYPES_H). Hacking
> that header file seems to work, but another error crops up:
>
> In file included from libc/stdlib/strtol_l.c:8:
> libc/stdlib/stdlib.c:346: error: conflicting types for 'strtoll_l'
> ./include/stdlib.h:266: error: previous declaration of 'strtoll_l' was here
> libc/stdlib/stdlib.c:348: error: conflicting types for 'strtoll_l'
> ./include/stdlib.h:266: error: previous declaration of 'strtoll_l' was here

Yup, I had both these problems as well. I didn't feel like finding a
proper solution to the latter, either, so I just hacked it up enough
to build. These problems shouldn't be particular to our uclibc, but I
haven't checked to see if they are fixed in an upstream uclibc, or if
uclibc has known bugs about them -- that's probably the right way to
go for a proper solution.

Here is what the diff looks like between my uclibc trees:
--
ddunbar at frank:private$ diff -r klee-uclibc
/mnt/u64/home/ddunbar/x86_64/klee-uclibc
diff -r klee-uclibc/.config /mnt/u64/home/ddunbar/x86_64/klee-uclibc/.config
3c3
< # Mon Mar 10 23:29:58 2008
---
> # Sun Aug  2 13:36:08 2009
13c13
< TARGET_i386=y
---
> # TARGET_i386 is not set
27c27
< # TARGET_x86_64 is not set
---
> TARGET_x86_64=y
32c32
< TARGET_ARCH="i386"
---
> TARGET_ARCH="x86_64"
35c35
< CONFIG_386=y
---
> # CONFIG_386 is not set
diff -r klee-uclibc/libc/stdlib/stdlib.c
/mnt/u64/home/ddunbar/x86_64/klee-uclibc/libc/stdlib/stdlib.c
346c346
< extern __typeof(strtol) __XL_NPP(strtoll);
---
> //extern __typeof(strtol) __XL_NPP(strtoll);
348c348
< strong_alias(__XL_NPP(strtol),__XL_NPP(strtoll))
---
> //strong_alias(__XL_NPP(strtol),__XL_NPP(strtoll))
400c400
< extern __typeof(strtoul) __XL_NPP(strtoull);
---
> //extern __typeof(strtoul) __XL_NPP(strtoull);
402c402
< strong_alias(__XL_NPP(strtoul),__XL_NPP(strtoull))
---
> //strong_alias(__XL_NPP(strtoul),__XL_NPP(strtoull))
1063c1063
< extern __typeof(wcstol) __XL_NPP(wcstoll);
---
> //extern __typeof(wcstol) __XL_NPP(wcstoll);
1065c1065
< strong_alias(__XL_NPP(wcstol),__XL_NPP(wcstoll))
---
> //strong_alias(__XL_NPP(wcstol),__XL_NPP(wcstoll))
1117c1117
< extern __typeof(wcstoul) __XL_NPP(wcstoull);
---
> //extern __typeof(wcstoul) __XL_NPP(wcstoull);
1119c1119
< strong_alias(__XL_NPP(wcstoul),__XL_NPP(wcstoull))
---
> //strong_alias(__XL_NPP(wcstoul),__XL_NPP(wcstoull))
diff -r klee-uclibc/libc/sysdeps/linux/i386/bits/kernel_types.h
/mnt/u64/home/ddunbar/x86_64/klee-uclibc/libc/sysdeps/linux/i386/bits/kernel_types.h
13a14
> #define _ASM_X86_POSIX_TYPES_64_H
diff -r klee-uclibc/libc/sysdeps/linux/x86_64/bits/kernel_types.h
/mnt/u64/home/ddunbar/x86_64/klee-uclibc/libc/sysdeps/linux/x86_64/bits/kernel_types.h
8a9
> #define _ASM_X86_POSIX_TYPES_64_H
--

> Unfortunately, fixing this is beyond my "quick C hacking" capability,
> and thus I turn to the list. Thank you for the time and open sourcing
> this wonderful tool. :)

You're welcome! :)

 - Daniel

> --
> Nicholas Childers
> nickchilders at umail.ucsb.edu
>
> _______________________________________________
> klee-dev mailing list
> klee-dev at keeda.stanford.edu
> http://keeda.Stanford.EDU/mailman/listinfo/klee-dev
>

Reply via email to