Building Wald's Optix 7 Turtorial [CentOS 7]

I have had little luck getting Ingo Wald’s turorial demos to build using cmake under Scientific Linux/CentOS 7.

Here’s a quick list the the problems I’ve hit so far.

1) Download: link on https://gitlab.com/ingowald/optix7course is bad

Says: git clone Ingo Wald / optix7course · GitLab
Should be: git clone Ingo Wald / optix7course · GitLab

2) CMAKE: I have CUDA 10.2 installed in /usr/local/cuda, and the OptiX 7 headers is /usr/local/optix/include

mkdir build
cd build
ccmake3 …

Brings up the GNU curses interface. I press [c] to configure and get:

CMake Error at /usr/share/cmake3/Modules/FindPackageHandleStandardArgs.cmake:137 (message):
Could NOT find CUDA (missing: CUDA_INCLUDE_DIRS CUDA_CUDART_LIBRARY) (found
version “10.2”)
Call Stack (most recent call first):
/usr/share/cmake3/Modules/FindPackageHandleStandardArgs.cmake:378 (_FPHSA_FAILURE_MESSAGE)
/usr/share/cmake3/Modules/FindCUDA.cmake:1092 (find_package_handle_standard_args)
common/gdt/cmake/configure_optix.cmake:23 (find_package)
CMakeLists.txt:32 (include)

So, I try instead:

ccmake3 … -DCUDA_CUDART_LIBRARY=/usr/local/cuda/lib64/libcudart.so -DCUDA_TOOLKIT_ROOT_DIR=/usr/local/cuda -DOptiX_INSTALL_DIR=/usr/local/optix -DOptiX_INCLUDE=/usr/local/optix/include

This time pressing [c]onfigure (twice!?!) gives the option to [g]enerate. I do that and ccmake3 exits.

3) Make (and undefined constants)

I type

make

and get

Scanning dependencies of target gdt
[ 1%] Building CXX object common/gdt/CMakeFiles/gdt.dir/gdt/gdt.cpp.o
[ 2%] Linking CXX static library …/…/libgdt.a
[ 2%] Built target gdt
Scanning dependencies of target ex01_helloOptix
[ 3%] Building CXX object example01_helloOptix/CMakeFiles/ex01_helloOptix.dir/main.cpp.o
In file included from /home/squeen/Downloads/NVIDIA/optix/optix7course/example01_helloOptix/main.cpp:18:0:
/home/squeen/Downloads/NVIDIA/optix/optix7course/common/gdt/gdt/gdt.h:142:19: error: ‘uint32_t’ does not name a type
inline both uint32_t divRoundUp(uint32_t a, uint32_t b) { return (a+b-1)/b; }
^
/home/squeen/Downloads/NVIDIA/optix/optix7course/common/gdt/gdt/gdt.h:144:19: error: ‘uint64_t’ does not name a type
inline both uint64_t divRoundUp(uint64_t a, uint64_t b) { return (a+b-1)/b; }
^
/home/squeen/Downloads/NVIDIA/optix/optix7course/common/gdt/gdt/gdt.h: In function ‘double gdt::getCurrentTime()’:
/home/squeen/Downloads/NVIDIA/optix/optix7course/common/gdt/gdt/gdt.h:218:41: error: ‘nullptr’ was not declared in this scope
struct timeval tp; gettimeofday(&tp,nullptr);
^
make[2]: *** [example01_helloOptix/CMakeFiles/ex01_helloOptix.dir/main.cpp.o] Error 1
make[1]: *** [example01_helloOptix/CMakeFiles/ex01_helloOptix.dir/all] Error 2
make: *** [all] Error 2

4) HACK#1: Using standard integer data types.

I change the ‘uint32_t’ in optix7course/common/gdt/gdt/gdt.h to the standard “unsigned” type and similiarly the ‘uint64_t’ “unsigned long” types (is this Windows baggage?) and I am able to get a bit further…

