I’m trying to extend Ruby with Thrust for a short physics project of
mine, but I keep running into some trouble with C++'s name mangling.
Specifically, when calling functions such as thrust::replace or
thrust::sequence, I get errors similar to the following:
irb: symbol lookup error: /home/ralfgunter/ruby/thrust/thrust.so:
This is not always the case - thrust::fill works fine, for instance. I
am using nvcc from CUDA 2.3, Ruby 1.9.1-p243, gcc 4.3.3 (ubuntu), and I
had to mess a bit with the Makefile to compile; these were the
- Replaced ‘g++’ with ‘nvcc’
- Replaced every instance of ‘-Wl,’ with '-Xlinker ’
- Added a '-Xcompiler ’ before ‘-Wall’, ‘-rdynamic’, and pretty much
everything else that would make ‘make’ spit out an error.
As far as I know, this is usually solved by wrapping the ‘offending
functions’ with ‘extern “C”’, though now the functions I’m having some
difficulty with are Thrust’s own, so I think this solution might not
apply in this case. Please do correct me if I’m wrong!
I’d love if anyone could help me with this one, as it’s been bugging me
for a while!