Hello,
I’m trying to compile my CUDA project on OSX but encountering some errors which I don’t know how to solve. I compile my project on Linux with just a few extra arguments to nvcc:
nvcc -shared -Xcompiler "-fPIC" -c in.cu -o out.o -I<includes..>
The final linking, on Linux, is done with gcc as following:
gcc -std=gnu99 -shared -o sharedlib.so in.o -lcuda -lcudart -lcublas
So I’m trying to create a Makefile for my project on OSX, preferably using the common.mk file (I don’t have experience making Makefiles using these rules btw).
So I added the following line to my Makefile:
COMMONFLAGS += -shared -Xcompiler "-fPIC"
but I’m unsure how I tell to create a shared object for the linking phase, any ideas?
Currently, if I manually link the objects files into a shared object, I get the following error when loading the file:
unable to load shared library 'rgputools.so':
dlopen(rgputools.so, 6): no suitable image found. Did find:
rgputools.so: mach-o, but wrong architecture
If someone can advice what to do, or what other information is needed, I would be very grateful!
System: Apple MacBook Pro 13 inch, Nvidia 320M
CUDA version: 3.0, examples are all working fine.