[cfe-dev] Building parrot with clang

Chris Lattner clattner at apple.com
Sun Jun 21 17:46:12 PDT 2009


On Jun 21, 2009, at 3:00 PM, Moritz Lenz wrote:
> (I'm sending this to both the parrot and the clang list since I have  
> no
> ideawho will be involved in fixing some of the things)
>
> Today I tried to build parrot with clang on linux/amd64.
> (Used versions: parrot r39691, llvm r73859, clang r73854)
> I configured parrot with
> perl Configure.pl --cc=$path/to/clang_executable/clang
> Configure finished fine, however during 'make' there was an error:
>
> ./src/pmc/env.pmc:28:14: fatal error: 'crt_externs.h' file not found
> #    include <crt_externs.h>
>             ^
> 1 diagnostic generated.
> make: *** [src/pmc/env.o] Error 1
>
> The offending portion of env.pmc looks like this:
> #ifndef WIN32
> #  ifdef __APPLE_CC__
> #    include <crt_externs.h>
> #    define environ (*_NSGetEnviron())
> #  else /* !__APPLE_CC__ */
> extern char **environ;
> #  endif /* __APPLE_CC__ */
> #endif /* !WIN32 */
>
> So it seems that parrot expects the presence of a crt_externs.h file  
> if
> __APPLE_CC__ is set, while clang provides the latter but not the  
> former.

I think this is a clang bug.  __APPLE_CC__ should not be set on linux.

> Configuring parrot with --ccflags=-U__APPLE_CC__ works around this,
> leading to
> the next failure, apparently in the linking step:

What do the definitions of __gmpz_abs and friends look like?  Can you  
paste them?  One difference between clang and gcc is that clang  
defaults to c99 mode, gcc defaults to c89 mode.  Does it work if you  
compile with -std=gnu89?

-Chris

>
> src/pmc/bignum.o: In function `__gmpz_abs':
> /usr/include/gmp.h:1611: multiple definition of `__gmpz_abs'
> src/pmc/bigint.o:/usr/include/gmp.h:1611: first defined here
> src/pmc/bignum.o: In function `__gmpz_fits_uint_p':
> /usr/include/gmp.h:1637: multiple definition of `__gmpz_fits_uint_p'
> src/pmc/bigint.o:/usr/include/gmp.h:1637: first defined here
> src/pmc/bignum.o: In function `__gmpz_fits_ulong_p':
> /usr/include/gmp.h:1648: multiple definition of `__gmpz_fits_ulong_p'
> src/pmc/bigint.o:/usr/include/gmp.h:1648: first defined here
> src/pmc/bignum.o: In function `__gmpz_fits_ushort_p':
> ...
> collect2: ld returned 1 exit status
> make: *** [blib/lib/libparrot.so.1.3.0] Error 1
>
> I have no idea if parrot or clang is to blame here.
> Also adding --without-gmp to parrot's Configure.pl works around this  
> one
> too,allowing me to build parrot with clang. Running 'make tests' shows
> that it passes all standard tests except one (test 4 in t/op/gc).
>
> I hope this is of interest,
> Moritz
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev




More information about the cfe-dev mailing list