How to link cilk++

How to link cilk++

How do I use my standard linker to do the final link for a mixed
C++/Cilk program?

Here I have
foo.o compiled from foo.cilk by cilk++
bar.o compiled from bar.c++ (with a call to cilk::run) by cilk++
If I do the final link with cilk++ it works.

If I do the final link with g++ it doesn't. I tried
$ /home/bradley/cilkarts/8503/cilk/bin/c++ foo2.o bar2.o -o broken-lpthread-L/home/bradley/cilkarts/8503/cilk/lib64 -lcilkrts-Wl,-rpath=/home/bradley/cilkarts/8503/cilk/lib64

$ ./broken

and get a segfault.

What's the magic to linking with cilk? I need to know so that I can link with., e.g., icc.


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

Try adding -Wl,-z,now to the link command. The g++-based driver does this automatically when it links Cilk++ code. The dynamic loader feels free to use stack space to resolve lazy binding. In Cilk++ code there is no stack. -z now forces relocations to be resolved before entering main().

Leave a Comment

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