alecjacobson / gptoolbox

Matlab toolbox for Geometry Processing.
MIT License
628 stars 166 forks source link

Error when using mex'd "apply_ambient_occlusion" #95

Closed taiya closed 4 years ago

taiya commented 4 years ago

Compiling of mex folder was "ok" (there were two C++ files missing, but build went through by just touch missingfile.cpp). However, when calling from matlab (see error below).

I wonder whether there is an unstated assumption about the exact compiler one is supposed to use? I remember MATLAB was brittle like that...

Invalid MEX-file '~/dev/matlab/gptoolbox/mex/ambient_occlusion.mexa64':
Missing symbol '_ZdlPvm' required by '~/dev/matlab/gptoolbox/mex/ambient_occlusion.mexa64'
Missing symbol '_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE13find_first_ofEPKcmm' required by
'~/dev/matlab/gptoolbox/mex/ambient_occlusion.mexa64'
Missing symbol '_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE4findEPKcmm' required by
'~/dev/matlab/gptoolbox/mex/ambient_occlusion.mexa64'
Missing symbol '_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE5rfindEcm' required by
'~/dev/matlab/gptoolbox/mex/ambient_occlusion.mexa64'
Missing symbol '_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE7compareEPKc' required by
'~/dev/matlab/gptoolbox/mex/ambient_occlusion.mexa64'
Missing symbol '_ZNKSt7__cxx1115basic_stringbufIcSt11char_traitsIcESaIcEE3strEv' required by
'~/dev/matlab/gptoolbox/mex/ambient_occlusion.mexa64'
Missing symbol '_ZNSt13runtime_errorC1EPKc' required by '~/dev/matlab/gptoolbox/mex/ambient_occlusion.mexa64'
Missing symbol '_ZNSt13runtime_errorC1ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE' required by
'~/dev/matlab/gptoolbox/mex/ambient_occlusion.mexa64'
Missing symbol '_ZNSt6thread15_M_start_threadESt10unique_ptrINS_6_StateESt14default_deleteIS1_EEPFvvE' required by
'~/dev/matlab/gptoolbox/mex/ambient_occlusion.mexa64'
Missing symbol '_ZNSt6thread6_StateD2Ev' required by '~/dev/matlab/gptoolbox/mex/ambient_occlusion.mexa64'
Missing symbol '_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE10_M_replaceEmmPKcm' required by
'~/dev/matlab/gptoolbox/mex/ambient_occlusion.mexa64'
Missing symbol '_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE14_M_replace_auxEmmmc' required by
'~/dev/matlab/gptoolbox/mex/ambient_occlusion.mexa64'
Missing symbol '_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE6resizeEmc' required by
'~/dev/matlab/gptoolbox/mex/ambient_occlusion.mexa64'
Missing symbol '_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE7reserveEm' required by
'~/dev/matlab/gptoolbox/mex/ambient_occlusion.mexa64'
Missing symbol '_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE9_M_appendEPKcm' required by
'~/dev/matlab/gptoolbox/mex/ambient_occlusion.mexa64'
Missing symbol '_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE9_M_assignERKS4_' required by
'~/dev/matlab/gptoolbox/mex/ambient_occlusion.mexa64'
Missing symbol '_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE9_M_createERmm' required by
'~/dev/matlab/gptoolbox/mex/ambient_occlusion.mexa64'
Missing symbol '_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE9_M_mutateEmmPKcm' required by
'~/dev/matlab/gptoolbox/mex/ambient_occlusion.mexa64'
Missing symbol '_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEaSEOS4_' required by
'~/dev/matlab/gptoolbox/mex/ambient_occlusion.mexa64'
Missing symbol '_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC1ERKS4_' required by
'~/dev/matlab/gptoolbox/mex/ambient_occlusion.mexa64'
Missing symbol '_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED1Ev' required by
'~/dev/matlab/gptoolbox/mex/ambient_occlusion.mexa64'
Missing symbol '_ZNSt7__cxx1115basic_stringbufIcSt11char_traitsIcESaIcEE7_M_syncEPcmm' required by
'~/dev/matlab/gptoolbox/mex/ambient_occlusion.mexa64'
Missing symbol '_ZNSt7__cxx1118basic_stringstreamIcSt11char_traitsIcESaIcEEC1Ev' required by
'~/dev/matlab/gptoolbox/mex/ambient_occlusion.mexa64'
Missing symbol '_ZNSt7__cxx1118basic_stringstreamIcSt11char_traitsIcESaIcEED1Ev' required by
'~/dev/matlab/gptoolbox/mex/ambient_occlusion.mexa64'
Missing symbol '_ZNSt7__cxx1119basic_ostringstreamIcSt11char_traitsIcESaIcEEC1Ev' required by
'~/dev/matlab/gptoolbox/mex/ambient_occlusion.mexa64'
Missing symbol '_ZNSt7__cxx1119basic_ostringstreamIcSt11char_traitsIcESaIcEED1Ev' required by
'~/dev/matlab/gptoolbox/mex/ambient_occlusion.mexa64'
Missing symbol '_ZSt7getlineIcSt11char_traitsIcESaIcEERSt13basic_istreamIT_T0_ES7_RNSt7__cxx1112basic_stringIS4_S5_T1_EES4_' required by
'~/dev/matlab/gptoolbox/mex/ambient_occlusion.mexa64'
Missing symbol '_ZTINSt6thread6_StateE' required by '~/dev/matlab/gptoolbox/mex/ambient_occlusion.mexa64'
Missing symbol '_ZTTNSt7__cxx1118basic_stringstreamIcSt11char_traitsIcESaIcEEE' required by
'~/dev/matlab/gptoolbox/mex/ambient_occlusion.mexa64'
Missing symbol '_ZTTNSt7__cxx1119basic_ostringstreamIcSt11char_traitsIcESaIcEEE' required by
'~/dev/matlab/gptoolbox/mex/ambient_occlusion.mexa64'
Missing symbol '_ZTVNSt7__cxx1115basic_stringbufIcSt11char_traitsIcESaIcEEE' required by
'~/dev/matlab/gptoolbox/mex/ambient_occlusion.mexa64'
Missing symbol '_ZTVNSt7__cxx1118basic_stringstreamIcSt11char_traitsIcESaIcEEE' required by
'~/dev/matlab/gptoolbox/mex/ambient_occlusion.mexa64'
Missing symbol '_ZTVNSt7__cxx1119basic_ostringstreamIcSt11char_traitsIcESaIcEEE' required by
'~/dev/matlab/gptoolbox/mex/ambient_occlusion.mexa64'.

