I installed Cilk successfully on my home computer, a 32-bit machine running Ubuntu. I replicated the process to the best of my knowledge on my 64-bit Ubuntu netbook, excepting, of course, that I downloaded the 64-bit version instead of the 32-bit version. When attempting to run the very simple cilkexample.c copied below, however, I get very very many errors, all seeming related to it not having access to library files:
In file included from /usr/include/stdio.h:28,
from cilkexample.c:1:
/usr/include/features.h:323:26: error: bits/predefs.h: No such file or director\
y
/usr/include/features.h:356:25: error: sys/cdefs.h: No such file or directory
/usr/include/features.h:388:23: error: gnu/stubs.h: No such file or directory
In file included from cilkexample.c:1:
/usr/include/stdio.h:36:25: error: bits/types.h: No such file or directory
/usr/include/stdio.h:161:28: error: bits/stdio_lim.h: No such file or directory
/usr/include/stdio.h:846:30: error: bits/sys_errlist.h: No such file or directo\
ry
In file included from /usr/include/stdio.h:34,
from cilkexample.c:1:
/usr/local/cilk/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.2.4/include/stddef.h:\
214: error: expected constructor, destructor, or type conversion before ‘typede\
f’
In file included from cilkexample.c:1:
/usr/include/stdio.h:49: error: expected constructor, destructor, or type conve\
rsion before ‘typedef’
et cetera, et cetera, et cetera.
Here is the file I attempted to compile with the command cilk++ -o cilkexample cilkexample.c
:
#include <stdio.h>
#include <cilk.h>
int foo() {
return 100;
}
int bar() {
return 50;
}
int cilk_main(int argc, char **argv) {
int x, y;
x = cilk_spawn foo();
y = cilk_spawn bar();
cilk_sync;
printf("Got %d %d, expecting %d %d\n", x, y, 100, 50);
return 0;
}
Again, I think this has to be a configuration problem. The code is unmodified from the working version our professor distributed, which I tested on a separate machine.
Last bit of information I can think of is the PATH.
******@********:~/Path/To/Cilk$ echo $PATH
/usr/local/cilk/bin/:/usr/lib/lightdm/lightdm:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
Thanks for your help!
Looks like you are missing some headers. You say you are on Ubuntu in which headers are distributed in xxx-dev
packages.
Googling for some of the headers in your error I found that bits/types.h
are part of libc6-dev
on Debian, you should check that you have that package at least.
You should check with your distro in what package the files appear, I don't have a Debian or Ubuntu machine available to check on right now.
Edit: I found myself an Ubuntu box and it looks like libc6-dev
contains all the files listed at least. dpkg-query -S [file]
gives you package name