Can not build luxrays without OpenCL

Discussion and help for Compilation problems and platform portability.

Moderator: coordinators

Can not build luxrays without OpenCL

Postby em21701 » Thu Jan 27, 2011 7:15 pm

I am trying to build LuxRays (and eventually LuxRender) on my laptop with intel on board graphics running Slackware Linux. Intel does not have OpenCL for linux. I have added SET(LUXRAYS_DISABLE_OPENCL 1) to my CMakeLists.txt as suggested in the wiki.
Code: Select all
<snip>

#############################################################################
#
# OpenCL Libraries
#
#############################################################################

SET(LUXRAYS_DISABLE_OPENCL 1)

if(LUXRAYS_DISABLE_OPENCL)
    set(OCL_LIBRARY "")
else(LUXRAYS_DISABLE_OPENCL)

</snip>


cmake completes with a warning about relative paths, but I have seen this in my googling and does not seem like the source of the problem. The error I receive is shown below

Code: Select all
bash-4.1$ make
Scanning dependencies of target luxrays
[  1%] Building CXX object CMakeFiles/luxrays.dir/src/accelerators/bvhaccel.cpp.o                                                                                           
In file included from /home/eric/Build/LuxRender/luxrays/include/luxrays/accelerators/bvhaccel.h:27:0,                                                                     
                 from /home/eric/Build/LuxRender/luxrays/src/accelerators/bvhaccel.cpp:31:
/home/eric/Build/LuxRender/luxrays/include/luxrays/luxrays.h:36:21: fatal error: CL/cl.hpp: No such file or directory
compilation terminated.
make[2]: *** [CMakeFiles/luxrays.dir/src/accelerators/bvhaccel.cpp.o] Error 1
make[1]: *** [CMakeFiles/luxrays.dir/all] Error 2
make: *** [all] Error 2



It looks to me like make is still looking for OpenCL libraries. Does anyone have a solution?
em21701
 
Posts: 4
Joined: Sun Sep 05, 2010 3:40 pm

Re: Can not build luxrays without OpenCL

Postby tomb » Fri Jan 28, 2011 3:35 am

It's looking for the header files, not the libraries :)
User avatar
tomb
Developer
 
Posts: 1942
Joined: Thu Oct 11, 2007 4:23 pm
Location: Oslo, Norway

Re: Can not build luxrays without OpenCL

Postby em21701 » Fri Jan 28, 2011 6:14 pm

It looks as though LUXRAYS_DISABLE_OPENCL is not being passed to luxrays.h. luxrays.h is trying to include <CL/cl.hpp> even though none of this code block should have executed.

Code: Select all

<snip> luxrays.h

#if !defined(LUXRAYS_DISABLE_OPENCL)

#define __CL_ENABLE_EXCEPTIONS

#if defined(__APPLE__)
#include <OpenCL/cl.hpp>
#else
#include <CL/cl.hpp>
#endif


</snip>

Commenting out this section gets me past that error, but this is certainly not the proper way to fix it. Any thoughts?
em21701
 
Posts: 4
Joined: Sun Sep 05, 2010 3:40 pm

Re: Can not build luxrays without OpenCL

Postby em21701 » Fri Jan 28, 2011 7:59 pm

OK I have worked through the error above and similar subsequent errors by adding #define LUXRAYS_DISABLE_OPENCL to the files that cause errors. I am up to a new error

Code: Select all
Linking CXX executable ../../bin/benchsimple                                                                                                                               
[ 66%] Built target benchsimple                                                                                                                                             
[ 68%] Generating pathgpu/kernels/pathgpu_kernel.cpp
/bin/sh: pathgpu/kernels/pathgpu_kernel.cpp: No such file or directory                                                                                                     
make[2]: *** [samples/smallluxgpu/pathgpu/kernels/pathgpu_kernel.cpp] Error 1
make[1]: *** [samples/smallluxgpu/CMakeFiles/slg.dir/all] Error 2
make: *** [all] Error 2


I have confirmed that the listed file does, in fact, exist at a path similar to the one shown above. Given the relative nature of the output I can not confirm that the full path is correct. Any thoughts on this error?
em21701
 
Posts: 4
Joined: Sun Sep 05, 2010 3:40 pm

Re: Can not build luxrays without OpenCL

