OSX Mavericks Compile Issue

Here’s the output from lldb, if you need gdb, I’ll try to get it setup tomorrow night. gdb on mac os x isn’t the default debugger, and I have to jump through a few hoops to get it up and running (sourceware.org/gdb/wiki/BuildingOnDarwin)

lldb /usr/local/opt/python/bin/python2.7 – -B built/direct/ffi/jGenPyCode.py -r panda3d.core panda3d.physics panda3d.fx panda3d.direct panda3d.vision panda3d.skel panda3d.egg
Current executable set to ‘/usr/local/opt/python/bin/python2.7’ (x86_64).
(lldb) continue
error: invalid process
(lldb) r
Process 54356 launched: ‘/usr/local/opt/python/bin/python2.7’ (x86_64)
Process 54356 stopped

  • thread #1: tid = 0x176f64, 0x00007fff5fc01028 dyld_dyld_start, stop reason = exec frame #0: 0x00007fff5fc01028 dyld_dyld_start
    dyld`_dyld_start:
    -> 0x7fff5fc01028: popq %rdi
    0x7fff5fc01029: pushq 0x0 0x7fff5fc0102b: movq %rsp, %rbp 0x7fff5fc0102e: andq -0x10, %rsp
    (lldb) continue
    Process 54356 resuming
    Importing code library: panda3d.core
    Found extensions for class: NodePath
    Found extensions for class: Mat3
    Found extensions for class: HTTPChannel
    Found extensions for class: VBase3
    Found extensions for class: VBase4
    Importing code library: panda3d.physics
    Process 54356 stopped
  • thread #1: tid = 0x176f64, 0x000000010528513d PythonPyInt_FromLong + 33, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x0) frame #0: 0x000000010528513d PythonPyInt_FromLong + 33
    Python`PyInt_FromLong + 33:
    -> 0x10528513d: incq (%rcx)
    0x105285140: jmp 0x105285185 ; PyInt_FromLong + 105
    0x105285142: movq 0xfd907(%rip), %rax ; Python.__DATA.__bss + 3120
    0x105285149: testq %rax, %rax
    (lldb) bt
  • thread #1: tid = 0x176f64, 0x000000010528513d Python`PyInt_FromLong + 33, queue = ‘com.apple.main-thread’, stop reason = EXC_BAD_ACCESS (code=1, address=0x0)
    • frame #0: 0x000000010528513d PythonPyInt_FromLong + 33 frame #1: 0x0000000106b39756 physics.soDtool_PyModuleClassInit_BaseParticleEmitter(object*) + 150
      frame #2: 0x0000000106b6bd64 physics.soBuildInstants(_object*) + 20 frame #3: 0x00000001051fb489 libp3dtoolconfig.1.9.dylibDtool_PyModuleInitHelper(LibraryDef**, char const*) + 329
      frame #4: 0x0000000106b04266 physics.soinitphysics + 54 frame #5: 0x000000010009fe02 PythonPyImport_LoadDynamicModule + 140
      frame #6: 0x000000010009fb0f Pythonimport_submodule + 274 frame #7: 0x000000010009f6d9 Pythonload_next + 280
      frame #8: 0x000000010009d6c8 PythonPyImport_ImportModuleLevel + 645 frame #9: 0x00000001000830dc Pythonbuiltin___import
      + 135
      frame #10: 0x0000000100089ac1 PythonPyEval_EvalFrameEx + 7714 frame #11: 0x000000010008e145 Pythonfast_function + 192
      frame #12: 0x000000010008ac5b PythonPyEval_EvalFrameEx + 12220 frame #13: 0x000000010008e145 Pythonfast_function + 192
      frame #14: 0x000000010008ac5b PythonPyEval_EvalFrameEx + 12220 frame #15: 0x0000000100087b0e PythonPyEval_EvalCodeEx + 1608
      frame #16: 0x00000001000874c0 PythonPyEval_EvalCode + 54 frame #17: 0x00000001000a72ec Pythonrun_mod + 53
      frame #18: 0x00000001000a738f PythonPyRun_FileExFlags + 133 frame #19: 0x00000001000a6f2c PythonPyRun_SimpleFileExFlags + 769
      frame #20: 0x00000001000b847a Python`Py_Main + 2970
      (lldb)

Ah, right, I had forgotten that clang is the default compiler now. This is quite sufficient, thanks.

This is odd. It seems to crash in something as simple as PyInt_FromLong(0). This would suggest that there’s something wrong with the way it is linked to Python.

Which Python version is used? Do you have multiple versions of Python installed, perchance?

I do have multiple versions of Python installed, the default version that comes with OS X, as well as the version installed by “homebrew” (python 2.7.7 located at /usr/local/Cellar/python/2.7.7_2), which is what the shell finds, and what is run by make panda.py

Could it potentially have some sort of hard coded path?

I’d really like to use python 2.7.7 since all the libraries for homebrew (brew.sh) are built against that version of python.

Hmm, makepanda is written to link against the framework and everything. You’d have to hack makepanda to use your other build, by finding the line that starts with

SmartPkgEnable("PYTHON"

and commenting it out, and instead creating these lines:

PkgEnable("PYTHON")
IncDirectory("PYTHON", "/path/to/python/include")
LibName("PYTHON", "-lpython2.7")
LibDirectory("PYTHON", "/path/to/your/python/lib")

Then remove “built” and create a clean build. Again, run makepanda with the homebrew version of Python.

That completely fixed the problem. Thank you so very much!

I had to disable opencv, but after I did that, no crash!

For reference, the modified lines are as follows (with homebrew any python 2.7.7):

    PkgEnable("PYTHON")
    IncDirectory("PYTHON", "/usr/local/Cellar/python/2.7.7_2/Frameworks/Python.framework/Versions/2.7/include")
    LibName("PYTHON", "-lpython2.7")
    LibDirectory("PYTHON", "/usr/local/Cellar/python/2.7.7_2/Frameworks/Python.framework/Versions/2.7/lib")

For reference, the error for opencv (I have the homebrew version):

Importing code library: panda3d.direct
Found extensions for class: CInterval
Importing code library: panda3d.vision
Traceback (most recent call last):
File “built/direct/ffi/jGenPyCode.py”, line 94, in
DoGenPyCode.run()
File “/Users/joepease/Downloads/panda3d_2/built/direct/ffi/DoGenPyCode.py”, line 328, in run
generateNativeWrappers()
File “/Users/joepease/Downloads/panda3d_2/built/direct/ffi/DoGenPyCode.py”, line 260, in generateNativeWrappers
import(moduleName)
ImportError: dlopen(/Users/joepease/Downloads/panda3d_2/built/panda3d/vision.so, 2): Symbol not found: _cvCreateCameraCapture
Referenced from: /Users/joepease/Downloads/panda3d_2/built/lib/libp3vision.1.9.dylib
Expected in: flat namespace
in /Users/joepease/Downloads/panda3d_2/built/lib/libp3vision.1.9.dylib
Storing dependency cache.
Elapsed Time: 43 min 34 sec
The following command returned a non-zero value: /usr/local/opt/python/bin/python2.7 -B built/direct/ffi/jGenPyCode.py -r panda3d.core panda3d.physics panda3d.fx panda3d.direct panda3d.vision panda3d.skel panda3d.egg
Build terminated.

And the command I used to compile panda3d:
CFLAGS=-ftemplate-depth=120 python makepanda/makepanda.py --everything --no-opencv