Scanning dependencies of target ex01_helloOptix
[ 3%] Building CXX object example01_helloOptix/CMakeFiles/ex01_helloOptix.dir/main.cpp.o
In file included from /home/squeen/Downloads/NVIDIA/optix/optix7course/example01_helloOptix/main.cpp:18:0:
/home/squeen/Downloads/NVIDIA/optix/optix7course/common/gdt/gdt/gdt.h: In function ‘double gdt::getCurrentTime()’:
/home/squeen/Downloads/NVIDIA/optix/optix7course/common/gdt/gdt/gdt.h:218:41: error: ‘nullptr’ was not declared in this scope
struct timeval tp; gettimeofday(&tp,nullptr);
^
make[2]: *** [example01_helloOptix/CMakeFiles/ex01_helloOptix.dir/main.cpp.o] Error 1
make[1]: *** [example01_helloOptix/CMakeFiles/ex01_helloOptix.dir/all] Error 2
make: *** [all] Error 2

5) HACK#2: nullptr becomes the C standard NULL

Fixing line 218 I meet with some success:

make
[ 1%] Building CXX object common/gdt/CMakeFiles/gdt.dir/gdt/gdt.cpp.o
[ 2%] Linking CXX static library …/…/libgdt.a
[ 2%] Built target gdt
[ 3%] Building CXX object example01_helloOptix/CMakeFiles/ex01_helloOptix.dir/main.cpp.o
[ 5%] Linking CXX executable …/ex01_helloOptix
/usr/bin/ld: CMakeFiles/ex01_helloOptix.dir/main.cpp.o: undefined reference to symbol ‘dlsym@@GLIBC_2.2.5
//usr/lib64/libdl.so.2: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
make[2]: *** [ex01_helloOptix] Error 1
make[1]: *** [example01_helloOptix/CMakeFiles/ex01_helloOptix.dir/all] Error 2
make: *** [all] Error 2

6) Adding -ldl to CMAKE

I tried

ccmake3 … -DCUDA_CUDART_LIBRARY=/usr/local/cuda/lib64/libcudart.so -DCUDA_TOOLKIT_ROOT_DIR=/usr/local/cuda -DOptiX_INSTALL_DIR=/usr/local/optix -DOptiX_INCLUDE=/usr/local/optix/include -DBIN2C=/usr/local/cuda/bin/bin2c -DCMAKE_CXX_FLAGS=-ldl

Now the make error became…

Scanning dependencies of target gdt
[ 1%] Building CXX object common/gdt/CMakeFiles/gdt.dir/gdt/gdt.cpp.o
[ 2%] Linking CXX static library …/…/libgdt.a
[ 2%] Built target gdt
Scanning dependencies of target ex01_helloOptix
[ 3%] Building CXX object example01_helloOptix/CMakeFiles/ex01_helloOptix.dir/main.cpp.o
[ 5%] Linking CXX executable …/ex01_helloOptix
[ 5%] Built target ex01_helloOptix
[ 6%] Building NVCC ptx file example02_pipelineAndRayGen/cuda_compile_ptx_1_generated_devicePrograms.cu.ptx
In file included from /usr/local/optix/include/optix_device.h:43:0,
from /home/squeen/Downloads/NVIDIA/optix/optix7course/example02_pipelineAndRayGen/devicePrograms.cu:17:
/usr/local/optix/include/optix_7_device.h:36:2: error: #error Device code for OptiX requires at least C++11. Consider adding “–std c++11” to the nvcc command-line.
#error Device code for OptiX requires at least C++11. Consider adding “–std c++11” to the nvcc command-line.
^
In file included from /usr/include/c++/4.8.2/type_traits:35:0,
from /home/squeen/Downloads/NVIDIA/optix/optix7course/common/gdt/gdt/math/vec/functors.h:19,
from /home/squeen/Downloads/NVIDIA/optix/optix7course/common/gdt/gdt/math/vec.h:378,
from /home/squeen/Downloads/NVIDIA/optix/optix7course/example02_pipelineAndRayGen/LaunchParams.h:19,
from /home/squeen/Downloads/NVIDIA/optix/optix7course/example02_pipelineAndRayGen/devicePrograms.cu:19:
/usr/include/c++/4.8.2/bits/c++0x_warning.h:32:2: error: #error This file requires compiler and library support for the ISO C++ 2011 standard. This support is currently experimental, and must be enabled with the -std=c++11 or -std=gnu++11 compiler options.
#error This file requires compiler and library support for the
^
CMake Error at cuda_compile_ptx_1_generated_devicePrograms.cu.ptx.Release.cmake:211 (message):
Error generating
/home/squeen/Downloads/NVIDIA/optix/optix7course/build/example02_pipelineAndRayGen/cuda_compile_ptx_1_generated_devicePrograms.cu.ptx

