RenderToolbox / RenderToolbox4

Matlab toolbox for managing 3D scenes and physically-based rendering.
MIT License
48 stars 7 forks source link

Error with 'rtbTestInstallation()' #20

Closed takuma929 closed 7 years ago

takuma929 commented 7 years ago

I have followed the instructions on website, and I believe that I have installed all the necessary softwares and files: Assimp, OpenEXR, Docker, ToolboxToolbox and Rendertoolbox4. However, the test command 'rtbTestInstallation()' returns attached errors.

I think that there are two problems here. One is that MATLAB cannot find Mitsuba and PBRT.

Checking for Mitsuba Executable...
  Could not find mitsuba
Checking for PBRT Executable...
  Could not find pbrt

The other is related to 'invalid MEX-file'. I have read the online discussion on this issue and I am now using 'LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libstdc++.so.6 matlab' rather than just 'matlab' when I launch MATLAB. However, I still find the error below.

Invalid MEX-file '/home/tmorimoto/Documents/MATLAB/toolboxes/RenderToolbox4_binary/build/ReadMultichannelEXR.mexa64': libIlmImf.so.6: cannot open shared object file: No such file or directory.

I am using Ubuntu 16.04 and MATLAB 2016b. I would be very grateful if you could help these issues.

Best Wishes, Takuma

Error Message.txt

benjamin-heasly commented 7 years ago

Hi @takuma929 -- Thanks for reporting this.

For the first part, it's ok to not find mitsuba and pbrt, as long as you also get:

Checking for Docker...
  OK.

For the second part, the error mentions libIlmImf.so.6, which is used by OpenEXR and installed with it. So I think the error is related OpenEXR, and not libstdc++.

Perhaps Ubuntu 16.04 installs a different version of OpenEXR than we expected. To test this, could you please share the results of the following commands?

dpkg -l "openexr"
dpkg -l "libilm*"
benjamin-heasly commented 7 years ago

For comparison, here is what I get on Linux Mint 17.3 (based on Ubuntu 14.04).

dpkg -l "openexr"
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name                                                  Version                         Architecture                    Description
+++-=====================================================-===============================-===============================-================================================================================================================
ii  openexr                                               1.6.1-7ubuntu1                  amd64                           command-line tools and docs for the OpenEXR image format
$ dpkg -l "libilm*"
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name                                                  Version                         Architecture                    Description
+++-=====================================================-===============================-===============================-================================================================================================================
ii  libilmbase-dev                                        1.0.1-6ubuntu1                  amd64                           development files for IlmBase
ii  libilmbase6:amd64                                     1.0.1-6ubuntu1                  amd64                           several utility libraries from ILM used by OpenEXR
takuma929 commented 7 years ago

Sorry for being late. Here is what I get. So, it looks like the version of OpenEXR is different as you suspected...

tmorimoto@tmorimoto-OptiPlex-7040:~$ dpkg -l "openexr"
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name           Version      Architecture Description
+++-==============-============-============-=================================
ii  openexr        2.2.0-10ubun amd64        command-line tools for the OpenEX
tmorimoto@tmorimoto-OptiPlex-7040:~$ dpkg -l "libilm*"
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name           Version      Architecture Description
+++-==============-============-============-=================================
ii  libilmbase-dev 2.2.0-11ubun amd64        development files for IlmBase
ii  libilmbase12:a 2.2.0-11ubun amd64        several utility libraries from IL
benjamin-heasly commented 7 years ago

Hi @takuma929 -- sorry for the delay on my end.

I agree, it looks like you have a newer version of libilmbase, which is not compatible with the version of the ReadMultichannelEXR function that we distribute by default.

It may be that you can build ReadMultichannelEXR on your machine, to link to your newer library version. Could you try running the function rtbMakeReadMultichannelEXR()? As in the comments, it might run for you as-is, or you might have to edit a few file paths.

If that function is able to build ReadMultichannelEXR, then we can make sure Matlab sees the new version you build, then we can try the installation test again.

takuma929 commented 7 years ago

Thanks for your response. I run rtbMakeReadMultichannelEXR(), but I received the error message below.

