Search code examples
c++qtcudanvidiaoptix

Compiling Optix with Qt Creator - Linking Issues


I am trying to compile some sample projects given from the Nvidia OptiX SDK with Qt-Creator.

I wrote the .pro file and edited it for my own needs with this help Compiling Optix with Qt Creator!

I have exactly the same .pro file, except that i edited the direction of CUDA and OptiX, but I can't compile completely because (little snippet but all errors have the same cause here)

/home/Rembold/QTProjects/build-HelloOptix-Desktop-Debug/../HelloOptix/sample1.c:90: undefined reference to `sutilHandleError'
/home/Rembold/QTProjects/build-HelloOptix-Desktop-Debug/../HelloOptix/sample1.c:91: undefined reference to `sutilHandleError'

which might stem from the NVIDIA-OptiX-SDK-X.X.X-linux64/SDK/sutil.

But if I comment out the line optix.CONFIG += no_link, the generated .ptx file from the .cu files are linked to the object files. Therefore the .ptx files are treat as object files and Qt gives me the syntax error.

So all in all, optix.CONFIG += no_link gives undefined references and without this line, the compiler tries to link the .ptx files and returns a syntax error

/usr/bin/ld:ptx/draw_color.cu.ptx: file format not recognized; treating as linker script
/usr/bin/ld:ptx/draw_color.cu.ptx:2: syntax error

Is there a way in Qt to ignore just a certain type of file in the linking step or do I have a mistake somewhere else? In both cases, the building step generates the correct .ptx files (compared to the given SDK-precompiled-samples) and an .o file.

Thanks in advance!

EDIT: Nevermind I figured out by myself. The errors already told me that i missed to link an additional libary. That's why i had to advance:

LIBS += -lcuda -lcudart -loptix -loptixu -lsutil -L/usr/local/cuda-6.5/lib64 -L/home/Remb/NVIDIA-OptiX-SDK-3.7.0-linux64/lib64

Solution

  • I figured out by myself, I forgot to add libraries of sutils of OptiX. Here is what I added to my LIBS:

    LIBS += -lcuda -lcudart -loptix -loptixu -lsutil -L/usr/local/cuda-6.5/lib64 -L/home/Remb/NVIDIA-OptiX-SDK-3.7.0-linux64/lib64