make[2]: *** [example02_pipelineAndRayGen/cuda_compile_ptx_1_generated_devicePrograms.cu.ptx] Error 1
make[1]: *** [example02_pipelineAndRayGen/CMakeFiles/ex02_pipelineAndRayGen.dir/all] Error 2
make: *** [all] Error 2

7) Adding -std=c++11 to nvcc

Tried again with a new CMake command…

ccmake3 … -DCUDA_CUDART_LIBRARY=/usr/local/cuda/lib64/libcudart.so -DCUDA_TOOLKIT_ROOT_DIR=/usr/local/cuda -DOptiX_INSTALL_DIR=/usr/local/optix -DOptiX_INCLUDE=/usr/local/optix/include -DBIN2C=/usr/local/cuda/bin/bin2c -DCMAKE_CXX_FLAGS=-ldl -DCUDA_NVCC_FLAGS=-std=c++11

‘make’ produces…

Scanning dependencies of target gdt
[ 1%] Building CXX object common/gdt/CMakeFiles/gdt.dir/gdt/gdt.cpp.o
[ 2%] Linking CXX static library …/…/libgdt.a
[ 2%] Built target gdt
Scanning dependencies of target ex01_helloOptix
[ 3%] Building CXX object example01_helloOptix/CMakeFiles/ex01_helloOptix.dir/main.cpp.o
[ 5%] Linking CXX executable …/ex01_helloOptix
[ 5%] Built target ex01_helloOptix
[ 6%] Building NVCC ptx file example02_pipelineAndRayGen/cuda_compile_ptx_1_generated_devicePrograms.cu.ptx
/home/squeen/Downloads/NVIDIA/optix/optix7course/example02_pipelineAndRayGen/devicePrograms.cu(28): warning: extern declaration of the entity optixLaunchParams is treated as a static definition

