__cilkrts_cilk_for_64 undifined

__cilkrts_cilk_for_64 undifined

Dear all, I seem to be having a bit of an issue with some code using cilk_for on my machine. It's a 64-bit machine.

The code 

cilk_for(int i=0; i< x; i++) {}

where x is a signed int, gives me 

undefined reference to _cilkrts_cilk_for_64

Looks like a linker issue (maybe), but I cant figure it out, my includes are as follows:

#include <cilk/cilk.h>
#include <cilk/cilk_api.h>
#include <cilk/common.h>

and my compilation command is as follows:

gcc -g -std=c99 -c test.c  -fcilkplus -lcilkrts -lm

Please let me know if you need more info. Any ideas?

Leo

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

Hello Leo,

    I am not able to reproduce the problem on my 64 bit SuSE or uBuntu machine. Here is the test code I used: Is this similar to yours?

#include <cilk/cilk.h>
#include <cilk/cilk_api.h>
#include <cilk/common.h>

int main (int argc, char **argv)
{
cilk_for (int i = 0; i < argc; i++)
{

}

return 0;
}

Also, this is the line I used to compile the code

./install_dir/cilkplus-install/bin/gcc -std=c99 -c test.c -fcilkplus -lcilkrts -lm

Thanks,

 

Balaji V. Iyer.

P.S. My linker version is 2.22. Are you using something older?

Hi Leo.

The compiler converts the body of a cilk_for loop into a lambda function and passes that into __cilkrts_cilk_for_64 (when the loop index is 64bits wide.  There's an equivalent function for 32bit loop indicies).  libcilkrts.so.5 should be exporting __cilkrts_cilk_for64.  Please be sure that your link statement includes -lcilkrts.

    - Barry

You were right, I was not linking against the right lib... or to be more precise, since this was a file linking several source files (some compiled with -std=c99 and some not, then at the time of linking, I was only linking half of them. Problem solved. Thanks both for your help.

Leave a Comment

Please sign in to add a comment. Not a member? Join today