[LLVMdev] Building 176.gcc

Nick Lewycky nicholas at mxc.ca
Tue Jan 18 20:02:00 PST 2011


On 01/18/2011 06:38 PM, Bin Zeng wrote:
> Hi folks,
>
> I have been stumped on a compilation problem when I tried to build
> 176.gcc of SPEC CPU2000 with clang v 2.8 (trunk 427) on Linux and intel.
> First, I tried to compile with 'clang -std=c89 *.c -o gcc.clang' since
> the default C standard of Clang is c99 while that of gcc is c89. It
> reported this error:
> ./c-gperf.h:14:1: error: unknown type name 'inline'
> inline
> ^
> ./c-gperf.h:16:1: error: expected identifier or '('
> static unsigned int
> ...
>
> This is the part of the source code:
> #ifdef __GNUC__
> inline
> #endif
> static unsigned int
> hash (str, len)
> ...
> Definitely, the error existed because clang has different support for
> inline. Then I tried to compile with 'clang *.c -std=c99 -o gcc.clang'
> because c99 supports inline. It reported this error:
> /tmp/cc-tJBugS.o: In function `stat':
> toplev.c:(.text+0x0): multiple definition of `stat'
> /tmp/cc-aQKHyN.o:getpwd.c:(.text+0x0): first defined here
> /tmp/cc-tJBugS.o: In function `fstat':
> toplev.c:(.text+0x30): multiple definition of `fstat'
> /tmp/cc-aQKHyN.o:getpwd.c:(.text+0x30): first defined here
> /tmp/cc-GZ5yz3.o: In function `init_lex':
> c-lex.c:(.text+0x417): undefined reference to `is_reserved_word'
> c-lex.c:(.text+0x463): undefined reference to `is_reserved_word'
> c-lex.c:(.text+0x4a1): undefined reference to `is_reserved_word'
> c-lex.c:(.text+0x4df): undefined reference to `is_reserved_word'
> c-lex.c:(.text+0x51d): undefined reference to `is_reserved_word'

Try -std=gnu89 instead of -std=c89. "inline" in C89 is a GNU extension, 
and -std=c89 runs with gnu extensions disabled but __GNUC__ is still 
defined.

Nick

> function stat and fstat are included from header files<sys/stat.h>. I
> suppose this has something to do with the c89 C preprocessor standard.
>
> Also, I looked at the configuration files of SPEC CPU2000. There is no
> special command line options for building 176.gcc. The base tune command
> line is this: 'gcc -c  -O3 -fomit-frame-pointer   *.c'.   Is there any
> way to walk around this without changing the source code of 176.gcc? I
> do not intend to do change it since it is standard benchmark program.
> Definitely, someone has built SPEC CPU2000 with clang successfully
> before. Does anyone have any suggestion?
>
> Thanks a lot!
> Bin
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>




More information about the llvm-dev mailing list