[ 7%] compiling (and embedding ptx from) devicePrograms.cu
Scanning dependencies of target ex02_pipelineAndRayGen
[ 8%] Building C object example02_pipelineAndRayGen/CMakeFiles/ex02_pipelineAndRayGen.dir/cuda_compile_ptx_1_generated_devicePrograms.cu.ptx_embedded.c.o
[ 10%] Building CXX object example02_pipelineAndRayGen/CMakeFiles/ex02_pipelineAndRayGen.dir/SampleRenderer.cpp.o
In file included from /usr/include/c++/4.8.2/type_traits:35:0,
from /home/squeen/Downloads/NVIDIA/optix/optix7course/common/gdt/gdt/math/vec/functors.h:19,
from /home/squeen/Downloads/NVIDIA/optix/optix7course/common/gdt/gdt/math/vec.h:378,
from /home/squeen/Downloads/NVIDIA/optix/optix7course/example02_pipelineAndRayGen/LaunchParams.h:19,
from /home/squeen/Downloads/NVIDIA/optix/optix7course/example02_pipelineAndRayGen/SampleRenderer.h:21,
from /home/squeen/Downloads/NVIDIA/optix/optix7course/example02_pipelineAndRayGen/SampleRenderer.cpp:17:
/usr/include/c++/4.8.2/bits/c++0x_warning.h:32:2: error: #error This file requires compiler and library support for the ISO C++ 2011 standard. This support is currently experimental, and must be enabled with the -std=c++11 or -std=gnu++11 compiler options.
#error This file requires compiler and library support for the
^
In file included from /home/squeen/Downloads/NVIDIA/optix/optix7course/example02_pipelineAndRayGen/SampleRenderer.h:20:0,
from /home/squeen/Downloads/NVIDIA/optix/optix7course/example02_pipelineAndRayGen/SampleRenderer.cpp:17:
/home/squeen/Downloads/NVIDIA/optix/optix7course/example02_pipelineAndRayGen/CUDABuffer.h:81:28: warning: non-static data member initializers only available with -std=c++11 or -std=gnu++11 [enabled by default]
size_t sizeInBytes { 0 };
^
/home/squeen/Downloads/NVIDIA/optix/optix7course/example02_pipelineAndRayGen/CUDABuffer.h:82:28: warning: non-static data member initializers only available with -std=c++11 or -std=gnu++11 [enabled by default]
void *d_ptr { nullptr };
^
/home/squeen/Downloads/NVIDIA/optix/optix7course/example02_pipelineAndRayGen/CUDABuffer.h:81:24: warning: extended initializer lists only available with -std=c++11 or -std=gnu++11 [enabled by default]
size_t sizeInBytes { 0 };
^
/home/squeen/Downloads/NVIDIA/optix/optix7course/example02_pipelineAndRayGen/CUDABuffer.h:81:28: warning: extended initializer lists only available with -std=c++11 or -std=gnu++11 [enabled by default]
size_t sizeInBytes { 0 };
^
/home/squeen/Downloads/NVIDIA/optix/optix7course/example02_pipelineAndRayGen/CUDABuffer.h:82:18: warning: extended initializer lists only available with -std=c++11 or -std=gnu++11 [enabled by default]
void d_ptr { nullptr };
^
/home/squeen/Downloads/NVIDIA/optix/optix7course/example02_pipelineAndRayGen/CUDABuffer.h:82:20: error: ‘nullptr’ was not declared in this scope
void d_ptr { nullptr };
^
/home/squeen/Downloads/NVIDIA/optix/optix7course/example02_pipelineAndRayGen/CUDABuffer.h:82:28: warning: extended initializer lists only available with -std=c++11 or -std=gnu++11 [enabled by default]
void d_ptr { nullptr };
^
/home/squeen/Downloads/NVIDIA/optix/optix7course/example02_pipelineAndRayGen/CUDABuffer.h:82:28: error: cannot convert ‘’ to 'void
’ in initialization
In file included from /home/squeen/Downloads/NVIDIA/optix/optix7course/example02_pipelineAndRayGen/CUDABuffer.h:19:0,
from /home/squeen/Downloads/NVIDIA/optix/optix7course/example02_pipelineAndRayGen/SampleRenderer.h:20,
from /home/squeen/Downloads/NVIDIA/optix/optix7course/example02_pipelineAndRayGen/SampleRenderer.cpp:17:
/home/squeen/Downloads/NVIDIA/optix/optix7course/example02_pipelineAndRayGen/CUDABuffer.h: In member function ‘void osc::CUDABuffer::alloc(size_t)’:
/home/squeen/Downloads/NVIDIA/optix/optix7course/example02_pipelineAndRayGen/optix7.h:33:15: error: ‘runtime_error’ is not a member of ‘std’
throw std::runtime_error(txt.str());
^
/home/squeen/Downloads/NVIDIA/optix/optix7course/example02_pipelineAndRayGen/CUDABuffer.h:45:7: note: in expansion of macro ‘CUDA_CHECK’
CUDA_CHECK(Malloc( (void
)&d_ptr, sizeInBytes));
^
/home/squeen/Downloads/NVIDIA/optix/optix7course/example02_pipelineAndRayGen/CUDABuffer.h: In member function ‘void osc::CUDABuffer::free()’:

…this goes one for hundreds of additional errors…

