cilk/cilk.h: no such file or directory

cilk/cilk.h: no such file or directory

I thought I start a new thread since it doesn't pertain to the bug anymore. I am getting this: 

cute_rj@Cute:~/code/src/sort/build$ make
g++ -std=c++0x -O2 -DHAVE_OPENMP=1 -DHAVE_CILKPLUS=1 -fcilkplus -lcilkrts -I.. ../common/test_sort.cpp -ltbb -lgomp -lrt -o test_sort.x
../common/test_sort.cpp:9:23: fatal error: cilk/cilk.h: No such file or directory
#include <cilk/cilk.h>
compilation terminated.
make: *** [test_sort.x] Error 1

and yes my environment variables are set!

cute_rj@Cute:~/code/src/sort/build$ echo $PATH
cute_rj@Cute:~/code/src/sort/build$ echo $LIBRARY_PATH
cute_rj@Cute:~/code/src/sort/build$ echo $LD_LIBRARY_PATH

What the heck is going on? -.- lol

18 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

You have two options:

  1. You can add a -I (capital i) option to add to the list of directories that will be searched for include files. For example,
    g++ -std=c++0x -O2 -DHAVE_OPENMP=1 -DHAVE_CILKPLUS=1 -fcilkplus -lcilkrts -I.. \
    -I/home/cute_rj/gcc-cilk/include../common/test_sort.cpp -ltbb -lgomp -lrt -o test_sort.x

  2. You can define CPATH (or  CPLUS_INCLUDE_PATH) to specify the list of directories that will be searched for include files.  For example:
       export CPATH=/home/cute_rj/gcc-cilk/include:$CPATH

I don't believe that g++ will automatically add the directory to the include file search path when you use the -fcilkplus.

   - Barry

Didn't work but i did look at the snapshot provided by and i see that i'm missing my libcilkrts directory -.- thats where the cilk.h file is

aha! found my problem. let me see if that fixes it

I hadn't realized that you were running from the snapshot at . If there is a problem there, of if I should update the "how to build with the Cilk Plus extension", please let me know.

   - Barry

i wasn't running from snapshot xD it was more of a guide sir

Hello guys

I am also having the same problem ' cilk/cilk.h' file not found. I set my environment variables correctly and checked twice. It all seems fine but libcilkrts is missing. Can anyone tell me how to add this libcilkrts runtime library to LLVM's Clang.

Thank you

You'll need to use the LLVM/Clang from the CilkPlus/LLVM project on GitHub.  See .

     - Barry

The installation and the downloading gonna take too much time, isn't there any way to fix the libcilrts problem in LLVM's Clang.?

Cilk Plus is not in the mainline version of LLVM/Clang. The only version that supports Cilk Plus is the one from the CilkPlus/LLVM project.

   - Barry

Hi is there any easy way I could download these cilkplus files in a short time from link?please suggest


The snapshots download in a reasonable time. Follow the links in under "Using a snapshot". You'll get a compressed tarball of the latest build in the branch.

   - Barry

hey Barry,

Thank you for helping me. But at last stage where building Cilkplus application with GCC compilers requires explicitly enabling the Cilk Plus extension and linking with libcilkrts. For example:

$HOME/cilkplus-install/bin/gcc -fcilkplus -lcilkrts <OTHER_FLAGS> <SRC_FILES>
$HOME/cilkplus-install/bin/g++ -fcilkplus -lcilkrts <OTHER_FLAGS> <SRC_FILES>,What this says and what is the meaning of OTHER_FLAGS here!!!!!

One more thing I am doing my final year project based on this topic. Can you suggest me some problems in which I can show the parallelism.

Thank you.

Other flags are the flags you use when compiling your files. Such as -o and -g


Can you suggest me some standard problems on which I can work on and enjoy this concept.

You might want to look at the problems from "Structured Parallel Programming" by Michael McCool, James Reinders and Arch Robison. The sources are available at .

You might also look at some of the examples at the website.

   - Barry

Hey everyone I have a very silly doubt.

I am compiling my file using :

/home/aryan/cilkplus-install/bin/gcc -fcilkplus -lcilkrts -o test tes.c

the compilation done succesfully, and runs too. But what is the meaning of -fcilkplus and -lcilkrts here!!!!!!.

And to run a program I am using

CILK_NWORKER=1 time ./test. What this line says? Please reply.

-fcilkplus enables the Cilk Plus extension.

-lcilkrts tells the compiler to add to the list of libraries that are linked against.

The statement "CILK_NWORKER=1 time ./test." is doing 3 things:

  1. It's setting the environment variable CILK_NWORKERS to "1". This tells the Cilk runtime to only use one worker, so there's only 1 thread to do the work. If you don't do this, the Cilk runtime will use as many workers as your system has logical cores - Assuming you're using Linux, the number of cores in the /proc/cpuinfo file. The environment variable is only set for the duration of the command.
  2. It's timing the run of your application. When the application completes, you should see output specifying how long your application ran.  You can use the command "man time" to see the "time" man page which has all the details.
  3. It's running the application "test" from the current directory.

   - Barry

Login to leave a comment.