Postby em21701 » Sat Jan 29, 2011 10:37 am

As I suspected, the above problem is a result of the relative path. I was trying to make from a separate build directory, this broke the relative path. I have now successfully compiled luxrays without OpenCL.
em21701
 
Posts: 4
Joined: Sun Sep 05, 2010 3:40 pm

Re: Can not build luxrays without OpenCL

Postby soze49 » Sat Feb 12, 2011 1:00 am

Instead of modifying every file in luxray this can be done,
this modification of CMakeList.txt adds a define in the compiler flags
(still need to add SET(LUXRAYS_DISABLE_OPENCL 1) )

Original snip

Code: Select all
#############################################################################
#
# Compiler flags
#
#############################################################################

if(NOT APPLE)
   set(CMAKE_CXX_FLAGS_DEBUG " -Wall -msse -msse2 -msse3 -mssse3 -fPIC -O0 -g")
   # NOTE: QBVH can not be compiled with -O3 because of a GCC bug
   set(CMAKE_CXX_FLAGS_RELEASE " -DNDEBUG -Wall -fPIC -O3 -ftree-vectorize -msse -msse2 -msse3 -mssse3 -fvariable-expansion-in-unroller")
   #The QBVH accelerator needs to be compiled with much reduced optimizations
   # otherwise gcc produces incorrect code and ruins the render on 64bits machines

   set_SOURCE_FILES_PROPERTIES(${LUXRAYS_SOURCE_DIR}/accelerators/qbvhaccel.cpp COMPILE_FLAGS "-O2")
   set_SOURCE_FILES_PROPERTIES(${LUXRAYS_SOURCE_DIR}/accelerators/mqbvhaccel.cpp COMPILE_FLAGS "-O2")
else(NOT APPLE)
   #OSX-flags by jensverwiebe
   set(CMAKE_CXX_FLAGS_RELEASE " -DNDEBUG -Wall -fPIC -O3 -ftree-vectorize -msse -msse2 -msse3 -mssse3 -fvariable-expansion-in-unroller -cl-fast-relaxed-math -cl-mad-enable")
endif(NOT APPLE)


Modified snip
Code: Select all
#############################################################################
#
# Compiler flags
#
#############################################################################
if(LUXRAYS_DISABLE_OPENCL)
   set (EXTRA_CXX_FLAG "-DLUXRAYS_DISABLE_OPENCL")
else(LUXRAYS_DISABLE_OPENCL)
   set (EXTRA_CXX_FLAG "")
endif(LUXRAYS_DISABLE_OPENCL)

if(NOT APPLE)
   set(CMAKE_CXX_FLAGS_DEBUG "${EXTRA_CXX_FLAG} -Wall -msse -msse2 -msse3 -mssse3 -fPIC -O0 -g")
   # NOTE: QBVH can not be compiled with -O3 because of a GCC bug
   set(CMAKE_CXX_FLAGS_RELEASE "${EXTRA_CXX_FLAG} -DNDEBUG -Wall -fPIC -O3 -ftree-vectorize -msse -msse2 -msse3 -mssse3 -fvariable-expansion-in-unroller")
   #The QBVH accelerator needs to be compiled with much reduced optimizations
   # otherwise gcc produces incorrect code and ruins the render on 64bits machines

   set_SOURCE_FILES_PROPERTIES(${LUXRAYS_SOURCE_DIR}/accelerators/qbvhaccel.cpp COMPILE_FLAGS "-O2")
   set_SOURCE_FILES_PROPERTIES(${LUXRAYS_SOURCE_DIR}/accelerators/mqbvhaccel.cpp COMPILE_FLAGS "-O2")
else(NOT APPLE)
   #OSX-flags by jensverwiebe
   set(CMAKE_CXX_FLAGS_RELEASE "${EXTRA_CXX_FLAG} -DNDEBUG -Wall -fPIC -O3 -ftree-vectorize -msse -msse2 -msse3 -mssse3 -fvariable-expansion-in-unroller -cl-fast-relaxed-math -cl-mad-enable")
endif(NOT APPLE)
soze49
 
Posts: 1
Joined: Sat Feb 12, 2011 12:44 am


Return to Compilation & Portability

Who is online

Users browsing this forum: Google [Bot] and 0 guests