8) HACK #3: To Hell with Cmake!

I created a good old fashioned GNU Makefile (below) and was able to make an executable of example01!

SHELL = /bin/sh

# add CUDA to path
CUDA_PATH     :=/usr/local/cuda
CUDA_INC_PATH :=$(CUDA_PATH)/include
CUDA_LIB_PATH :=$(CUDA_PATH)/lib64
PATH  := $(CUDA_BIN_PATH):$(PATH)

# add OptiX to path
OPTIX_PATH := /usr/local/optix
OPTIX_INC_PATH :=$(OPTIX_PATH)/include

CC       =  g++
CFLAGS   =  -std=c++11 -Wall
CPPFLAGS =  -I. -I.. -I../common/gdt -I../common -I$(CUDA_INC_PATH) -I$(OPTIX_INC_PATH)
LD       =  gcc
LDFLAGS  =  -L.  -L.. -L/lib64/ -L$(CUDA_LIB_PATH) -lrt -lm -ldl -lcudart

.PHONY: all
all:  ex01 ex02

ex01: 
	@echo "building: example01_helloOptix"
	cd example01_helloOptix; $(CC) $(CFLAGS) $(CPPFLAGS) -o $@ main.cpp $(LDFLAGS)
	@mv example01_helloOptix/ex01 .
        
ex02: 
	@echo "building: example02_pipelineAndRayGen"
	cd example02_pipelineAndRayGen; $(CC) $(CFLAGS) $(CPPFLAGS) -o $@ main.cpp SampleRenderer.cpp $(LDFLAGS)
	@mv example02_pipelineAndRayGen/ex02 .

.PHONY: clean 
clean:	
	rm -f ./ex[0-9][0-9];

Ran it and got:

ex01
#osc: initializing optix…
#osc: found 1 CUDA devices
#osc: successfully initialized optix… yay!
#osc: done. clean exit.

Yippee! but…

Example02 won’t build.

building: example02_pipelineAndRayGen
cd example02_pipelineAndRayGen;

g++ -std=c++11 -Wall -I. -I… -I…/common/gdt -I…/common -I/usr/local/cuda/include -I/usr/local/optix/include -o ex02 main.cpp -L. -L… -L/lib64/ -L/usr/local/cuda/lib64 -lrt -lm -ldl -lcudart

