title: compile cilk plus code centos 7 gcc-5.2 devtoolset-4
body: <pre><code>#include &lt;iostream&gt;
  #include &lt;cilk/cilk.h&gt;
  
  int fib(int n)
  {
   if (n &lt; 2)
   return n;
   int x = cilk_spawn fib(n-1);
   int y = fib(n-2);
   cilk_sync;
   return x + y;
  }
  
  int main(int argc, char ** argv)
  {
      for (int i = 0; i != 20; ++i)
      {
          std::cout &lt;&lt; "fib(i)=" &lt;&lt; fib(i) &lt;&lt; std::endl;
      }
  }
  </code></pre>
  
  <p>compiled like so can't find the library</p>
  
  <pre><code>$ g++ -Wall -O3 -fcilkplus fib.cpp -o fib          
  /opt/rh/devtoolset-4/root/usr/libexec/gcc/x86_64-redhat-linux/5.2.1/ld: cannot find -lcilkrts
  collect2: error: ld returned 1 exit status
  </code></pre>
  
  <p>So I try find and adding it with the -L switch</p>
  
  <p>$ find /opt/rh/devtoolset-4 -name "<em>cilkrts</em>"
  /opt/rh/devtoolset-4/root/usr/lib/gcc/x86_64-redhat-linux/5.2.1/32/libcilkrts.a
  /opt/rh/devtoolset-4/root/usr/lib/gcc/x86_64-redhat-linux/5.2.1/32/libcilkrts.so
  /opt/rh/devtoolset-4/root/usr/lib/gcc/x86_64-redhat-linux/5.2.1/libcilkrts.spec</p>
  
  <pre><code>$ g++ -Wall -O3 -fcilkplus fib.cpp -o fib -L/opt/rh/devtoolset-4/root/usr/lib/gcc/x86_64-redhat-linux/5.2.1/32
  /opt/rh/devtoolset-4/root/usr/libexec/gcc/x86_64-redhat-linux/5.2.1/ld: skipping incompatible /opt/rh/devtoolset-4/root/usr/lib/gcc/x86_64-redhat-linux/5.2.1/32/libstdc++.so when searching for -lstdc++
  /opt/rh/devtoolset-4/root/usr/libexec/gcc/x86_64-redhat-linux/5.2.1/ld: skipping incompatible /opt/rh/devtoolset-4/root/usr/lib/gcc/x86_64-redhat-linux/5.2.1/32/libcilkrts.so when searching for -lcilkrts
  /opt/rh/devtoolset-4/root/usr/libexec/gcc/x86_64-redhat-linux/5.2.1/ld: cannot find -lcilkrts
  /opt/rh/devtoolset-4/root/usr/libexec/gcc/x86_64-redhat-linux/5.2.1/ld: skipping incompatible /opt/rh/devtoolset-4/root/usr/lib/gcc/x86_64-redhat-linux/5.2.1/32/libgcc_s.so when searching for -lgcc_s
  /opt/rh/devtoolset-4/root/usr/libexec/gcc/x86_64-redhat-linux/5.2.1/ld: skipping incompatible /opt/rh/devtoolset-4/root/usr/lib/gcc/x86_64-redhat-linux/5.2.1/32/libgcc.a when searching for libgcc.a
  collect2: error: ld returned 1 exit status
  
  
  $ g++ -v
  Using built-in specs.
  COLLECT_GCC=g++
  COLLECT_LTO_WRAPPER=/opt/rh/devtoolset-4/root/usr/libexec/gcc/x86_64-redhat-linux/5.2.1/lto-wrapper
  Target: x86_64-redhat-linux
  Configured with: ../configure --enable-bootstrap --enable-languages=c,c++,fortran,lto --prefix=/opt/rh/devtoolset-4/root/usr --mandir=/opt/rh/devtoolset-4/root/usr/share/man --infodir=/opt/rh/devtoolset-4/root/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-shared --enable-threads=posix --enable-checking=release --enable-multilib --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --enable-plugin --with-linker-hash-style=gnu --enable-initfini-array --disable-libgcj --with-default-libstdcxx-abi=gcc4-compatible --with-isl=/builddir/build/BUILD/gcc-5.2.1-20150902/obj-x86_64-redhat-linux/isl-install --enable-libmpx --enable-gnu-indirect-function --with-tune=generic --with-arch_32=i686 --build=x86_64-redhat-linux
  Thread model: posix
  gcc version 5.2.1 20150902 (Red Hat 5.2.1-2) (GCC) 
  </code></pre>
  
  <p>Pointers appreciated</p>