Error while linking to my static lib with cuda functions

Hi guys. I am working on porting my application from linux to mac os x. I have everything working except for the CUDA part. I have installed both the toolkit and SDK on OS X 10.5.7. My project is as follows:

I have modified one of the examples in the SDK/projects extensively and compile it as a library instead of a executable. I use the make file, modified to copy and paste the common.mk into the bottom so I don’t have any dependencies on the SDK or SDK libraries at all. The compile happens correctly and I end up with a library “libExample.a”. The interface this library has in the form of a C++ class implemented in .cu file. (i have the only .h file with the class definition and then the .cu with the class implementation and the cuda kernels). This single object library is then used in a larger program, which links to libExample and libcuda and libcudart.

However when linking to the library with this linkline [ LINKLINE = ar qv (TARGET) (OBJS) ] i get this error:

ld: in /Users/pjwhite/Documents/workspace/ExampleLib/Debug/libExample.a, archive has no table of contents

So like my other libraries I have to use libtool to build the archives instead of ar [ LINKLINE = libtool -v -static (OBJS) -o (TARGET) ] i get another error:

Undefined symbols:
“ExampleClass:: ExampleClass(double, double, double)”, referenced from:
CallingClass::ConvertData( VideoData*) in CallingClass.o

I am not very good at make files or building stuff like this. I tried but I am totally lost on this one. Is there anything anyone things I should be able to do or try?

Thanks!

PJW

Anyone? This is really halting my port and nothing I try works very well. If anyone knows this issue (or much about linking) it would be great to have a hand!

Hi Guys. I fixed this eventually by seperating my class from the cuda coda and compiling the cuda code in a .cu file (compiled with nvcc) and the class in a normal cpp file compiled with g++. It’s a bit inconvenient to do it this way, but no big deal.

Just to let someone know if they have the same issue.