GSL compiles pretty much

Hello everyone,

I just compiled most of the GNU Scientific Library with clang (not sure if someone else has done this but I couldn’t find a reference anywhere). I just replaced CC=gcc with the utility script ‘ccc’ for configure and most everything worked fine. There are some errors in landau.c (known clang error in constants.c for the lexer) regarding constants but one can fix this by removing leading zeros for a couple lines. I also hand modified the Makefiles to get rid of the ‘-O2’ flag and added the ‘-lm’ linker flag (one could also just pass this in via configure, I guess).

The library builds until the gsl-randist tool in the main directory is building, then I get ‘undefined reference to __builtin_nanf’ all over the place. I thought this was defined internally within LLVM? Any ideas?

Thanks,

K.Wilson

P.S. I can’t do a ‘make check’ until this nanf thing is fixed.

There are some errors in landau.c (known clang error
in constants.c for the lexer)

What's the bug number in Bugzilla?

regarding constants but one can fix this by
removing leading zeros for a couple lines. I also hand modified the
Makefiles to get rid of the '-O2' flag and added the '-lm' linker flag (one
could also just pass this in via configure, I guess).

You shouldn't need to mess with that... maybe a bug in ccc?

The library builds until the gsl-randist tool in the main directory is
building, then I get 'undefined reference to __builtin_nanf' all over the
place. I thought this was defined internally within LLVM? Any ideas?

It's a gcc builtin, so it has to be implemented in clang. There's a
patch for this at
http://lists.cs.uiuc.edu/pipermail/cfe-dev/2008-May/001744.html, which
was never finished.

-Eli

Thanks for the reply Eli,

There are some errors in landau.c (known clang error
in constants.c for the lexer)

What's the bug number in Bugzilla?

There is no bug number that I am aware of, but the file
../llvm/tools/clang/test/Lexer/constants.c says:

/*RUN clang -fsyntax-only -verify %s
*/

int x = 000000080; /* expected error {{invalid digit}} */

and this is exactly the error that pops up in landau.c.

regarding constants but one can fix this by
removing leading zeros for a couple lines. I also hand modified the
Makefiles to get rid of the '-O2' flag and added the '-lm' linker flag

(one

could also just pass this in via configure, I guess).

You shouldn't need to mess with that... maybe a bug in ccc?

I will check into what ccc is doing here. There was a small patch script on
the list that took care of gcc specific arguments. I assume that it was
incorporated in ccc (or something similar)?

The library builds until the gsl-randist tool in the main directory is
building, then I get 'undefined reference to __builtin_nanf' all over the
place. I thought this was defined internally within LLVM? Any ideas?

It's a gcc builtin, so it has to be implemented in clang. There's a
patch for this at
http://lists.cs.uiuc.edu/pipermail/cfe-dev/2008-May/001744.html, which
was never finished.

I will check this patch out as well and see how far the compilation gets (I
will be busy until late in the week, then I can look).

-Eli

K.Wilson

Does the code compile with GCC? That's an octal number, not decimal. GCC and clang both correctly reject this:

$ gcc t.c
t.c:1:9: error: invalid digit "8" in octal constant
$ clang t.c
t.c:1:16: error: invalid digit '8' in octal constant
int x = 000000080;
                ^

-Chris

I finished this up, at least for the __builtin_nan("") case.

-Chris