rtbMakeReadMultichannelEXR() mex -I/usr/local/include/OpenEXR -I/usr/include/OpenEXR -I/opt/local/include/OpenEXR -L/usr/local/lib -L/usr/lib -L/opt/local/lib -lIlmImf -lz -lImath -lHalf -lIex -lIlmThread -lpthread -output ReadMultichannelEXR ReadMultichannelEXR.cpp Building with 'g++'. Warning: You are using gcc version '5.4.0'. The version of gcc is not supported. The version currently supported with MEX is '4.9.x'. For a list of currently supported compilers see: http://www.mathworks.com/support/compilers/current_release. In rtbMakeReadMultichannelEXR (line 37) MEX completed successfully. Invalid MEX-file '/home/tmorimoto/Documents/MATLAB/toolboxes/RenderToolbox4/Utilities/ReadMultispectralEXR/ReadMultichannelEXR/ReadMultichannelEXR.mexa64': /home/tmorimoto/bin/glnxa64/../../sys/os/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by /usr/lib/x86_64-linux-gnu/libIlmImf-2_2.so.22) Error in rtbReadMultichannelEXR (line 23) [channelInfo, imageData] = ReadMultichannelEXR(exrFile); Error in rtbMakeReadMultichannelEXR (line 41) [sliceInfo, data] = rtbReadMultichannelEXR(testFile);

It again looks like a error related to version..

benjamin-heasly commented 7 years ago

Hi @takuma929,

This might actually be progress. It looks like we may have succeeded with respect to libilmbase.

Now the error mentions libstdc++. I think the workaround with LD_PRELOAD may be useful now. If you didn't already, could you try that again?

takuma929 commented 7 years ago

Thanks. rtbMakeReadMultichannelEXR() actually worked with _LDPRELOAD. Now, I again ran rtbTestInstallation() and got the error message below. Error is just about 'struct2xml', but how can I fix this?

rtbTestInstallation(); Checking working folder: folder exists: /home/tmorimoto/Documents/MATLAB/render_toolbox OK. Trying to write: /home/tmorimoto/Documents/MATLAB/render_toolbox/test.txt OK. Checking for OpenEXR: ldconfig -p | grep libIlmImf OK. Checking for Docker: docker ps OK.

Testing rendering with 4 example scripts. You should see several figures with rendered images.

MakeSceneFiles started at 20-Feb-2017 14:42:01.

Using strategy RtbAssimpStrategy

MakeSceneFiles started with isParallel=0 at 20-Feb-2017 14:42:01.

MakeSceneFiles started at 20-Feb-2017 14:42:02.

Using strategy RtbAssimpStrategy

MakeSceneFiles started with isParallel=0 at 20-Feb-2017 14:42:04.

MakeSceneFiles started at 20-Feb-2017 14:42:04.

Using strategy RtbAssimpStrategy

MakeSceneFiles started with isParallel=0 at 20-Feb-2017 14:42:04.

MakeSceneFiles started at 20-Feb-2017 14:42:05.

Using strategy RtbAssimpStrategy

MakeSceneFiles started with isParallel=0 at 20-Feb-2017 14:42:05.

0 scenes succeeded.

4 scenes failed.


1 rtbMakeCoordinatesTest.m MException with properties:

identifier: 'MATLAB:UndefinedFunction'
   message: 'Undefined function 'struct2xml' for input arguments of type 'struct'.'
     cause: {}
     stack: [9×1 struct]

Undefined function 'struct2xml' for input arguments of type 'struct'.


2 rtbMakeDragon.m MException with properties:

identifier: 'MATLAB:UndefinedFunction'
   message: 'Undefined function 'struct2xml' for input arguments of type 'struct'.'
     cause: {}
     stack: [9×1 struct]

Undefined function 'struct2xml' for input arguments of type 'struct'.


3 rtbMakeMaterialSphereBumps.m MException with properties:

identifier: 'MATLAB:UndefinedFunction'
   message: 'Undefined function 'struct2xml' for input arguments of type 'struct'.'
     cause: {}
     stack: [9×1 struct]

Undefined function 'struct2xml' for input arguments of type 'struct'.


4 rtbMakeMaterialSphereRemodeled.m MException with properties:

identifier: 'MATLAB:UndefinedFunction'
   message: 'Undefined function 'struct2xml' for input arguments of type 'struct'.'
     cause: {}
     stack: [9×1 struct]

Undefined function 'struct2xml' for input arguments of type 'struct'.

Elapsed time is 4.424388 seconds.

No referenceRoot provided. Local renderings will not be compared with reference renderings.

takuma929 commented 7 years ago

I have downloaded 'struct2xml.m' and confirmed that rtbTestInstallation is now working. Thanks a lot for your help.

benjamin-heasly commented 7 years ago

Hi @takuma929 ,

Thats great. I'm glad it's working for you now.

Thank you for your patience with debugging things. I'm sorry it can be such a pain to build the MEX functions. From this experience and others, we have learned that MEX functions don't go together well with shared system libraries. So this is a pattern we will try to avoid in the future.