demo_trimesh and demo_moving_trimesh are freezing on MAC

Issue #44 invalid
Alexander Ukhov created an issue

Hello! I use the latest ODE version but these two demos hangs when I try to run them on my MAC. Other demos seems to work fine. Thanks!

Comments (22)

  1. Oleh Derevenko Account Deactivated

    You need to compile debug build (with debug information turned on and optimizations turned off) and run the program under debugger to see if there are any runtime errors/asserts and what are the threads doing if the program hangs.

  2. Alexander Ukhov reporter

    I did test and found the following: when I do ./configure CFLAGS=-g CXXFLAGS=-g ... then these demos work fine otherwise dont.

  3. Oleh Derevenko Account Deactivated

    The -g flag itself does not affect the code generated. You probably just replace other flags with your assignment. You could compare the default command lines with command line you get when you add extra options to see what you could have overridden. I suggest you configure as

    CXXFLAGS="-g -O0" ./configure ...

  4. Alexander Ukhov reporter

    Hello! I am sorry for the late response.

    Here is what I have just tried:

    CXXFLAGS="-g -O0" ../configure --prefix=./build --with-drawstuff=OSX --enable-libccd --enable-double-precision --enable-demos demos work

    ../configure --prefix=./build --with-drawstuff=OSX --enable-libccd --enable-double-precision --enable-demos demos do not work

  5. Oleh Derevenko Account Deactivated

    Having passed "-g -fno-omit-stack-frames" to the compiler options and plain "-g" to the linker options you should be able to get debug symbols and see sources in debugger even with optimizations enabled. You need to find call stacks of major threads and determine whether they loop constantly or they are stuck somewhere.

  6. Alexander Ukhov reporter

    I compiled it with "-g -O3" And this is what I got:

    demo_trimesh was compiled with optimization - stepping may behave oddly; variables may not be available. Process 93062 stopped * thread #1: tid = 0x94b76, 0x0000000100006b60 demo_trimesh::dsDrawTriangleD(pos=<unavailable>, R=<unavailable>, v0=<unavailable>, v1=<unavailable>, v2=<unavailable>, solid=<unavailable>) + 448 at drawstuff.cpp:1595, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x5fbfccd0) frame #0: 0x0000000100006b60 demo_trimesh::dsDrawTriangleD(pos=<unavailable>, R=<unavailable>, v0=<unavailable>, v1=<unavailable>, v2=<unavailable>, solid=<unavailable>) + 448 at drawstuff.cpp:1595 [opt] 1592 glShadeModel (GL_FLAT); 1593 setTransform (pos2,R2); 1594 drawTriangleD (v0, v1, v2, solid); -> 1595 glPopMatrix(); 1596 } 1597 1598

  7. Oleh Derevenko Account Deactivated

    This thread seems to be drawing triangles. You could break and continue program several times and thus see if a thread is always at the same execution address or it breaks in different places. If execution points vary, that means that the thread is most likely executing normally. You should check other threads.

    Also, copy entire call stack, rather than the innermost frame alone.

  8. Oleh Derevenko Account Deactivated

    It's in drawstuff.cpp

    #ifdef HAVE_APPLE_OPENGL_FRAMEWORK
    #include <OpenGL/gl.h>
    #include <OpenGL/glu.h>
    #else
    #include <GL/gl.h>
    #include <GL/glu.h>
    #endif
    

    Could you check where are the OpenGL headers located in your system? We could add a correction to build scripts if names have been changed recently.

  9. Bram Stolk

    Oops, I'm a fool. I was logged into a linux machine on my mac, and was building there, not on my mac. Ugh. Will retry.

  10. Bram Stolk

    So I downloaded 0.15.2 tar ball, and was able to build and run the trimesh demos just fine.

    Built with:

    $ ./configure --with-drawstuff=OSX --enable-libccd --enable-double-precision --enable-demos
    

    Using XCode 8.3.3 on MacOS 10.12.5

    Configuration:
      Build  system type:      x86_64-apple-darwin16.6.0
      Host   system type:      x86_64-apple-darwin16.6.0
      Use double precision:    yes
      Use drawstuff:           OSX
      Demos enabled:           yes
      Use OPCODE:              yes
      Use GIMPACT:             no
      Use libccd:              yes
      libccd source:           internal
      Custom colliders:
            cylinder-cylinder: libccd
            box-cylinder:      default
            capsule-cylinder:  libccd
            convex-box:        libccd
            convex-capsule:    libccd
            convex-cylinder:   libccd
            convex-sphere:     libccd
            convex-convex:     libccd
      Is target a Pentium:     yes
      Is target x86-64:        yes
      Use old opcode trimesh collider: no
      TLS for global caches:   no
      Threading intf enabled:  yes
      Built-in threading included: yes
      Enable debug error check: yes
      Headers will be installed in ${prefix}/include/ode
      Libraries will be installed in ${exec_prefix}/lib
      Building in directory    /Users/bram/src/ode-0.15.2
    

    Both demo_trimesh and demo_moving_trimesh work for me without crashes.

    Oh, and it was using g++ with -O2 flag. Will see if clang would make it crash, next.

  11. Bram Stolk

    For me, trimesh demos work fine, even with clang -O2.

    CC=clang CXX=clang++ ./configure --with-drawstuff=OSX --enable-libccd --enable-double-precision --enable-demos
    

    Without the env vars, the build defaults to g++, and also gets me working demos.

  12. Bram Stolk

    Works on -O3 level.

    BTW: On MacOS, g++ is aliased to clang++ these days. Tested with:

    $ g++ --version
    Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/usr/include/c++/4.2.1
    Apple LLVM version 8.1.0 (clang-802.0.42)
    Target: x86_64-apple-darwin16.6.0
    Thread model: posix
    InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
    
  13. Alexander Ukhov reporter

    Oleh, like this?

    locate glu.h /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/OpenGL.framework/Versions/A/Headers/glu.h /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift-migrator/sdks/MacOSX.sdk/System/Library/Frameworks/OpenGL.framework/Versions/A/Headers/glu.h /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/OpenGL.framework/Versions/A/Headers/glu.h /System/Library/Frameworks/OpenGL.framework/Versions/A/Headers/glu.h /opt/X11/include/GL/glu.h

  14. Oleh Derevenko Account Deactivated

    So AI U, Bram could not find any issues like those you mentioned. Could it be possible that your compiler is outdated? What's your "g++ --version" output?

  15. Alexander Ukhov reporter

    g++ --version Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1 Apple LLVM version 8.0.0 (clang-800.0.42.1) Target: x86_64-apple-darwin16.6.0 Thread model: posix InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

  16. Log in to comment