Error in apply_ambient_occlusion/apply_ambient_occlusion_helper (line 85)
      AO = ambient_occlusion(V,T,O,N,samples);

Error in apply_ambient_occlusion (line 163)
    [AOii,Cii] = apply_ambient_occlusion_helper(tii,AOii,Cii,factor,unoriented);

Error in main (line 19)
apply_ambient_occlusion(t,'AddLights',false,'SoftLighting',false);
>> 
taiya commented 4 years ago

Depending on multiple library versions does not sound like a good idea. This seems to be because I am using R2017b, which expects an older version of cgal/boost, but my OS has new'ish boost

atagliasacchi@tagliacloud:~/dev/matlab/gptoolbox/mex$ ldd intersect_other.mexa64  | grep boost
./intersect_other.mexa64: /usr/local/MATLAB/R2017b/bin/glnxa64/../../sys/os/glnxa64/libstdc++.so.6: version `CXXABI_1.3.9' not found (required by /lib/x86_64-linux-gnu/libboost_thread.so.1.67.0)
./intersect_other.mexa64: /usr/local/MATLAB/R2017b/bin/glnxa64/../../sys/os/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by /lib/x86_64-linux-gnu/libboost_thread.so.1.67.0)
./intersect_other.mexa64: /usr/local/MATLAB/R2017b/bin/glnxa64/../../sys/os/glnxa64/libstdc++.so.6: version `CXXABI_1.3.9' not found (required by /lib/x86_64-linux-gnu/libboost_system.so.1.67.0)
./intersect_other.mexa64: /usr/local/MATLAB/R2017b/bin/glnxa64/../../sys/os/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by /lib/x86_64-linux-gnu/libboost_system.so.1.67.0)
    libboost_thread.so.1.67.0 => /lib/x86_64-linux-gnu/libboost_thread.so.1.67.0 (0x00007fe44460d000)
    libboost_thread.so.1.56.0 => /usr/local/MATLAB/R2017b/bin/glnxa64/libboost_thread.so.1.56.0 (0x00007fe4425a4000)
    libboost_log.so.1.56.0 => /usr/local/MATLAB/R2017b/bin/glnxa64/libboost_log.so.1.56.0 (0x00007fe441d97000)
    libboost_system.so.1.56.0 => /usr/local/MATLAB/R2017b/bin/glnxa64/libboost_system.so.1.56.0 (0x00007fe441b94000)
    libboost_system.so.1.67.0 => /lib/x86_64-linux-gnu/libboost_system.so.1.67.0 (0x00007fe441333000)
    libboost_date_time.so.1.56.0 => /usr/local/MATLAB/R2017b/bin/glnxa64/libboost_date_time.so.1.56.0 (0x00007fe4410cf000)
    libboost_filesystem.so.1.56.0 => /usr/local/MATLAB/R2017b/bin/glnxa64/libboost_filesystem.so.1.56.0 (0x00007fe440eb9000)
    libboost_regex.so.1.56.0 => /usr/local/MATLAB/R2017b/bin/glnxa64/libboost_regex.so.1.56.0 (0x00007fe440ba9000)
    libboost_serialization.so.1.56.0 => /usr/local/MATLAB/R2017b/bin/glnxa64/libboost_serialization.so.1.56.0 (0x00007fe440947000)
    libboost_chrono.so.1.56.0 => /usr/local/MATLAB/R2017b/bin/glnxa64/libboost_chrono.so.1.56.0 (0x00007fe43e8b6000)
    libboost_iostreams.so.1.56.0 => /usr/local/MATLAB/R2017b/bin/glnxa64/libboost_iostreams.so.1.56.0 (0x00007fe43e6a2000)
alecjacobson commented 4 years ago

Yes. this looks like a std-library/boost mismatch. Might try to convince the mex compilation to find the matlab version of boost. Thought this can be tricky. For now, I'm only going to track down compilation errors for 2019+ (the versions I have access to).

If you find a solution, please do post it for others.

taiya commented 4 years ago

Agreed, this is because I only have access to MATLAB 2017. Good to close it, but I thought to report if others are running into similar problems ;)