Building parrot with clang

Moritz Lenz moritz at faui2k3.org
Sun Jun 21 22:00:29 UTC 2009


(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've submitted that as a bug report here:
 <https://trac.parrot.org/parrot/ticket/782>)

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

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


More information about the parrot-dev mailing list