Results 1 to 3 of 3

Thread: Help compiling mental ray shader under linux x64.

  1. #1
    Join Date
    Oct 2006
    Posts
    3

    Default Help compiling mental ray shader under linux x64.

    I'm trying to compile the hotOcean MR shader (http://www.nico-rehberg.de/shader.html) for maya 2016 under linux x64 on fedora 21, although I've tried several distros and even tried with 2015. I've been able to compile several other shaders with no issues, but this one has been giving me days of grief.

    I'm able to compile and link it with shared libraries, but when I try to get a static .so, it gives me some errors.

    I'm not a pro at this obviously, but I know the code compiles. I had the author do it for me for 2015, but I would like to learn how to do it on my own, so we don't have to bug him in the future, and or he is not available.

    Here are the lines I'm using.

    Code:
    compile:
    
    g++ -I /usr/autodesk/mentalrayForMaya2016/devkit/include/ -I ./ -I ./Source/ -I /usr/include/OpenEXR/ -I /usr/lib/include -c -O3 -fPIC -Bsymbolic -DBIT64 ./shader/hotOcean.cpp `pkg-config blitz --libs --cflags` -o hotOcean.o
    
    link:
    
    g++ -o hotOcean.so hotOcean.o  -static -L/usr/lib64 -lfftw3f -lblitz -L./ -lImath -Wl,-Bdynamic -L/usr/autodesk/maya2016/lib -lOpenMaya -lFoundation -lOpenMayaAnim -lImage -lm -lstdc++ -Wl,--as-needed
    
    
    
    Here's what I get...
    
    hotOcean.o: In function `miaux_user_memory_pointer(miState*, int)':
    hotOcean.cpp:(.text+0x2a): undefined reference to `mi_query'
    hotOcean.cpp:(.text+0x46): undefined reference to `mi_mem_int_allocate'
    hotOcean.o: In function `miaux_release_user_memory(char*, miState*, void*)':
    hotOcean.cpp:(.text+0x7c): undefined reference to `mi_query'
    hotOcean.cpp:(.text+0x99): undefined reference to `mi_mem_int_release'
    hotOcean.cpp:(.text+0xbb): undefined reference to `mi_fatal'
    hotOcean.o: In function `getPointBuffer(miState*, int, int, pointSample*, int)':
    hotOcean.cpp:(.text+0x127): undefined reference to `mi_query'
    hotOcean.cpp:(.text+0x134): undefined reference to `mi_lock'
    hotOcean.cpp:(.text+0x150): undefined reference to `mi_unlock'
    hotOcean.o: In function `hotOcean':
    hotOcean.cpp:(.text+0x784): undefined reference to `mi_matrix_rotate_axis'
    hotOcean.cpp:(.text+0x797): undefined reference to `mi_vector_transform'
    hotOcean.cpp:(.text+0x880): undefined reference to `mi_point_to_world'
    hotOcean.cpp:(.text+0x8b2): undefined reference to `mi_phen_eval'
    hotOcean.cpp:(.text+0x8de): undefined reference to `mi_phen_eval'
    hotOcean.cpp:(.text+0x90e): undefined reference to `mi_phen_eval'
    hotOcean.cpp:(.text+0x941): undefined reference to `mi_phen_eval'
    hotOcean.cpp:(.text+0x976): undefined reference to `mi_phen_eval'
    hotOcean.cpp:(.text+0x9a0): undefined reference to `mi_point_to_object'
    hotOcean.cpp:(.text+0xae8): undefined reference to `mi_query'
    hotOcean.cpp:(.text+0xb36): undefined reference to `mi_vector_from_world'
    hotOcean.cpp:(.text+0xcd1): undefined reference to `mi_query'
    hotOcean.cpp:(.text+0xcde): undefined reference to `mi_lock'
    hotOcean.cpp:(.text+0xd2e): undefined reference to `mi_unlock'
    hotOcean.cpp:(.text+0xecc): undefined reference to `mi_point_to_world'
    hotOcean.cpp:(.text+0xee0): undefined reference to `mi_vector_to_world'
    hotOcean.cpp:(.text+0xf3a): undefined reference to `mi_vector_to_world'
    hotOcean.cpp:(.text+0xf8f): undefined reference to `mi_point_to_object'
    hotOcean.cpp:(.text+0xfa3): undefined reference to `mi_vector_to_object'
    hotOcean.o: In function `nr_vectorDisplace':
    hotOcean.cpp:(.text+0x1103): undefined reference to `mi_vector_from_world'
    hotOcean.cpp:(.text+0x11fc): undefined reference to `mi_phen_eval'
    hotOcean.cpp:(.text+0x1250): undefined reference to `mi_phen_eval'
    hotOcean.o: In function `hotOcean_exit':
    hotOcean.cpp:(.text+0x12d1): undefined reference to `mi_query'
    hotOcean.cpp:(.text+0x13d5): undefined reference to `mi_mem_int_release'
    hotOcean.cpp:(.text+0x1648): undefined reference to `mi_fatal'
    hotOcean.o: In function `hotOcean_init':
    hotOcean.cpp:(.text+0x18e4): undefined reference to `mi_info'
    hotOcean.cpp:(.text+0x1908): undefined reference to `mi_info'
    hotOcean.cpp:(.text+0x222c): undefined reference to `Imath_2_1::Rand32::nextf()'
    hotOcean.cpp:(.text+0x2249): undefined reference to `Imath_2_1::Rand32::nextf()'
    hotOcean.cpp:(.text+0x22dc): undefined reference to `Imath_2_1::Rand32::nextf()'
    hotOcean.cpp:(.text+0x22f9): undefined reference to `Imath_2_1::Rand32::nextf()'
    hotOcean.cpp:(.text+0x2616): undefined reference to `mi_phen_eval'
    hotOcean.cpp:(.text+0x2997): undefined reference to `mi_phen_eval'
    hotOcean.cpp:(.text+0x2ec0): undefined reference to `mi_phen_eval'
    hotOcean.cpp:(.text+0x2ee7): undefined reference to `mi_phen_eval'
    hotOcean.cpp:(.text+0x2f19): undefined reference to `mi_phen_eval'
    hotOcean.o:hotOcean.cpp:(.text+0x2f4b): more undefined references to `mi_phen_eval' follow
    collect2: error: ld returned 1 exit status
    I know i'm missing something simple and have literally spent days ping ponging from error to error and this is as far as I can get.

    Any help would be much appreciated.

  2. #2
    Join Date
    Dec 2004
    Location
    Marina Del Rey, California
    Posts
    4,143

    Default

    Not sure how you are able to compile other shaders. This seems to be missing very basic functions from shader.h, etc.

    Are you really putting a space between -I flag and the path, or is that just how the text got typed in here in the forum? That worked on your other compiles?
    For example, -I /usr/autodesk/mentalrayForMaya2016/devkit/include/ should be -I/usr/autodesk/mentalrayForMaya2016/devkit/include/
    Barton Gawboy

  3. #3
    Join Date
    Jan 2007
    Location
    Berlin, Germany
    Posts
    165

    Default

    -static for the second g++ call is certainly wrong. I'd use -Bsymbolic instead.
    mental ray's symbols (mi_*) should be resolved from Maya plugin when the shader library is loaded.
    Note that you also have some dependencies on Ilmbase/OpenEXR (Imath_2_1....), you probably need to link against some OpenEXR dll as well (not sure if those symbols are exported by Maya).

    Juri

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •