I want to use nVIDIA compiler to generate a shared library for my GNU compiler to link. Everything goes well until runtime. Following is the detail. Thanks!
main.cpp:
#include <iostream>
using namespace std;
void fcudadriver();
int main()
{
cout<<"Maine "<<endl;
fcudadriver();
return 0;
}
test.cu:
__global__ void fcuda()
{
}
void fcudadriver()
{
fcuda<<<1,1>>>();
}
Compile:
nvcc --compiler-options '-fPIC' -o libtest.so --shared test.cu
g++ main.cpp -L. -ltest
Run:
./a.out
Results:
./a.out: error while loading shared libraries: libtest.so: cannot open shared object file: No such file or directory