Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Building Cilk on a recent Linux distribution

834 views
Skip to first unread message

Stéphane Zuckerman

unread,
Dec 17, 2010, 5:29:34 PM12/17/10
to
Hi,

I have been trying to build Cilk v5.4.6 (available here:
http://supertech.csail.mit.edu/cilk/) on my machine, and have failed
utterly.

Here are the details:

The Cilk tools do get built, but when trying to build examples, the
makefile returns with the following error:

Making all in examples
make[2]: Entering directory `/home/lasher/Downloads/cilk-5.4.6/
examples'
../support/cilkclocal -DHAVE_CONFIG_H -I. -I.. -I../runtime -O2 -g
-Wall -W -c -o hello.o hello.cilk
../support/cilkclocal -DHAVE_CONFIG_H -I. -I.. -I../runtime -O2 -g
-Wall -W -c -o fib.o fib.cilk
gcc -DHAVE_CONFIG_H -I. -I.. -I../runtime -O2 -g -Wall -W -MT
fib-serial.o -MD -MP -MF .deps/fib-serial.Tpo -c -o fib-serial.o
fib-serial.c
../support/cilkclocal -DHAVE_CONFIG_H -I. -I.. -I../runtime -O2 -g
-Wall -W -c -o testall.o testall.cilk
../support/cilkclocal -DHAVE_CONFIG_H -I. -I.. -I../runtime -O2 -g
-Wall -W -c -o rand.o rand.cilk
../support/cilkclocal -DHAVE_CONFIG_H -I. -I.. -I../runtime -O2 -g
-Wall -W -c -o ck.o ck.cilk
gcc -DHAVE_CONFIG_H -I. -I.. -I../runtime -O2 -g -Wall -W -MT
getoptions.o -MD -MP -MF .deps/getoptions.Tpo -c -o getoptions.o
getoptions.c
../support/cilkclocal -DHAVE_CONFIG_H -I. -I.. -I../runtime -O2 -g
-Wall -W -c -o magic.o magic.cilk
/usr/include/bits/waitstatus.h:76: syntax error

Compilation Failed: 1 error, 0 warnings
Error: failed running cilk2c
make[2]: *** [fib.o] Error 1
make[2]: *** Waiting for unfinished jobs....
/usr/include/bits/waitstatus.h:76: syntax error

Compilation Failed: 1 error, 0 warnings
Error: failed running cilk2c
make[2]: *** [testall.o] Error 1
/usr/include/bits/waitstatus.h:76: syntax error

Compilation Failed: 1 error, 0 warnings
Error: failed running cilk2c
make[2]: *** [ck.o] Error 1
/usr/include/bits/waitstatus.h:76: syntax error


Distributions where it failed to build: Ubuntu 10.10 64 bits, Ubuntu
10.10 32 bits, Fedora 14 32 bits

I have tried to build Cilk with gcc v4.3, v4.4, and v4.5, as well as
icc v12.0, without success.
I have also checked my versions of flex and yacc, just in case (but
they are the same used below...)

However, I did manage to build Cilk on:
CentOS 5.4, Debian Testing, and Ubuntu 10.04 (!)

I can only guess that something has changed in the last 6-8 months in
the latest Linux distributions. I just don't know what.

I am quite stuck here. Do you have any guess about what is messing up
things ?

Thanks

Philipp Thomas

unread,
Dec 21, 2010, 6:33:51 PM12/21/10
to
On Fri, 17 Dec 2010 14:29:34 -0800 (PST), Stéphane Zuckerman
<jenesui...@gmail.com> wrote:

>/usr/include/bits/waitstatus.h:76: syntax error

And, what does that file look like at the stated line? Seems that the
comiler doesn't understand valid C.

>I am quite stuck here. Do you have any guess about what is messing up
>things ?

A compiler that doesn't understand valid C? If you run 'rpm -qf' on
that file you see that it's part of glibc, the C library used by all
apps.

Philipp

Rainer Weikusat

unread,
Dec 22, 2010, 6:39:11 AM12/22/10
to
Stéphane Zuckerman <jenesui...@gmail.com> writes:

[...]

Building works on 64-bit Debian 5.0. An error like the one above
usually means that some definition required to process the
waitstatus.h header isn't available and that the output of the
preprocessor made no sense to the compiler because of that. It is (in
my experience) often possible to get more information about the actual
error by running the preprocessor first (-E option to gcc), removing
all line control directives from the resulting combined file[*] and
trying to compile the result. This should result in an error message
pointing to the offending line of the preprocessed file which contains
the exact input the compiler saw.

[*] This can be done easily with ed in the following way (example
output from an actual edit)

[rw@sapphire]/tmp $ed waitstatus.h
3639
g/^#/d
wq
2349

The first and fourth lines are output from the editor (the respective
file sizes), the second is a command which means 'delete all lines
starting with a hash-mark' and the third one meaning 'write changes to
edited file and quit'.

Stéphane Zuckerman

unread,
Jan 4, 2011, 2:26:08 AM1/4/11
to
On Dec 22 2010, 6:39 am, Rainer Weikusat <rweiku...@mssgmbh.com>
wrote:

Thanks a lot for the answer. I have finally understood what was going
on, to a certain extent. You are right in your diagnostic: some
definition was needed.

In particular, I have successfully built Cilk on any system which is
up to 6 months old (openSUSE 11.3 for the most recent, July 2010). It
didn't build on Fedora 14 (November 2010) and Ubuntu 10.10 (October
2010). When I tried to see what could be the common things these two
distros had, I ended up looking at /lib ... And found glibc 2.12 where
all the previous distributions had (at best) glibc 2.11 installed. I
then remembered that some data structures and functions from the POSIX
environment needed to define some variables and ... modifying the
CFLAGS for the configure script by adding -D_XOPEN_SOURCE=600 (or
500) or -D_POSIX_C_SOURCE=200809L (or 199506) will make the couple
Cilk-preprocessor/gcc correctly handle everything. However, I am quite
surprised to be forced to explicitly have to define that kind of
variable, and thought it would have been handled implicitly (I mean,
it WAS handled implicitly in the other distributions...).

Again, many thanks for your answer !

Stéphane

Stéphane Zuckerman

unread,
Jan 4, 2011, 2:31:38 AM1/4/11
to
On Dec 21 2010, 6:33 pm, Philipp Thomas <ktho...@linux01.gwdg.de>
wrote:

> On Fri, 17 Dec 2010 14:29:34 -0800 (PST), Stéphane Zuckerman
>
> <jenesuispasg...@gmail.com> wrote:
> >/usr/include/bits/waitstatus.h:76: syntax error
>
> And, what does that file look like at the stated line? Seems that the
> comiler doesn't understand valid C.

I should have been more explicit here. I used gcc to compile
everything (tried many different versions, even tried icc -- just in
case, at that point I was desperate). As I said in my answer to Rainer
Weikusat, it seems that going from glibc <= 2.11 to glibc v2.12 made
it necessary to explicitly define XOPEN_SOURCE and/or POSIX_C_SOURCE
to the right values, while before it was implicitly handled. So my
compiler did understand C ;-), as I could build Cilk on many other
platforms without breaking a sweat. Simply some default behavior has
changed with the new version of glibc -- or so it seems.

Ben

unread,
Nov 1, 2012, 5:29:43 PM11/1/12
to
Hi Stephane,

Thanks for the explanation. Building Cilk works on my Ubuntu 12.04LTS (32-bit) machine if I indicate XOPEN_SOURCE and/or POSIX_C_SOURCE when running configure, that is

./configure CFLAGS="-D_XOPEN_SOURCE=600 -D_POSIX_C_SOURCE=200809L"

After building cilk, I can run "make check" without any errors and also "make install". However, when I then try to compile a .cilk file using:

cilkc fib.cilk -o fib

I get the same error as before:

/usr/include/bits/waitstatus.h:76: syntax error

Compilation Failed: 1 error, 0 warnings
Error: failed running cilk2c

I know this may be a noobish question, but I was wondering if you could help me with this issue?

Many thanks and kind regards,

Ben

madhu...@gmail.com

unread,
Jan 25, 2013, 12:04:49 PM1/25/13
to
I also faced same issue. How did you solve above error.

thom...@umn.edu

unread,
May 16, 2014, 2:16:47 PM5/16/14
to
In case anyone runs across this thread again, cilkc supports the -D flag to send arguments to the preprocessor. See: http://supertech.csail.mit.edu/cilk/manual-5.4.6.pdf

So you can compile fib.cilk with:

cilkc -D_XOPEN_SOURCE=600 -D_POSIX_C_SOURCE=200809L fib.cilk -o fib

or create a wrapper script to do it for you:

$ cat cilk
#!/bin/sh
/usr/local/bin/cilkc -D_XOPEN_SOURCE=600 -D_POSIX_C_SOURCE=200809L "$@"
$ cilk fib.cilk -o fib

Thanks,
Landon
0 new messages