On Sun, May 29, 2011 at 4:43 PM, Guilherme Kunigami
<[email protected]>wrote:

> Hi,
>
> I've successfully compiled and executed a simple ray-tracer using OSL.
> Though, this renderer was included together with OSL source code and they
> were compiled together too. Now, I'm trying to compile this renderer outside
> OSL build. Though, I've been stuck with compilation errors for three days.
>
> I've tried to reduce the code so the error may be spot easily. The
> compilation error I get is the following:
>
> Undefined symbols:
>   "typeinfo for OSL::RendererServices", referenced from:
>       typeinfo for OSL::SimpleRendererin simplerend.o
> ld: symbol(s) not found
> collect2: ld returned 1 exit status
> make[2]: *** [testrender] Error 1
> make[1]: *** [CMakeFiles/testrender.dir/all] Error 2
> make: *** [all] Error 2
>

Sorry, the actual error is

Undefined symbols:
  "typeinfo for OSL::RendererServices", referenced from:
      typeinfo for OSL::SimpleRendererin *testrender.o*
ld: symbol(s) not found
collect2: ld returned 1 exit status
make[2]: *** [testrender] Error 1
make[1]: *** [CMakeFiles/testrender.dir/all] Error 2
make: *** [all] Error 2

I copied the error from the code before I made the simplification.

>
> I've read that this may be related to the fact that virtual methods were
> not implemented in the derived class. My CMakeLists.txt is the following:
>
> ADD_EXECUTABLE ( testrender testrender.cpp)
>
> set (CMAKE_MODULE_PATH "cmake")
>
> include(util_macros)
>
> # Find dependencies
> include(boost) # copied from OSL cmakelists
> include(FindOpenEXR) # copied from OSL cmakelists
> include(FindTBB) # copied from OSL cmakelists
> include(FindOSL)
> include(oiio) # copied from OSL cmakelists
>
> include_directories(${OPENIMAGEIO_INCLUDES} ${OSLEXEC_INCLUDES}/OSL)
>
> TARGET_LINK_LIBRARIES ( testrender ${OSLEXEC_LIBRARY}
> ${OSLCOMP_LIBRARY} ${OSLQUERY_LIBRARY} ${OPENIMAGEIO_LIBRARY}
> ${Boost_LIBRARIES})
>
> My FindOSL.cmake file is:
>
> find_library (OSLEXEC_LIBRARY
>      NAMES oslexec
>      PATHS /Users/kunigami/dev/osl/dist/macosx/lib
> )
> find_path (OSLEXEC_INCLUDES
>   NAMES OSL/osl.h
>   PATHS /Users/kunigami/dev/osl/dist/macosx/include
> )
> find_library (OSLCOMP_LIBRARY
>      NAMES oslcomp
>      PATHS /Users/kunigami/dev/osl/dist/macosx/lib
> )
> find_path (OSLCOMP_INCLUDES
>   NAMES OSL/osl.h
>   PATHS /Users/kunigami/dev/osl/dist/macosx/include
> )
>
> find_library (OSLQUERY_LIBRARY
>      NAMES oslquery
>      PATHS /Users/kunigami/dev/osl/dist/macosx/lib
> )
> find_path (OSLQUERY_INCLUDES
>   NAMES OSL/oslquery.h
>   PATHS /Users/kunigami/dev/osl/dist/macosx/include
> )
>
> The file I'm trying to compile is 'testrender.cpp':
> http://pastebin.com/HmstAteR
>
> The file where RendererServices is defined is called 'oslexec.h' and is
> part of OSL: http://pastebin.com/0FGDnSve
>
> Note that 'RendererServices' contains several "pure virtual methods", but
> I'm implementing them all in the derived class SimpleRenderer at
> testrender.cpp. Also, when I compile testender.cpp together with the OSL
> library, this compile error does not happen. In this case, the
> CMakeLists.txt is a bit different, because we have references to oslexec,
> oslcomp and oslquery:
>
> ADD_EXECUTABLE ( testrender testrender.cpp)
>
> TARGET_LINK_LIBRARIES ( testrender oslexec oslcomp oslquery
> ${OPENIMAGEIO_LIBRARY} ${Boost_LIBRARIES})
>
> INSTALL ( TARGETS testrender RUNTIME DESTINATION bin )
>
> Does anyone have any idea on what might be happening?
> Thanks,
>
>
------------------------------------------------------------------------------
vRanger cuts backup time in half-while increasing security.
With the market-leading solution for virtual backup and recovery, 
you get blazing-fast, flexible, and affordable data protection.
Download your free trial now. 
http://p.sf.net/sfu/quest-d2dcopy1
_______________________________________________
BRL-CAD Developer mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-devel

Reply via email to