In file included from LaunchParams.h:19:0,
from SampleRenderer.h:21,
from main.cpp:17:
…/common/gdt/gdt/math/vec.h:356:1: warning: multi-line comment [-Wcomment]
//#define _define_vec_types(T,t)
^
In file included from CUDABuffer.h:19:0,
from SampleRenderer.h:20,
from main.cpp:17:
CUDABuffer.h: In member function ‘void osc::CUDABuffer::alloc(size_t)’:
optix7.h:33:15: error: ‘runtime_error’ is not a member of ‘std’
throw std::runtime_error(txt.str());
^
CUDABuffer.h:45:7: note: in expansion of macro ‘CUDA_CHECK’
CUDA_CHECK(Malloc( (void**)&d_ptr, sizeInBytes));
^
CUDABuffer.h: In member function ‘void osc::CUDABuffer::free()’:
optix7.h:33:15: error: ‘runtime_error’ is not a member of ‘std’
throw std::runtime_error(txt.str());
^
CUDABuffer.h:51:7: note: in expansion of macro ‘CUDA_CHECK’
CUDA_CHECK(Free(d_ptr));
^
CUDABuffer.h: In member function ‘void osc::CUDABuffer::upload(const T*, size_t)’:
optix7.h:33:15: error: ‘runtime_error’ is not a member of ‘std’
throw std::runtime_error(txt.str());
^
CUDABuffer.h:68:7: note: in expansion of macro ‘CUDA_CHECK’
CUDA_CHECK(Memcpy(d_ptr, (void )t,
^
CUDABuffer.h: In member function 'void osc::CUDABuffer::download(T
, size_t)':
optix7.h:33:15: error: ‘runtime_error’ is not a member of ‘std’
throw std::runtime_error(txt.str());
^
CUDABuffer.h:77:7: note: in expansion of macro ‘CUDA_CHECK’
CUDA_CHECK(Memcpy((void *)t, d_ptr,
^
make: *** [ex02] Error 1

More C++ mangled garabge — ever considered a nice, simple, little C-based tutorial with no custom data types, invented classes, utility libraries, etc. — just core language C99 and C CUDA? Pedantic, yes…but kind to the new users too.

Ouch!

Got a bit further…

  1. HACK #4: Added #include to CUDABuffer.h (line #23)

Make again (with GNU Makefile above), now I get…

building: example02_pipelineAndRayGen
cd example02_pipelineAndRayGen; g++ -std=c++11 -Wall -I. -I… -I…/common/gdt -I…/common -I/usr/local/cuda/include -I/usr/local/optix/include -o ex02 main.cpp -L. -L… -L/lib64/ -L/usr/local/cuda/lib64 -lrt -lm -ldl -lcudart
In file included from LaunchParams.h:19:0,
from SampleRenderer.h:21,
from main.cpp:17:
…/common/gdt/gdt/math/vec.h:356:1: warning: multi-line comment [-Wcomment]
//#define _define_vec_types(T,t)
^
/tmp/ccB9cy4V.o: In function optixInitWithHandle': main.cpp:(.text+0x10): undefined reference to g_optixFunctionTable’
main.cpp:(.text+0x1b): undefined reference to g_optixFunctionTable' main.cpp:(.text+0xaa): undefined reference to g_optixFunctionTable’
/tmp/ccB9cy4V.o: In function main': main.cpp:(.text+0x4a00): undefined reference to osc::SampleRenderer::SampleRenderer()’
main.cpp:(.text+0x4a3b): undefined reference to osc::SampleRenderer::resize(gdt::vec_t<int, 2> const&)' main.cpp:(.text+0x4a4a): undefined reference to osc::SampleRenderer::render()’
main.cpp:(.text+0x4aa2): undefined reference to `osc::SampleRenderer::downloadPixels(unsigned int*)’
collect2: error: ld returned 1 exit status
make: *** [ex02] Error 1

10) Fixed Makefile to include SampleRendeer.cpp

The build command now looks like this

g++ -std=c++11 -Wall -I. -I… -I…/common/gdt -I…/common -I/usr/local/cuda/include -I/usr/local/optix/include -o ex02 main.cpp SampleRenderer.cpp -L. -L… -L/lib64/ -L/usr/local/cuda/lib64 -lrt -lm -ldl -lcudart

Now the only warnings/error is

In file included from LaunchParams.h:19:0,
from SampleRenderer.h:21,
from main.cpp:17:
…/common/gdt/gdt/math/vec.h:356:1: warning: multi-line comment [-Wcomment]
//#define _define_vec_types(T,t)
^
In file included from LaunchParams.h:19:0,
from SampleRenderer.h:21,
from SampleRenderer.cpp:17:
…/common/gdt/gdt/math/vec.h:356:1: warning: multi-line comment [-Wcomment]
//#define _define_vec_types(T,t)
^
SampleRenderer.cpp: In member function ‘void osc::SampleRenderer::buildSBT()’:
SampleRenderer.cpp:303:35: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for (int i=0;i<raygenPGs.size();i++) {
^
SampleRenderer.cpp:316:33: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for (int i=0;i<missPGs.size();i++) {
^
/tmp/cc6Su9i8.o: In function optixInitWithHandle': SampleRenderer.cpp:(.text+0x0): multiple definition of optixInitWithHandle’
/tmp/cc3HnWt9.o:main.cpp:(.text+0x0): first defined here
/tmp/cc6Su9i8.o: In function optixInit': SampleRenderer.cpp:(.text+0xcb): multiple definition of optixInit’
/tmp/cc3HnWt9.o:main.cpp:(.text+0xcb): first defined here
/tmp/cc6Su9i8.o: In function osc::SampleRenderer::createContext()': SampleRenderer.cpp:(.text+0x80a): undefined reference to cuCtxGetCurrent’
/tmp/cc6Su9i8.o: In function osc::SampleRenderer::createModule()': SampleRenderer.cpp:(.text+0xa9b): undefined reference to embedded_ptx_code’
collect2: error: ld returned 1 exit status
make: *** [ex02] Error 1

Seems like it might have something to do with this line in SampleRender.cpp (line#18-19)

// this include may only appear in a single source file:
#include <optix_function_table_definition.h>

Hey, Squeen,

Thx for reporting this - I’ll look into that right away. I do admit I’ve never tested CentOS, but am still a bit surprised because for most of my projects I do, and have rarely seen any (let alone that many) between CentOS on one side, and Ubuntu on the other (in particular, not recognizing uint32_t sounds weird).

As said, I’ll look into it right away (in fact, just setting up a Cent7 machine for that). One question, though: You said “CentOS/Scientific” - would “CentOS 7 with latest updates” do the trick?

We use Scientific Linux (7.7), but it’s essential CentOS 7.7, (which are both RHEL 7.7 with small tweaks).

Thanks for looking at this.

Another issue I am reminded of (with regard to the optix_stub.h header) is the following — in order to get a pure (-pedantic) C99 app to build the following changed was necessary to optixInit.

NOTE: This dlsym casting is recommended by OpenGroup.orgdlsym

Blocked out by the “#if 0” is what exists in the current OptiX 7 release (optix_stubs.h)

OptixResult optixInitWithHandle( void** handlePtr )
{
    ...
   
#if 0
    OptixQueryFunctionTable_t* optixQueryFunctionTable = (OptixQueryFunctionTable_t*)symbol;

    return optixQueryFunctionTable( OPTIX_ABI_VERSION, 0, 0, 0, &g_optixFunctionTable, sizeof( g_optixFunctionTable ) );
#else
    OptixResult (*fptr)(int, unsigned, OptixQueryFunctionTableOptions*, const void**, void *, size_t);
    *(void **)(&fptr) = dlsym( *handlePtr, "optixQueryFunctionTable" );
    return( (*fptr)(OPTIX_ABI_VERSION, 0, 0, 0, &g_optixFunctionTable, sizeof(g_optixFunctionTable) ) );
#endif
   
   return;
}

Sorry; took a bit longer to set up a full developer box with centos 7, optix, cuda, etc, than expected, but the final fix was actually not too bad: The main issue was that the default gcc version on CentOS 7 is older than on Ubuntu, and was a bit more picky wrt things like C+±11 features.

Anyway - latest version successfully builds on both CentOS 7.7 and Ubuntu 18.04. Haven’t tested U19 or Windows, yet, but will do so right away.

Thanks again for reporting this; I’ll actually add the new CentOS machine as a gitlab runner as well, now.

PS: Any further issues with this project feel free to (also?) post an issue on github/gitlab as well, that’s more certain to reach me. Thx again!

I should respond to this publicly by saying that Ingo’s fixes have solved the build issue for me using CentOS 7.7.

I did (as he suggests) add the following to my .bashrc file:

export OptiX_INSTALL_DIR=/usr/local/optix
export PATH=/usr/local/cuda/bin:$PATH
export CUDA_SDK_ROOT_DIR=/usr/local/cuda
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda/lib64

then it’s just “cmake3 …” and “make” from the build directory, as he states on the Gitlab website.

Many thanks to Ingo. These tutorials have been invaluable in adding OptiX 7 capability to our in-house scene graph library—the should be fleshed out with some explanatory prose in an official PDF “Getting Started Guide” for the software. They are well thought out and superior (IMO) to the other SDK examples that come with the OptiX download. The key features are the logic progression (in complexity) and the minimization of dependencies (e.g. no global SDK “helper” functions that you have to hunt down and unravel). Well done!